コード例 #1
0
ファイル: ProgressOperator.cs プロジェクト: eagles/demo
 public ProgressOperator()
 {
     this._backgroundWorker = new BackgroundWorker();
     this._processForm = new ProgressForm();
     this._eventArgs = new BackgroundWorkerEventArgs();
     this._backgroundWorker.DoWork += new DoWorkEventHandler(this.backgroundWorker_DoWork);
     this._backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker_RunWorkerCompleted);
 }
コード例 #2
0
        private ProgressForm _processForm; //进度条窗体

        #endregion Fields

        #region Constructors

        public PercentProgressOperator()
        {
            this._processForm = new ProgressForm();
            this._eventArgs = new BackgroundWorkerEventArgs();
            this._processForm.ProcessStyle = System.Windows.Forms.ProgressBarStyle.Continuous;
            this._backgroundWorker = new BackgroundWorker();
            this._backgroundWorker.WorkerReportsProgress = true;
            this._backgroundWorker.DoWork += new DoWorkEventHandler(this._backgroundWorker_DoWork);
            this._backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this._backgroundWorker_RunWorkerCompleted);
            this._backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(this._backgroundWorker_ProgressChanged);
        }
コード例 #3
0
ファイル: ProgressBarDemo.cs プロジェクト: eagles/demo
 void process_BackgroundWorkerCompleted(object sender, BackgroundWorkerEventArgs e)
 {
     if (e.BackGroundException == null)
     {
         MessageBox.Show("执行完毕");
     }
     else
     {
         MessageBox.Show("异常:" + e.BackGroundException.Message);
     }
 }