Share via


IManagementUIService.ShowDialog(DialogForm) Method

Definition

Shows the form as a modal dialog box that has the specified owner.

public:
 System::Windows::Forms::DialogResult ShowDialog(Microsoft::Web::Management::Client::Win32::DialogForm ^ form);
public System.Windows.Forms.DialogResult ShowDialog (Microsoft.Web.Management.Client.Win32.DialogForm form);
abstract member ShowDialog : Microsoft.Web.Management.Client.Win32.DialogForm -> System.Windows.Forms.DialogResult
Public Function ShowDialog (form As DialogForm) As DialogResult

Parameters

form
DialogForm

An object that implements the IWin32Window interface that represents the top-level window that will own the modal dialog box.

Returns

One of the DialogResult values.

Examples

The following example implements this method.

DialogResult IManagementUIService.ShowDialog(DialogForm form) {
    DialogResult result = DialogResult.Cancel;
    IWin32Window parent = DialogOwner;

    Control parentCtl = parent as Control;
    if ((parentCtl != null) && parentCtl.InvokeRequired) {
        Debug.Fail("Showing a new dialog from a different thread!");
        // If the call is being made from another thread 
        // invoke it in the parent thread
        result = (DialogResult)parentCtl.Invoke(
            new ShowDialogDelegate(ShowDlgPrntThrd), form, parent);
    } else {
        result = ShowDlgPrntThrd(form, parent);
    }

    return result;
}

DialogResult ShowDlgPrntThrd(Form form, IWin32Window parent) {
    DialogResult result = DialogResult.Cancel;
    _curWin.Push(form);
    try {
        result = form.ShowDialog(parent);
    } finally {
        _curWin.Pop();
    }
    return result;
} 
internal DialogResult ShowMessage(
    IWin32Window owner,
    string appTitle,
    string caption, string text,
    MessageBoxIcon icon,
    MessageBoxButtons buttons,
    MessageBoxDefaultButton defaultButton) {

    if (String.IsNullOrEmpty(caption)) {
        caption = appTitle;
    }

    MessageBoxOptions options = (MessageBoxOptions)0;

    if ((owner is Control && owner != null &&
        ((Control)owner).RightToLeft == RightToLeft.Yes) ||
        _rightToLeft) {
        options |= MessageBoxOptions.RtlReading |
            MessageBoxOptions.RightAlign;
    }

    return MessageBox.Show(owner, text, caption,
        buttons, icon, defaultButton, options);
} 

Applies to