예제 #1
0
        protected override void OnProgressChanged(ProgressChangedEventArgs e)
        {
            if (ProgressBar != null)
            {
                ProgressBar.Value = e.ProgressPercentage;
            }
            var state = (ProgressState)e.UserState;

            if (CurrentOperationLabel != null)
            {
                CurrentOperationLabel.Text = state.Operation;
            }
            if (ProgressLabel != null)
            {
                ProgressLabel.Text = e.ProgressPercentage + "%";
            }

            CurrentAction        = (IAction)state.Action;
            CancelButton.Enabled = CurrentAction.SupportsCancellation;
            if (CurrentAction.SupportsCancellation && CancellationPending)
            {
                CurrentAction.CancelAsync();
            }
            base.OnProgressChanged(e);
        }