示例#1
0
 public void ShowWarning(string caption, string message, MessageBoxHelpButton helpButton = null)
 {
     this.ShowMessageBox(caption, message, MessageBoxIconType.Warning, helpButton, new MessageBoxButton(OkButtonText, null, true, true));
 }
示例#2
0
 public TResult ShowMessageBox <TResult>(string caption, string message, MessageBoxIconType icon, MessageBoxHelpButton helpButton, params MessageBoxButton <TResult>[] buttons)
 {
     return((TResult)this.ShowMessageBox(caption, message, icon, helpButton, buttons.Cast <MessageBoxButton>().ToArray()));
 }
示例#3
0
 public bool AskUserOkCancel(string caption, string message, MessageBoxIconType icon = MessageBoxIconType.Question, MessageBoxHelpButton helpButton = null)
 {
     return(this.ShowMessageBox(caption, message, icon, helpButton,
                                new MessageBoxButton <bool>(OkButtonText, true, true),
                                new MessageBoxButton <bool>(CancelButtonText, false, false, true)));
 }
示例#4
0
        public object ShowMessageBox(string caption, string message, MessageBoxIconType icon, MessageBoxHelpButton helpButton, params MessageBoxButton[] buttons)
        {
            object result = null;

            Execute.OnUIThread(() =>
            {
                var viewModel = new MessageBoxViewModel {
                    DisplayName = caption, Message = message, Icon = icon
                };
                if (buttons != null)
                {
                    foreach (var messageBoxButton in buttons)
                    {
                        viewModel.AddButton(messageBoxButton);
                    }
                }
                if (helpButton != null)
                {
                    viewModel.HelpButtonCallback = helpButton.Action;
                    viewModel.HelpButtonText     = helpButton.Text;
                }
                _windowManager.ShowDialog(viewModel);
                result = viewModel.DialogResult;
            });
            return(result);
        }