Example #1
0
        public RemoteMessageBoxResult MessageBox(string text, string caption, RemoteMessageBoxButtons buttons,
                                                 RemoteMessageBoxIcon icon, RemoteMessageBoxDefaultButton defaultButton, RemoteMessageBoxOptions options,
                                                 TimeSpan timeout, bool synchronous)
        {
            var timeoutSeconds = (int)timeout.TotalSeconds;
            var style          = (int)buttons | (int)icon | (int)defaultButton | (int)options;
            // TODO: Win 2003 Server doesn't start timeout counter until user moves mouse in session.
            var result = NativeMethodsHelper.SendMessage(_server.Handle, _sessionId, caption, text, style,
                                                         timeoutSeconds, synchronous);

            // TODO: Windows Server 2008 R2 beta returns 0 if the timeout expires.
            // find out why this happens or file a bug report.
            return(result == 0 ? RemoteMessageBoxResult.Timeout : result);
        }