void DoHideProgress() { if (!statusProgressBarIsVisible) { // make stuff look nice and delay it a little more by using an animation // on the progress bar TimeSpan timeSpan = TimeSpan.FromSeconds(0.25); var animation = new DoubleAnimation(0, new Duration(timeSpan), FillBehavior.HoldEnd); statusProgressBarItem.BeginAnimation(OpacityProperty, animation); jobNamePanel.BeginAnimation(OpacityProperty, animation); Action method = delegate { if (!statusProgressBarIsVisible) { statusProgressBarItem.Visibility = Visibility.Collapsed; jobNamePanel.Content = currentTaskName = ""; var taskbar = DockingService.MainWindow.TaskbarItemInfo; if (taskbar != null) { taskbar.ProgressState = TaskbarItemProgressState.None; } StopHideProgress(); } }; System.Threading.Thread.Sleep(timeSpan); this.Dispatcher.Invoke(method); } }
void DoHideProgress() { if (!statusProgressBarIsVisible) { // make stuff look nice and delay it a little more by using an animation // on the progress bar TimeSpan timeSpan = TimeSpan.FromSeconds(0.25); var animation = new DoubleAnimation(0, new Duration(timeSpan), FillBehavior.HoldEnd); statusProgressBarItem.BeginAnimation(OpacityProperty, animation); jobNamePanel.BeginAnimation(OpacityProperty, animation); SD.MainThread.CallLater( timeSpan, delegate { if (!statusProgressBarIsVisible) { statusProgressBarItem.Visibility = Visibility.Collapsed; jobNamePanel.Content = currentTaskName = ""; var taskbar = SD.Workbench.MainWindow.TaskbarItemInfo; if (taskbar != null) { taskbar.ProgressState = TaskbarItemProgressState.None; } StopHideProgress(); } }); } }
private void DoHideProgress() { if (!_statusProgressBarIsVisible) { // make stuff look nice and delay it a little more by using an animation // on the progress bar var timeSpan = TimeSpan.FromSeconds(0.25); var animation = new DoubleAnimation(0, new Duration(timeSpan), FillBehavior.HoldEnd); _statusProgressBarItem.BeginAnimation(OpacityProperty, animation); _jobNamePanel.BeginAnimation(OpacityProperty, animation); Current.Dispatcher.InvokeLaterAndForget( timeSpan, delegate { if (!_statusProgressBarIsVisible) { _statusProgressBarItem.Visibility = Visibility.Collapsed; _jobNamePanel.Content = _currentTaskName = ""; var taskbar = ((Window)Current.Gui.MainWindowObject).TaskbarItemInfo; if (taskbar != null) { taskbar.ProgressState = TaskbarItemProgressState.None; } StopHideProgress(); } }); } }