Пример #1
0
        protected virtual void OnCompleted(WorkItemCompletedEventArgs Args)
        {
            //raise the Completed event in the context of the form
            EventHandler <WorkItemCompletedEventArgs> temp = Completed;

            if (temp != null)
            {
                temp.Invoke(this, Args);
            }
        }
Пример #2
0
        //handler method to run when work has completed
        private void WorkThread_Completed(object sender, WorkItemCompletedEventArgs e)
        {
            lvMain.Items[int.Parse(e.Result.ItemID)].SubItems[1].Text = e.Result.ResultCode;
            if (e.Result.ResultCode == "ERR")
            {
                lvMain.Items[int.Parse(e.Result.ItemID)].SubItems[2].Text = e.Result.Message;
            }

            RunningThreadCount--;
            UpdateThreadCount();

            if (RunningThreadCount == 0)
            {
                CleanUp();
            }
        }