/// <summary> /// static void ShowProgress(int minValue, int maxValue, int presentValue, string status) /// Display progress and status in toolbar of main form /// </summary> /// <param name="minValue"></param> /// <param name="maxValue"></param> /// <param name="presentValue"></param> /// <param name="status"></param> /// <returns></returns> public static void ShowProgress(int minValue, int maxValue, int presentValue, string status) { try { if (progressBar != null) { //if the progress toolbar items are not visible, make them visible if (!progressBar.Visible || !progressStatus.Visible || !progessSeparator.Visible) { progressBar.Visible = true; progressStatus.Visible = true; progessSeparator.Visible = true; } progressBar.Minimum = minValue; progressBar.Maximum = maxValue; progressBar.Value = presentValue; progressStatus.Text = status; Application.DoEvents(); } else { // show the progress form if (progressForm == null) { progressForm = new frmProgress(); progressForm.StartPosition = FormStartPosition.CenterScreen; } progressForm.MinValue = minValue; progressForm.MaxValue = maxValue; progressForm.Pct = presentValue; progressForm.Show(); } } catch (Exception ex) { CommonRoutines.DisplayErrorMessage("$E:" + moduleName + ".ShowProgress > " + ex.Message); } return; }
/// <summary> /// static void HideProgress() /// Hide progress and status in toolbar of main form /// </summary> /// <returns></returns> public static void HideProgress() { try { if (progressBar != null) { //clear previous values progressBar.Minimum = 0; progressBar.Maximum = 0; progressBar.Value = 0; progressStatus.Text = String.Empty; progressBar.Visible = false; progressStatus.Visible = false; progessSeparator.Visible = false; } else { if (progressForm != null) { progressForm.Close(); progressForm = null; } } } catch (Exception ex) { CommonRoutines.DisplayErrorMessage("$E:" + moduleName + ".HideProgress > " + ex.Message); } return; }