/// <summary> /// Shows loading bar /// </summary> /// <param name="sender">Placeholder object</param> /// <param name="e">Event activated by DoWorkEvent Handler</param> private static void showSplashScreen(object sender, DoWorkEventArgs e) { // start showing the loading bar when thread starts loading = new LoadingSplashScreen(); loading.Text = displayName; loading.progressBar1.Visible = false; loading.pictureBox1.Visible = true; loading.Size = new System.Drawing.Size(338, 253); loading.pictureBox1.Location = new System.Drawing.Point(108, 59); Application.Run(loading); }
/// <summary> /// When called, invokes the backgroundWorker thread to invoke a delagate that stops /// the backgroundWorker from showing the progress bar /// </summary> public static void stopBlockLoadingBar() { //in case if there was not enough time to instantiate loading while (loading == null) { Thread.Sleep(5); } //in case if loading bar cancelled during loading if (loading.IsHandleCreated) { //invoke loading bar thread and end loading.Invoke(new StopRunning(LoadingSplashScreen.closeSplashScreen)); } //reset loading to null to handle new cases loading = null; }
/// <summary> /// Shows (block) loading bar /// </summary> /// <param name="sender">Placeholder object</param> /// <param name="e">Event actuvated by DoWorkEvent Handler</param> private static void showBlockLoadingBar(object sender, DoWorkEventArgs e) { //starts block loading bar loading = new LoadingSplashScreen(); loading.Text = displayName; loading.Size = new System.Drawing.Size(338, 81); loading.progressBar1.Visible = true; loading.pictureBox1.Visible = false; Application.Run(loading); }