Exemplo n.º 1
0
        private void ShowDialog(MessageDailog dm)
        {
            Dispatcher.InvokeAsync(() =>
            {
                var messageWindow = new MessageWindowElement(dm);
                messageWindow.ShowWindow();

                dm.ProcessCallback(messageWindow.DialogResult);
            }, DispatcherPriority.Normal);
        }
        /// <summary>
        /// Shows a new <see cref="MessageWindowElement"/> with the given caption, message and buttons
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="message"></param>
        /// <param name="buttons"></param>
        /// <returns></returns>
        public static DialogResult Show(string caption, string message, DialogButton buttons)
        {
            lock (SyncObject)
            {
                DialogResult result = DialogResult.None;

                Application.Current.Dispatcher.Invoke(
                    (Action) delegate
                {
                    var window = new MessageWindowElement
                    {
                        Title   = caption,
                        Content = message,
                        Buttons = buttons,
                        //StartupLocation = StartupPosition.CenterParent
                    };

                    window.ShowDialog();
                });

                return(result);
            }
        }
 /// <summary>
 /// Shows a new <see cref="MessageWindowElement"/> with the given caption and message
 /// </summary>
 /// <param name="caption"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public static DialogResult Show(string caption, string message)
 {
     return(MessageWindowElement.Show(caption, message, DialogButton.OkCancel));
 }
        /// <summary>
        /// Shows a new <see cref="MessageWindowElement"/> with the given caption, message and buttons
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="message"></param>
        /// <param name="buttons"></param>
        /// <returns></returns>
        public static DialogResult Show(string caption, string message, DialogButton buttons)
        {
            lock (SyncObject)
            {
                DialogResult result = DialogResult.None;

                Application.Current.Dispatcher.Invoke(
                    (Action)delegate
                    {
                        var window = new MessageWindowElement
                        {
                            Title           = caption,
                            Content         = message,
                            Buttons         = buttons,
                            //StartupLocation = StartupPosition.CenterParent
                        };

                        window.ShowDialog();
                    });

                return result;
            }
        }