summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-09-19 19:41:20 +0200
committeremkael <emkael@tlen.pl>2017-09-19 19:41:20 +0200
commit9f8e0908356a7ccdf5fac95aed77a77f7ffa047c (patch)
treee2a48a64c5ed10a4bc3a6c719480b0c3801d6ce0
parenta9f5093df64222395f6b0de21e6afee954c7a9a2 (diff)
Handling prolonged loading situations in main window UI
-rw-r--r--Aktywator/Bws.cs2
-rw-r--r--Aktywator/MainForm.cs16
2 files changed, 18 insertions, 0 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 580b08f..525faa1 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -278,6 +278,7 @@ namespace Aktywator
public void loadSettings()
{
+ main.startLoading();
if (settings == null)
{
return;
@@ -317,6 +318,7 @@ namespace Aktywator
MessageBox.Show("Nie można uzyskać dostępu do pól: \n" + errors.ToString() + ".\nPrawdopodobnie te pola nie istnieją.",
"Brakuje pól w tabeli Settings", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
+ main.stopLoading();
}
public void sectionGroupWarning()
diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs
index e254f9a..10fa819 100644
--- a/Aktywator/MainForm.cs
+++ b/Aktywator/MainForm.cs
@@ -310,6 +310,7 @@ namespace Aktywator
private void bMySQLTournament_Click(object sender, EventArgs e)
{
+ startLoading();
try
{
ChooseTournament choose = new ChooseTournament();
@@ -324,10 +325,12 @@ namespace Aktywator
{
MessageBox.Show(ee.Message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
+ stopLoading();
}
private void bRRBTournament_Click(object sender, EventArgs e)
{
+ startLoading();
try
{
OpenFileDialog fDialog = new OpenFileDialog();
@@ -344,6 +347,7 @@ namespace Aktywator
{
MessageBox.Show(ee.Message, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
+ stopLoading();
}
private void updateTournamentInfo(Tournament tournament)
@@ -579,5 +583,17 @@ namespace Aktywator
{
teamNames.ShowDialog();
}
+
+ internal void startLoading()
+ {
+ tabControl1.Enabled = false;
+ this.Cursor = Cursors.WaitCursor;
+ }
+
+ internal void stopLoading()
+ {
+ tabControl1.Enabled = true;
+ this.Cursor = Cursors.Default;
+ }
}
}