Пример #1
0
        void BackgroundProcess()
        {
            if (syncCtrl.InvokeRequired)
            {
                syncCtrl.Invoke(new FinishedProcessingDelegate(FinishedProcessing));
            }

            else
            {
                FinishedProcessing();
            }
        }
 public static System.Windows.Forms.DialogResult SafeShowMessageBox(System.Windows.Forms.UserControl form, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon)
 {
     if (form.InvokeRequired)
     {
         //important to show the notification on the main thread of BIDS
         return((System.Windows.Forms.DialogResult)form.Invoke(
                    new DialogResultDelegate2(SafeShowMessageBox), new object[] { form, text, caption, buttons, icon }
                    ));
     }
     else
     {
         System.Windows.Forms.IWin32Window owner = (System.Windows.Forms.IWin32Window)form;
         return(System.Windows.Forms.MessageBox.Show(owner, text, caption, buttons, icon));
     }
 }