Esempio n. 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;
 }
Esempio n. 2
0
 public DialogResult ShowDialog(Form form, WaitCursor waitCursor)
 {
     return this._dialogHost.ShowDialog(form, waitCursor);
 }
        /// <summary>
        /// Handle triggered action
        /// </summary>
        /// <param name="action">triggered action</param>
        /// <param name="status">synchronous status to update console</param>
        protected override void OnSyncAction(SyncAction action, SyncStatus status)
        {
            switch ((string)action.Tag)
            {
                case "ConnectTo":
                    {
                        ConnectDialog connectDialog = new ConnectDialog();
                        connectDialog.ConnectToServerName.Text = String.Empty;

                        if (this.SnapIn.Console.ShowDialog(connectDialog) == DialogResult.OK)
                        {
                            this.DisplayName = "Connected (" + connectDialog.ConnectToServerName.Text + ")";
                        }
                        break;
                    }
                case "CommonDialog":
                    {
                        ColorDialog colorDialog = new ColorDialog();
                        colorDialog.AllowFullOpen = false;

                        if (this.SnapIn.Console.ShowDialog(colorDialog) == DialogResult.OK)
                        {
                            this.DisplayName = "CommonDialog - Selected a Color";
                        }
                        break;
                    }
                case "MessageBox":
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters();

                        messageBoxParameters.Caption = "Sample MessageBox...";
                        messageBoxParameters.Buttons = MessageBoxButtons.OKCancel;
                        messageBoxParameters.Text = "Select Ok or Cancel";

                        if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.OK)
                        {
                            this.DisplayName = "MessageBox - Selected Ok";
                        }
                        break;
                    }
                case "UserDefinedForm":
                    {
                        UserDefinedForm userDefinedForm = new UserDefinedForm();

                        if (this.SnapIn.Console.ShowDialog(userDefinedForm) == DialogResult.OK)
                        {
                            this.DisplayName = "User Defined Form - Ok";
                        }
                        break;
                    }
                case "UserDefinedFormWithWaitCursor":
                    {
                        WaitCursor waitCursor = new WaitCursor();
                        waitCursor.Timeout = new System.TimeSpan(0,0,5);

                        UserDefinedFormForWaiting userDefinedFormForWaiting = new UserDefinedFormForWaiting();

                        if (this.SnapIn.Console.ShowDialog(userDefinedFormForWaiting, waitCursor) == DialogResult.OK)
                        {
                            this.DisplayName = "User Defined Form with Wait Cursor - Ok";
                        }
                        break;
                    }
            }
        }
Esempio n. 4
0
 public DialogResult ShowDialog(Form form, WaitCursor waitCursor)
 {
     this.InitializeConsoleDialogHost();
     return this._dialogHost.ShowDialog(form, waitCursor);
 }
Esempio n. 5
0
 public DialogResult ShowDialog(Form form, WaitCursor waitCursor)
 {
     if (form == null)
     {
         throw new ArgumentNullException("form");
     }
     return this.ShowDialog(waitCursor, new ShowDialogCallback(form.ShowDialog));
 }