/// <summary> /// Shows loading form and displays loading text while Action execution. /// </summary> /// <param name="action">Action to do while loading form is shown</param> /// <param name="text">Text to show, while loading</param> public void runAsAppendCounting(Action action, String text) { this.Enabled = false; ldForm = new LoadingForm(); ldForm.loadingText = text; ldForm.action = action; ldForm.formToInvoke = this; ldForm.Show(); }
/// <summary> /// Executes loading form. Used by background worker. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void handleLoading(Object sender, DoWorkEventArgs e) { ldForm = new LoadingForm(); ldForm.loadingText = loadingText; Invoke(new Action(() => { if((ldForm!=null)&&(!ldForm.IsDisposed))ldForm.Show(); })); }