From 9f8e0908356a7ccdf5fac95aed77a77f7ffa047c Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 19 Sep 2017 19:41:20 +0200 Subject: Handling prolonged loading situations in main window UI --- Aktywator/Bws.cs | 2 ++ Aktywator/MainForm.cs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'Aktywator') 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; + } } } -- cgit v1.2.3