Esempio n. 1
0
        /// <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;
                };
            }
        }
Esempio n. 2
0
 public OperationalState()
 {
     csa         = new CancelStopAbort();
     SOH         = OperatingState.Void;
     statusTimer = new Timer[2];
 }
Esempio n. 3
0
 public OperationalState(OperationalState src)
 {
     csa = src.csa;
     SOH = src.SOH;
     statusTimer = src.statusTimer;
     meas = src.meas;
     start = src.start;
     stop = src.stop;
 }
Esempio n. 4
0
        protected Timer statusTimer; // ok, I let you have two at the same time

        #endregion Fields

        #region Constructors

        public OperationalState()
        {
            csa = new CancelStopAbort();
            SOH = OperatingState.Void;
        }
Esempio n. 5
0
 public OperationalState()
 {
     csa = new CancelStopAbort();
     SOH = OperatingState.Void;
 }
Esempio n. 6
0
        /// <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.ShowDialog();
            else
                dialog.Show();
        }
Esempio n. 7
0
 /// <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);
 }
Esempio n. 8
0
 public OperationalState()
 {
     csa = new CancelStopAbort();
     SOH = OperatingState.Void;
     statusTimer = new Timer[2];
 }