示例#1
0
 private DialogResult ShowDialog(WaitCursor waitCursor, ShowDialogCallback callback)
 {
     DialogResult result;
     IWin32Window owner = null;
     if (this._platform == null)
     {
         throw new InvalidOperationException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ExceptionInternalConsoleDialogHostOwnerNotInitialized));
     }
     try
     {
         BeginModalLoopConsoleDialogCommand command = new BeginModalLoopConsoleDialogCommand();
         command.OwnerId = this._ownerId;
         BeginModalLoopConsoleDialogCommandResult result2 = (BeginModalLoopConsoleDialogCommandResult) this._platform.ProcessCommand(command);
         owner = result2.Window;
         if ((waitCursor != null) && waitCursor.Run())
         {
             return waitCursor.DialogResult;
         }
         result = callback(owner);
     }
     finally
     {
         EndModalLoopConsoleDialogCommand command2 = new EndModalLoopConsoleDialogCommand();
         command2.OwnerId = this._ownerId;
         this._platform.ProcessCommand(command2);
     }
     return result;
 }
示例#2
0
        protected DialogResult ShowDialog(CommonDialog dialog)
        {
            if (InvokeRequired)
            {
                ShowDialogCallback d = ShowDialog;
                return((DialogResult)Invoke(d, new Object[] { dialog }));
            }

            return(dialog.ShowDialog(this));
        }
示例#3
0
 public void ShowDialogThreadSafe(Form parent)
 {
     if (this.InvokeRequired)
     {
         ShowDialogCallback d = new ShowDialogCallback(ShowDialogThreadSafe);
         this.Invoke(d);
     }
     else
     {
         this.ShowDialog(parent);
     }
 }