public void Progress(string key, int percent, string message) { defaultStatusPanel.Caption = message; defaultProgressPanel.EditValue = percent; if (percent > 0) { defaultProgressPanel.Visibility = BarItemVisibility.Always; } else { defaultProgressPanel.Visibility = BarItemVisibility.Never; } // we update the values regardless, we just repaint if it is time. if (stopwatch.ElapsedMilliseconds > INT_MillisecondsToRefreshStatusBar) { // Allow CPU intensive�operations�executing on�the�UI�thread�to�repaint the status bar, // even though the WinMsg isn't coming through unless DoEvents is called. // A better option would be to require developers to refactor loops to use true .NET threading if (this.ribbonStatusBar.InvokeRequired) { this.ribbonStatusBar.BeginInvoke(new MethodInvoker(() => defaultStatusPanel.Refresh())); } else { defaultStatusPanel.Refresh(); } stopwatch.Restart(); } }
/// <summary> /// Refresh statusbaru po jeho aktualizaci, je nutno volat po změně viditelnosti prvku, nikoli po změně obsahu /// </summary> protected void _StatusBarRefresh() { if (this.InvokeRequired) { this.BeginInvoke(new Action(_StatusBarRefresh)); } else { this.StatusBar.Refresh(); _StatusInfoTextItem.Refresh(); _StatusProgressEdit.Refresh(); } }