コード例 #1
0
ファイル: TaskProgress.cs プロジェクト: tempbottle/INCC6
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskProgress"/> class with the specified
        /// description, task, cancellation token source, and progress tracker.
        /// </summary>
        /// <param name="title">The title for the progess pop-up.</param>
        /// <param name="description">The description of the task.</param>
        /// <param name="task">The task.</param>
        /// <param name="cancellationTokenSource">The cancellation token source that cancels the task.</param>
        /// <param name="progressTracker">The progress tracker that tracks the task's progress.</param>
        /// <exception cref="ArgumentNullException"><paramref name="description"/> or <paramref name="task"/> is <c>null</c>.</exception>
        public TaskProgress(string title, string description, Task task, CancelStopAbort cancelStopAbortTokensSource, ProgressTracker progressTracker, bool isAssay)
        {
            if (description == null || task == null)
            {
                throw new ArgumentNullException();
            }

            m_stopCommand   = new CancelCommand(cancelStopAbortTokensSource.StopTokenSource, 0);
            m_cancelCommand = new CancelCommand(cancelStopAbortTokensSource.CancellationTokenSource, 1);
            m_abortCommand  = new CancelCommand(cancelStopAbortTokensSource.AbortTokenSource, 2); // make an enum!

            m_description             = description;
            m_isProgressIndeterminate = true;
            m_progress        = 0;
            m_progressTracker = progressTracker;
            m_task            = task;
            m_title           = title;
            m_isAssay         = isAssay;

            if (m_progressTracker != null)
            {
                m_progressTracker.ProgressChanged += (sender, e) => {
                    IsProgressIndeterminate = false;
                    Progress    = e.ProgressPercentage;
                    Description = (string)e.UserState;
                };
            }
        }
コード例 #2
0
ファイル: ProgressDialog.xaml.cs プロジェクト: radtek/INCC6
        /// <summary>
        /// Displays a progress dialog for the specified task. The dialog allows the user to cancel
        /// the task and displays the task's progress.
        /// </summary>
        /// <param name="owner">The owner window.</param>
        /// <param name="title">The title of the task progress dialog.</param>
        /// <param name="description">The description of the task.</param>
        /// <param name="task">The task.</param>
        /// <param name="cancelStopAbortTokensSource">The cancellation token source that cancels the task.</param>
        /// <param name="progressTracker">The progress tracker that tracks the task's progress.</param>
        /// <exception cref="ArgumentNullException"><paramref name="description"/> or <paramref name="task"/> is <c>null</c>.</exception>
        public static void Show(Window owner, string title, string description, Task task, CancelStopAbort cancelStopAbortTokensSource, ProgressTracker progressTracker, bool isAssay)
        {
            ProgressDialog dialog = new ProgressDialog(task);

            //Disable close button, as it doesn't work.  HN 6.15.2015
            //dialog.WindowStyle = WindowStyle.None;
            dialog.Topmost     = true;
            dialog.DataContext = new TaskProgress(title, description, task, cancelStopAbortTokensSource, progressTracker, isAssay);
            dialog.Owner       = owner;
            if (!isAssay)
            {
            }
            if (progressTracker.m_modal)
            {
                //dialog.Go();
                dialog.ShowDialog();
            }
            else
            {
                //dialog.Go();
                dialog.Show();
            }
        }
コード例 #3
0
ファイル: ProgressDialog.xaml.cs プロジェクト: radtek/INCC6
 /// <summary>
 /// Displays a progress dialog for the specified task. The dialog allows the user to cancel
 /// the task and displays the task's progress.
 /// </summary>
 /// <param name="owner">The owner window.</param>
 /// <param name="title">The title of the task progress dialog.</param>
 /// <param name="description">The description of the task.</param>
 /// <param name="task">The task.</param>
 /// <param name="cancelStopAbortTokensSource">The cancellation token source that cancels the task.</param>
 /// <param name="progressTracker">The progress tracker that tracks the task's progress.</param>
 /// <exception cref="ArgumentNullException"><paramref name="description"/> or <paramref name="task"/> is <c>null</c>.</exception>
 public static void Show(Window owner, string title, string description, Task task, CancelStopAbort cancellationTokenSource)
 {
     Show(owner, title, description, task, cancellationTokenSource, null, false);
 }