Ejemplo n.º 1
0
        private void OnProcessingComplete(ProcessingResult result)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.lblProgress.InvokeRequired)
            {
                SetLblProgressCallback d = new SetLblProgressCallback(OnProcessingComplete);
                this.Invoke(d, new object[] { result });
            }
            else
            {
                lblProgress.Text = string.Format("Processing complete on {0} of {1} files. {2} files failed.",
                                                 result.numComplete.ToString(),
                                                 result.numTotal.ToString(),
                                                 result.numFailed.ToString());

                if (result.lastError != null)
                {
                    MessageBox.Show(String.Format("One or more files failed.\nLast exception: {0}\n{1}", result.lastError.Message, result.lastError.StackTrace),
                                    "File processing error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                this.btnProcess.Text = "Process Files";
                SetControlsEnable(true);
                MP.ClearFiles();
                SetFileCount();
            }
        }
Ejemplo n.º 2
0
 private void OnProcessingComplete(int numFailed)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.lblProgress.InvokeRequired)
     {
         SetLblProgressCallback d = new SetLblProgressCallback(OnProcessingComplete);
         this.Invoke(d, new object[] { numFailed });
     }
     else
     {
         lblProgress.Text = string.Format("Processing complete on {0} files. {1} files failed.",
                                          this.fileList.Count.ToString(),
                                          numFailed.ToString());
         this.isProcessing    = false;
         this.btnProcess.Text = "Process Files";
         SetCurrentProgress(100, "");
         SetControlsEnable(true);
     }
 }