当前位置: 首页>>代码示例>>C#>>正文


C# RunWorkerCompletedEventHandler类代码示例

本文整理汇总了C#中RunWorkerCompletedEventHandler的典型用法代码示例。如果您正苦于以下问题:C# RunWorkerCompletedEventHandler类的具体用法?C# RunWorkerCompletedEventHandler怎么用?C# RunWorkerCompletedEventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RunWorkerCompletedEventHandler类属于命名空间,在下文中一共展示了RunWorkerCompletedEventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: pgWorker

 public pgWorker(int pos, string dsn, 
     ProgressChangedEventHandler onProgress,
     RunWorkerCompletedEventHandler onComplete)
 {
     this.thNo = pos;
     this.pg_conn = new NpgsqlConnection(dsn);
     try
     {
         pg_conn.Open();
         pg_error = "";
     }
     catch (Exception ex)
     {
         pg_conn = null;
         pg_error = ex.Message;
     }
     if (pg_conn != null)
     {
         this.bw = new BackgroundWorker();
         this.bw.WorkerReportsProgress = true;
         this.bw.WorkerSupportsCancellation = true;
         this.bw.DoWork += this.bwDoWork;
         this.bw.ProgressChanged += onProgress;
         this.bw.RunWorkerCompleted += onComplete;
     }
 }
开发者ID:vialorn,项目名称:CloudHLoad,代码行数:26,代码来源:pgWorker.cs

示例2: BackgroundCall

 private void BackgroundCall( string service, RunWorkerCompletedEventHandler callback, Func<string,NameValueCollection,HappyIndex> serviceCall, NameValueCollection parameters = null )
 {
     BackgroundWorker w = new BackgroundWorker();
     w.RunWorkerCompleted += callback;
     w.DoWork += WOnDoWork;
     w.RunWorkerAsync(new BackgroundArgs{ Service = service, Parameters = parameters, ServiceCall = serviceCall });
 }
开发者ID:EsleEnoemos,项目名称:HappyIndex2,代码行数:7,代码来源:Form1.cs

示例3: GetBackgroundWorker

        private BackgroundWorker GetBackgroundWorker(DoWorkQueuedEventHandler doWork, RunWorkerCompletedEventHandler workerCompleted)
        {
            BackgroundWorker bw = new BackgroundWorker();
            bw.WorkerReportsProgress = false;
            bw.WorkerSupportsCancellation = false;

            bw.DoWork += (sender, args) =>
                             {
                                 if (doWork != null)
                                 {
                                     args.Result=doWork(this, new DoWorkEventArgs(args.Argument));
                                 }
                             };

            bw.RunWorkerCompleted += (sender, args) =>
                                         {
                                             if (workerCompleted != null)
                                             {
                                                 object result = args.Error == null ? args.Result : null;
                                                 workerCompleted(this,
                                                                 new RunWorkerCompletedEventArgs(result, args.Error,
                                                                                                 args.Cancelled));
                                             }
                                             Queue.Dequeue();
                                             lock (_lock)
                                             {
                                                 if (Queue.Count > 0)
                                                 {
                                                     ((BackgroundWorker)this.Queue.Peek()).RunWorkerAsync();
                                                 }
                                             }
                                         };
            return bw;
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:34,代码来源:QueuedBackgroundWorker.cs

示例4: PageManager

        /// <summary>
        /// Creates and dispatches a PageManager to load a search page,
        /// parse, extract, validate and return results using the 
        /// parameter callback EventHandlers
        /// </summary>
        /// <param name="pageNumber">Which search page number to load</param>
        /// <param name="criteria">The user's search criteria</param>
        /// <param name="pageLoadMethod">Supply the method to retrieve html</param>
        /// <param name="updateProgressMethod">Callback for progress updates</param>
        /// <param name="workerCompleteMethod">Callback when work complete</param>
        public PageManager(int pageNumber,
            SearchCriteria criteria,
            Func<int, string, string> pageLoadMethod, // see explanation above
            ProgressChangedEventHandler updateProgressMethod,
            RunWorkerCompletedEventHandler workerCompleteMethod)
        {
            if (pageNumber < 1)
            {
                string msg = "Supplied page number ({0}) was < 0!";
                msg = string.Format(msg,pageNumber);
                throw new ArgumentOutOfRangeException(msg);
            }

            if (pageLoadMethod == null)
            {
                string msg = "Provided a null method to obtain page HTML!";
                throw new InvalidOperationException(msg);
            }

            ProgressChanged += updateProgressMethod; // Callback
            RunWorkerCompleted += workerCompleteMethod;  // Callback
            DoWork += Work;

            _pageLoadMethod = pageLoadMethod;
            _searchCriteria = criteria;
            _pageNumber = pageNumber;

            WorkerReportsProgress = true;
            WorkerSupportsCancellation = true;
        }
开发者ID:ThomasRush,项目名称:AmazonScrape,代码行数:40,代码来源:PageManager.cs

示例5: BackgroundConnectionHelper

 public BackgroundConnectionHelper(DoWorkEventHandler AsyncDelegate, RunWorkerCompletedEventHandler GUIDelegate)
 {
     backgroundWorker = new BackgroundWorker();
     backgroundWorker.DoWork += AsyncDelegate;
     backgroundWorker.RunWorkerCompleted += GUIDelegate;
     backgroundWorker.WorkerSupportsCancellation = true;
 }
开发者ID:pixellos,项目名称:TCPConnector,代码行数:7,代码来源:BackgroundConnectionHelper.cs

示例6: Remove

 public static void Remove(string path, RunWorkerCompletedEventHandler runworkerDone)
 {
     var bw = new BackgroundWorker { WorkerReportsProgress = false, WorkerSupportsCancellation = false };
     bw.DoWork += RemoveFileFromIndex;
     bw.RunWorkerCompleted += runworkerDone;
     bw.RunWorkerAsync(path);
 }
开发者ID:spati2,项目名称:FSE-2012-SANDO,代码行数:7,代码来源:FileRemover.cs

示例7: AsyncWorker

 /// <summary>
 /// Initializes a new instance of the <see cref="AsyncWorker"/> class.
 /// </summary>
 /// <param name="name">The name used in log messages.</param>
 /// <param name="worker">The worker delegate.</param>
 /// <param name="completed">The completed delegate.</param>
 public AsyncWorker(
     string name,
     DoWorkEventHandler worker,
     RunWorkerCompletedEventHandler completed)
     : this(name, worker, null, completed)
 {
 }
开发者ID:hmuralt,项目名称:appccelerate,代码行数:13,代码来源:AsyncWorker.cs

示例8: AsyncCommandBinding

        public AsyncCommandBinding(ICommand command, ExecutedRoutedEventHandler executed, CanExecuteRoutedEventHandler canExecute, RunWorkerCompletedEventHandler runWokrerCompleted)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }

            _task = new BackgroundWorker();
            _task.DoWork += delegate
                                {
                                    executed(null, null);
                                };
            _task.RunWorkerCompleted += (s, e) =>
                                            {
                                                runWokrerCompleted(s, e);
                                                _task.Dispose();
                                            };

            Command = command;
            if (executed != null)
            {
                Executed += delegate
                                {
                                    if (!_task.IsBusy)
                                        _task.RunWorkerAsync();
                                };
            }
            if (canExecute != null)
            {
                CanExecute += canExecute;
            }
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:32,代码来源:AsyncCommandBinding.cs

示例9: WorkerHelper

 /// <summary>
 /// Constructor that accepts Event handlers for executing async thread
 /// </summary>
 /// <param name="WorkerProcess">Worker Process Handler</param>
 /// <param name="WorkProgressHandler">Progress Changed Event Handler</param>
 /// <param name="WorkCompletedHandler">Call back method handler which is invoked once the Worker Process is completed</param>
 public WorkerHelper(DoWorkEventHandler WorkerProcess, ProgressChangedEventHandler WorkProgressHandler, RunWorkerCompletedEventHandler WorkCompletedHandler)
 {
     this.DoWork += WorkerProcess;
     this.ProgressChanged += WorkProgressHandler;
     this.RunWorkerCompleted += WorkCompletedHandler;
     this.WorkerReportsProgress = true;
 }
开发者ID:itisashokkumar,项目名称:3M,代码行数:13,代码来源:WorkerHelper.cs

示例10: FormInfo

 public FormInfo(Form owner,
                 string Message,
                 DoWorkEventHandler DoWork,
                 RunWorkerCompletedEventHandler RunWorkerCompleted)
 {
     doInitialize(owner, Message, DoWork, RunWorkerCompleted, null);
 }
开发者ID:rhenium,项目名称:OpenTween,代码行数:7,代码来源:FormInfo.cs

示例11: Connect

 //
 public void Connect()
 {
     if (!_worker.IsBusy)
     {
         this._RunWorkerCompletedEventHandler = _imageGrabber.ConnectCompletedHandler;
         _worker.RunWorkerAsync(_imageGrabber.ConnectHandler);
     }
 }
开发者ID:Joncash,项目名称:HanboAOMClassLibrary,代码行数:9,代码来源:SmartWorkingMan.cs

示例12: methodAsync

        public static void methodAsync(int i, RunWorkerCompletedEventHandler onComplete)
        {
            BackgroundWorker bw = new BackgroundWorker();
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += onComplete;

            bw.RunWorkerAsync(i);
        }
开发者ID:pJqEM5Kj,项目名称:stuff,代码行数:8,代码来源:Program.cs

示例13: InitNewBackgroundWorker

 public static BackgroundWorker InitNewBackgroundWorker(DoWorkEventHandler doWorkEvent, ProgressChangedEventHandler progressChangedEvent, RunWorkerCompletedEventHandler runWorkerCompletedEvent)
 {
     var bw = new BackgroundWorker();
     bw.RegisterDoWork(doWorkEvent);
     bw.RegisterProgressChanged(progressChangedEvent);
     bw.RegisterRunWorkerCompleted(runWorkerCompletedEvent);
     return bw;
 }
开发者ID:ZhouLinWorkGroup20140106,项目名称:BackgroundWorkerTest,代码行数:8,代码来源:BackgroundWorkerExtension.cs

示例14: RunBackground

 private void RunBackground(DoWorkEventHandler doWork, object argument, RunWorkerCompletedEventHandler runWorkerCompleted)
 {
     using (BackgroundWorker backgroundWorker = new BackgroundWorker())
     {
         backgroundWorker.DoWork += doWork;
         backgroundWorker.RunWorkerCompleted += runWorkerCompleted;
         backgroundWorker.RunWorkerAsync(argument);
     }
 }
开发者ID:kevins1022,项目名称:Altman,代码行数:9,代码来源:FileManager.cs

示例15: SetUp

 private void SetUp(string statusText, RunWorkerCompletedEventHandler workerCompletedTask)
 {
     cdDialogPanel.Enabled = false;
     cdConnectButton.Enabled = false;
     cdTestButton.Enabled = false;
     cdConnectStatusLabel.Text = statusText;
     backgroundWorker.RunWorkerCompleted += workerCompletedTask;
     backgroundWorker.RunWorkerAsync(ConnectionDetail);
 }
开发者ID:EsperanzaHargis,项目名称:OracleDatabaseView,代码行数:9,代码来源:ConnectDialog.cs


注:本文中的RunWorkerCompletedEventHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。