Ejemplo n.º 1
0
        private void OnKill(object sender, EventArgs e)
        {
            AsyncExecuteCommandProcess process = (AsyncExecuteCommandProcess)sender;

            this.CancelAllTasks();
            this.CleanUp(process);
        }
Ejemplo n.º 2
0
 private void CleanUp(AsyncExecuteCommandProcess process)
 {
     if (process != null)
     {
         process.Killed   -= new EventHandler(this.OnKill);
         process.Complete -= new EventHandler(this.OnComplete);
         process.Progress -= new EventHandler(this.OnProgress);
     }
     this.asyncProgressDialog = (AsyncProcessDialog)null;
 }
Ejemplo n.º 3
0
        private void CancelJob(AsyncProcess process, object hint)
        {
            string str = hint as string;
            AsyncExecuteCommandProcess executeCommandProcess = process as AsyncExecuteCommandProcess;

            if (executeCommandProcess == null || executeCommandProcess.Cancel || !(executeCommandProcess.Name == str) && str != null)
            {
                return;
            }
            executeCommandProcess.Cancel = true;
            executeCommandProcess.Kill();
        }
Ejemplo n.º 4
0
        public void StartAsyncProcess(IExpressionInformationService expressionInformationService, Action <object, DoWorkEventArgs> workerDelegate, EventHandler onBegun, EventHandler onComplete, EventHandler onProgress, EventHandler onKill)
        {
            AsyncExecuteCommandProcess executeCommandProcess = new AsyncExecuteCommandProcess(string.Empty, workerDelegate);

            executeCommandProcess.Begun    += onBegun;
            executeCommandProcess.Killed   += onKill;
            executeCommandProcess.Complete += onComplete;
            executeCommandProcess.Progress += onProgress;
            executeCommandProcess.Progress += new EventHandler(this.OnProgress);
            executeCommandProcess.Killed   += new EventHandler(this.OnKill);
            executeCommandProcess.Complete += new EventHandler(this.OnComplete);
            this.processingQueue.Add((AsyncProcess)executeCommandProcess, false);
            if (this.asyncProgressDialog != null)
            {
                return;
            }
            this.asyncProgressDialog = new AsyncProcessDialog((AsyncProcess)this.processingQueue, expressionInformationService, 0.0);
            this.ShowProgressDialog(true);
            this.CleanUp((AsyncExecuteCommandProcess)null);
            this.asyncProgressDialog = (AsyncProcessDialog)null;
        }