Пример #1
0
        public MessageBoxResult ShowMessageBox(string message, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage image = MessageBoxImage.None, bool enableDontAsk = false, string help = "", MessageChoice defaultChoice = MessageChoice.OK)
        {
            var parent  = Dialog.ActiveModalWindow;
            var choices = GetMessageChoice(button);
            var icon    = MessageIconsMaps[image];
            var result  = DialogViewModel.Show(parent, icon, caption, message, choices, help, enableDontAsk, defaultChoice);

            if (MessageOptionsMaps.ContainsKey(result))
            {
                return(MessageOptionsMaps[result]);
            }

            return(MessageBoxResult.None);
        }
Пример #2
0
        public MessageBoxResult ShowMessageBox(string message, string caption = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxImage image = MessageBoxImage.None, bool enableDontAsk = false, string help = "")
        {
            var parent  = Dialog.ActiveModalWindow;
            var choices = GetMessageChoice(button);
            var icon    = GetMessageIcon(image);
            var result  = DialogViewModel.Show(parent, icon, caption, message, choices, help, enableDontAsk);

            switch (result)
            {
            case MessageChoice.OK:
                return(MessageBoxResult.OK);

            case MessageChoice.Cancel:
                return(MessageBoxResult.Cancel);

            case MessageChoice.Yes:
                return(MessageBoxResult.Yes);

            case MessageChoice.No:
                return(MessageBoxResult.No);
            }

            return(MessageBoxResult.None);
        }