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); }
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; }