예제 #1
0
        internal void AbortDeletion()
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            this.deletionWorker.Dispose(); this.deletionWorker = null;

            if (this.OnAborted != null)
            {
                this.OnAborted(this, new EventArgs());
            }
        }
예제 #2
0
        public void StartDeleteProcess()
        {
            this.CurrentProcessStep = WorkflowSteps.DeleteProcessRunning;

            this.deletionWorker      = new DeletionWorker();
            this.deletionWorker.Data = this.Data;

            this.deletionWorker.ProgressChanged    += new ProgressChangedEventHandler(deletionWorker_ProgressChanged);
            this.deletionWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(deletionWorker_RunWorkerCompleted);

            this.deletionWorker.RunWorkerAsync();
        }
예제 #3
0
        void deletionWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            if (e.Error != null)
            {
                this.showErrorMsg(e.Error.Message);

                this.deletionWorker.Dispose(); this.deletionWorker = null;
            }
            else if (e.Cancelled)
            {
                if (this.deletionWorker.ErrorInfo != null)
                {
                    // A error occurred, process was stopped
                    //
                    // -> Ask user to continue

                    if (OnDeleteError != null)
                    {
                        OnDeleteError(this, this.deletionWorker.ErrorInfo);
                    }
                    else
                    {
                        throw new Exception("Internal error: event handler is missing.");
                    }
                }
                else
                {
                    // The user cancelled the process
                    if (this.OnCancelled != null)
                    {
                        this.OnCancelled(this, new EventArgs());
                    }
                }
            }
            else
            {
                // TODO: Use separate class here?
                int deletedCount   = this.deletionWorker.DeletedCount;
                int failedCount    = this.deletionWorker.FailedCount;
                int protectedCount = this.deletionWorker.ProtectedCount;

                this.deletionWorker.Dispose(); this.deletionWorker = null;

                if (this.OnDeleteProcessFinished != null)
                {
                    this.OnDeleteProcessFinished(this, new DeleteProcessFinishedEventArgs(deletedCount, failedCount, protectedCount));
                }
            }
        }
예제 #4
0
        internal void AbortDeletion()
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            this.deletionWorker.Dispose(); this.deletionWorker = null;

            if (this.OnAborted != null)
                this.OnAborted(this, new EventArgs());
        }
예제 #5
0
        void deletionWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            if (e.Error != null)
            {
                this.showErrorMsg(e.Error.Message);

                this.deletionWorker.Dispose(); this.deletionWorker = null;
            }
            else if (e.Cancelled)
            {
                if (this.deletionWorker.ErrorInfo != null)
                {
                    // A error occurred, process was stopped
                    //
                    // -> Ask user to continue

                    if (OnDeleteError != null)
                        OnDeleteError(this, this.deletionWorker.ErrorInfo);
                    else
                        throw new Exception("Internal error: event handler is missing.");
                }
                else
                {
                    // The user cancelled the process
                    if (this.OnCancelled != null)
                        this.OnCancelled(this, new EventArgs());
                }
            }
            else
            {
                // TODO: Use separate class here?
                int deletedCount = this.deletionWorker.DeletedCount;
                int failedCount = this.deletionWorker.FailedCount;
                int protectedCount = this.deletionWorker.ProtectedCount;

                this.deletionWorker.Dispose(); this.deletionWorker = null;

                if (this.OnDeleteProcessFinished != null)
                    this.OnDeleteProcessFinished(this, new DeleteProcessFinishedEventArgs(deletedCount, failedCount, protectedCount));
            }
        }
예제 #6
0
        public void StartDeleteProcess()
        {
            this.CurrentProcessStep = WorkflowSteps.DeleteProcessRunning;

            this.deletionWorker = new DeletionWorker();
            this.deletionWorker.Data = this.Data;

            this.deletionWorker.ProgressChanged += new ProgressChangedEventHandler(deletionWorker_ProgressChanged);
            this.deletionWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(deletionWorker_RunWorkerCompleted);

            this.deletionWorker.RunWorkerAsync();
        }