Exemplo 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;
                };
            }
        }
Exemplo n.º 2
0
 public bool SpecialPrepAction()
 {
     okxferprep = false;
     mProgressTracker = new ProgressTracker(true);
     bool canceled = false;
     DoWorkEventArgs ea = new DoWorkEventArgs(canceled);
     task = Task.Factory.StartNew(() => SpecialPrepThreadOp(null, ea), NC.App.Opstate.CancelStopAbort.LinkedCancelStopAbortToken);
     string titletext = "Transfer File Processing";
     Progress.ProgressDialog.Show(null,  titletext, NC.App.Name, task, NC.App.Opstate.CancelStopAbort, mProgressTracker, isAssay:false);
     bool go = true;
     while (!(task.IsCompleted || task.IsCanceled || task.IsFaulted))
     {
         go = task.Wait(500); // this is a totally lame way to force the ui to continue, I need the WPF logging to appear responsive
     }
     if (ea.Result is bool)
         okxferprep = (bool)ea.Result;  // state of process; no files is ok, but cancel button state needs to be caught here
     else
     {
         okxferprep = true; // there *is* a file list, it might be empty
         TransferList tldr = new TransferList((List<NCCTransfer.INCCKnew.TransferSummary>)ea.Result);
         tldr.ShowDialog();  // show user her choice
         if (tldr.DialogResult == System.Windows.Forms.DialogResult.OK)
             ApplyTransferSelections(tldr.list);  // apply her choice to the final list for processing
         else
             okxferprep = false;  // nothing to do so make state canceled
     }
     return okxferprep;
 }
Exemplo n.º 3
0
 // controller has active control of processing through these three entry points
 public new void StartAction()
 {
     mProgressTracker = new ProgressTracker();
     task = Task.Factory.StartNew(() => ThreadOp(null, null), NC.App.Opstate.CancelStopAbort.LinkedCancelStopAbortToken);
     string titletext = (NC.App.AppContext.DBDataAssay ? "Database " : "File ") + (NC.App.Opstate.Action == NCCAction.Assay ? "Analysis" : "Processing");
     Progress.ProgressDialog.Show(null,  titletext, NC.App.Name, task, NC.App.Opstate.CancelStopAbort, mProgressTracker, NC.App.Opstate.Action == NCCAction.Assay);
 }
Exemplo n.º 4
0
 public FCtrlBind()
     : base(true)
 {
     mProgressTracker = new ProgressTracker();
 }
Exemplo n.º 5
0
 public new void StartAction()
 {
     mProgressTracker = new ProgressTracker();
     task = Task.Factory.StartNew(() => ThreadOp(null, null), NC.App.Opstate.CancelStopAbort.LinkedCancelStopAbortToken);
     Progress.ProgressDialog.Show(null, "DAQ " + NC.App.Opstate.Action.ToString(), NC.App.Name, task, NC.App.Opstate.CancelStopAbort, mProgressTracker, NC.App.Opstate.Action == NCCAction.Assay);
 }
Exemplo n.º 6
0
 public DAQBind()
     : base(true)
 {
     mProgressTracker = new ProgressTracker();
 }
Exemplo n.º 7
0
 public DAQBind(MLMEmulation.IEmulatorDiversion emu)
     : base(emu, true)
 {            
     mProgressTracker = new ProgressTracker();
 }
Exemplo n.º 8
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();
        }