Example #1
0
        private void LoadControllers()
        {
            if (_backgroundWorker != null)
            {
                return;
            }

            // Setup background worker, worker context, and work item
            _backgroundWorker = new BackgroundWorker();
            _backgroundWorker.WorkerReportsProgress      = true;
            _backgroundWorker.WorkerSupportsCancellation = true;

            _backgroundWorker.DoWork             += new DoWorkEventHandler(DoBackgroundWork);
            _backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnWorkCompleted);
            _backgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(OnProgress);

            _workerContext = new BGWThreadContext(_backgroundWorker);
            _workItem      = LoadWorkItem(_workerContext);
        }
Example #2
0
 /// <summary> Construct new work item here</summary>
 protected virtual IRunable LoadWorkItem(BGWThreadContext ctxt)
 {
     Debug.Assert(false);
     return(null);
 }