Updating UI with BackgroundWorker in WPF

后端 未结 3 552
生来不讨喜
生来不讨喜 2020-12-19 02:23

I am currently writing a simple WPF 3.5 application that utilizes the SharePoint COM to make calls to SharePoint sites and generate Group and User information. Since this pr

3条回答
  •  执念已碎
    2020-12-19 02:55

    You'll need:

    mWorker.WorkerReportsProgress = true;
    mWorker.ProgressChanged += 
        new ProgressChangedEventHandler(worker_ProgressChanged);
    

    Then in your DoWork you'll need to call:

    var worker = (BackgroundWorker)sender;
    worker.ReportProgress(progressAmount);
    

    Good worked example here: http://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx

提交回复
热议问题