• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RunWorkerCompletedEventHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: sendEmail

        public void sendEmail(string new_title, string new_body, RunWorkerCompletedEventHandler target) {
            BackgroundWorker worker = new BackgroundWorker();
            worker.DoWork += new System.ComponentModel.DoWorkEventHandler(sendEmail);
            worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(target);
            body = new_body;
            title = new_title;
            worker.RunWorkerAsync();

        }
开发者ID:sanmadjack,项目名称:Email.CSharp,代码行数:9,代码来源:EmailHandler.cs


示例17: sendEmail

 public void sendEmail(string new_from, string new_to, string new_reply_to, string new_title,string new_body, RunWorkerCompletedEventHandler target)
 {
     this.DoWork += new System.ComponentModel.DoWorkEventHandler(sendEmail);
     RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(target);
     from = new_from;
     to = new_to;
     reply_to = new_reply_to;
     body = new_body;
     title = new_title;
     this.RunWorkerAsync();
 }
开发者ID:elkine,项目名称:MASGAU,代码行数:11,代码来源:EmailHandler.cs


示例18: PackingProcess

 public PackingProcess(ProgressChangedEventHandler handler, RunWorkerCompletedEventHandler completedHandler)
 {
     this.DoWork += PackingProcess_DoWork;
     this.RunWorkerCompleted += PackingProcess_RunWorkerCompleted;
     this.RunWorkerCompleted += completedHandler;
     this.WorkerReportsProgress = true;
     this.WorkerSupportsCancellation = true;
     this.ProgressChanged += handler;
     IsRunning = false;
     IsError = false;
 }
开发者ID:SSX1,项目名称:Space-Station-X1,代码行数:11,代码来源:PackingProcess.cs


示例19: GetCardRulings

        public static void GetCardRulings(Filter filter, RunWorkerCompletedEventHandler completedDelegate)
        {
            Console.WriteLine("Call to GetCardInfo");

            if(bgWorker == null || !bgWorker.IsBusy)
            {
                bgWorker = new BackgroundWorker();
                bgWorker.DoWork += AsyncFindMatches;
                bgWorker.RunWorkerCompleted += completedDelegate;
                bgWorker.RunWorkerAsync(filter);
            }
        }
开发者ID:greg-mitchell,项目名称:Folio,代码行数:12,代码来源:Rulings.cs


示例20: GetImageUrl

 public static void GetImageUrl(Filter filter, RunWorkerCompletedEventHandler callback)
 {
     Console.WriteLine("Call to GetImageUrl");
     if (bgWorker == null || !bgWorker.IsBusy)
     {
         bgWorker = new BackgroundWorker();
         bgWorker.DoWork += new DoWorkEventHandler(AsyncGrabImage);
         bgWorker.WorkerSupportsCancellation = true;
         bgWorker.RunWorkerCompleted += callback;
         bgWorker.RunWorkerAsync(filter);
     }
 }
开发者ID:greg-mitchell,项目名称:Folio,代码行数:12,代码来源:ImageGrabber.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Runnable类代码示例发布时间:2022-05-24
下一篇:
C# RunState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap