private void OnIndexOperationProgressChanged(object sender, OperationProgressEventArgs e)
 {
     dispatcher.Invoke(() =>
     {
         ProgressPercentage = e.ProgressPercentage;
     });
 }
        private void VM_StatusUpdated(object sender, OperationProgressEventArgs e)
        {
            Dispatcher?.Invoke(() =>
            {
                // Set the progress
                this.SetTaskbarProgressValue(new Progress(e.Progress.TotalProgress.Percentage, 100, 0));

                // Set the state
                switch (e.State)
                {
                case OperationState.None:
                    this.SetTaskbarProgressState(TaskbarProgressBarState.NoProgress);
                    break;

                case OperationState.Running:
                    this.SetTaskbarProgressState(TaskbarProgressBarState.Normal);
                    break;

                case OperationState.Paused:
                    this.SetTaskbarProgressState(TaskbarProgressBarState.Paused);
                    break;

                case OperationState.Error:
                    this.SetTaskbarProgressState(TaskbarProgressBarState.Error);
                    break;

                default:
                    this.SetTaskbarProgressState(TaskbarProgressBarState.NoProgress);
                    break;
                }
            });
        }
    private void VM_StatusUpdated(object sender, OperationProgressEventArgs e)
    {
        Dispatcher?.Invoke(() =>
        {
            var win = Application.Current.MainWindow;

            if (win == null)
            {
                return;
            }

            // Set the progress
            win.SetTaskbarProgressValue(new Progress(e.Progress.TotalProgress.Percentage, 100, 0));

            // Set the state
            switch (e.State)
            {
            case OperationState.None:
                win.SetTaskbarProgressState(TaskbarProgressBarState.NoProgress);
                break;

            case OperationState.Running:
                win.SetTaskbarProgressState(TaskbarProgressBarState.Normal);
                break;

            case OperationState.Paused:
                win.SetTaskbarProgressState(TaskbarProgressBarState.Paused);
                break;

            case OperationState.Error:
                win.SetTaskbarProgressState(TaskbarProgressBarState.Error);
                break;

            default:
                win.SetTaskbarProgressState(TaskbarProgressBarState.NoProgress);
                break;
            }
        });
    }
Beispiel #4
0
 /// Progress event handler
 public void OnOutputProgress(object sender, OperationProgressEventArgs e)
 {
     ScriptContext ctx = (ScriptContext)sender;
     if (e.PercentCompleted == 0)
         ctx.WriteLine(OutputType.Debug, "@ " + ctx.CallStack.StackTraceFlat);
 }