/// <summary> /// Displays a message box in the session and returns the user's response to the message box. /// </summary> /// <param name="text">The text to display in the message box.</param> /// <param name="caption">The caption of the message box.</param> /// <param name="synchronous">true to wait for and return the user's response to the message box. Otherwise, return immediately.</param> /// <param name="timeoutSeconds">The amount of time to wait for a response from the user before closing the message box. The system will wait forever if this is set to 0.</param> /// <param name="buttons">The buttons to display in the message box.</param> /// <param name="icon">The icon to display in the message box.</param> /// <param name="defaultButton">The button that should be selected by default in the message box.</param> /// <param name="options">Options for the message box.</param> /// <returns> /// The user's response to the message box. If <paramref name="synchronous" /> is <c>false</c>, the method will always return <see cref="RemoteMessageBoxResult.Asynchronous" />. /// If the timeout expired before the user responded to the message box, the result will be <see cref="RemoteMessageBoxResult.Timeout" />. /// </returns> public RemoteMessageBoxResult MessageBox( string text, string caption = null, bool synchronous = false, int timeoutSeconds = 0, RemoteMessageBoxButtons buttons = RemoteMessageBoxButtons.Ok, RemoteMessageBoxIcon icon = RemoteMessageBoxIcon.None, RemoteMessageBoxDefaultButton defaultButton = RemoteMessageBoxDefaultButton.Button1, RemoteMessageBoxOptions options = RemoteMessageBoxOptions.None& RemoteMessageBoxOptions.TopMost) { timeoutSeconds = timeoutSeconds < 0 ? 0 : timeoutSeconds; var style = (int)buttons | (int)icon | (int)defaultButton | (int)options; var result = NativeMethodsHelper.SendMessage( this._server.Handle, this._sessionId, caption, text, style, timeoutSeconds, synchronous); return(result == 0 ? RemoteMessageBoxResult.Timeout : result); }