• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MessageBoxResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MessageBoxResult的典型用法代码示例。如果您正苦于以下问题:C# MessageBoxResult类的具体用法?C# MessageBoxResult怎么用?C# MessageBoxResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MessageBoxResult类属于命名空间,在下文中一共展示了MessageBoxResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AlertDialogBackend

 public AlertDialogBackend()
 {
     this.buttons = MessageBoxButton.OKCancel;
     this.icon = MessageBoxImage.None;
     this.options = MessageBoxOptions.None;
     this.defaultResult = MessageBoxResult.Cancel;
 }
开发者ID:garuma,项目名称:xwt,代码行数:7,代码来源:AlertDialogBackend.cs


示例2: authorizationButton_Click

        private void authorizationButton_Click(object sender, RoutedEventArgs e)
        {
            string login = loginComboBox.SelectedValue.ToString();
            string password = passwordTextBox.Password;          

            if (AuthorizationDefend.EntranceToSystem(login, password) == false)
            {
                MessageBoxResult result = new MessageBoxResult();
                result=MessageBox.Show("Ошибка авторизации! Неверный ввод пароля.", "Ошибка авторизации", MessageBoxButton.OK, MessageBoxImage.Error);

                if (result == MessageBoxResult.OK)
                {
                    loginComboBox.SelectedIndex = 0;
                    passwordTextBox.Clear();
                }
            }
            else
            {
                mainMenuWindow mainMenuWindow = new mainMenuWindow();

                if (loginComboBox.SelectedIndex == 0)
                {
                    mainMenuWindow.Title = "Администратор: Главное меню";
                }
                else
                {
                    mainMenuWindow.Title = "Пользователь: Главное меню";
                }
                
                mainMenuWindow.Show();
                this.Close();
            }
            
        }
开发者ID:kashkarova,项目名称:CourseWorkWpfApp,代码行数:34,代码来源:MainWindow.xaml.cs


示例3: Show

 public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult)
 {
     if (_provider != null)
         return _provider.Show(messageBoxText, caption, button, icon, defaultResult);
     else
         return MessageBox.Show(messageBoxText, caption, button, icon, defaultResult);
 }
开发者ID:JoeGilkey,项目名称:RadioLog,代码行数:7,代码来源:MessageBoxHelper.cs


示例4: DialogComplete

    /// <summary>
    /// Called when the dialog completes.
    /// </summary>
    /// <param name="result">The result of the message box.</param>
    public void DialogComplete(MessageBoxResult result)
    {
      if (CompleteCallback == null)
        return;

      CompleteCallback(result);
    }
开发者ID:modulexcite,项目名称:LoreSoft.Shared,代码行数:11,代码来源:DialogMessage.cs


示例5: ShowAsync

 public static void ShowAsync(string text, MessageBoxButton button = MessageBoxButton.OK,
     MessageBoxImage image = MessageBoxImage.Information, MessageBoxResult defaultButton = MessageBoxResult.OK)
 {
     new Thread(
         new ThreadStart(delegate { MessageBox.Show(text, Resources.AppName, button, image, defaultButton); }))
         .Start();
 }
开发者ID:danielchalmers,项目名称:DesktopWidgets,代码行数:7,代码来源:Popup.cs


示例6: CloseWithResult

        protected void CloseWithResult(MessageBoxResult? result) {
            if (result.HasValue) {
                MessageBoxResult = result.Value;

                try {
                    // sets the Window.DialogResult as well
                    // ReSharper disable once SwitchStatementMissingSomeCases
                    switch (result.Value) {
                        case MessageBoxResult.OK:
                        case MessageBoxResult.Yes:
                            DialogResult = true;
                            break;
                        case MessageBoxResult.Cancel:
                        case MessageBoxResult.No:
                            DialogResult = false;
                            break;
                        default:
                            DialogResult = null;
                            break;
                    }
                } catch (InvalidOperationException) {
                    // TODO: Maybe there is a better way?
                }
            }

            Close();
        }
开发者ID:gro-ove,项目名称:actools,代码行数:27,代码来源:ModernDialog.cs


示例7: ModernDialog

        /// <summary>
        /// Initializes a new instance of the <see cref="ModernDialog"/> class.
        /// </summary>
        public ModernDialog()
        {
            this.DefaultStyleKey = typeof(ModernDialog);
            this.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            this.closeCommand = new RelayCommand(o => {
                var result = o as MessageBoxResult?;
                if (result.HasValue) {
                    this.messageBoxResult = result.Value;

                    // sets the Window.DialogResult as well
                    if (result.Value == MessageBoxResult.OK || result.Value == MessageBoxResult.Yes) {
                        this.DialogResult = true;
                    }
                    else if (result.Value == MessageBoxResult.Cancel || result.Value == MessageBoxResult.No){
                        this.DialogResult = false;
                    }
                    else{
                        this.DialogResult = null;
                    }
                }
                Close();
            });

            this.Buttons = new Button[] { this.CloseButton };

            // set the default owner to the app main window (if possible)
            if (Application.Current != null && Application.Current.MainWindow != this) {
                this.Owner = Application.Current.MainWindow;
            }
        }
开发者ID:3A9C,项目名称:ITstep,代码行数:34,代码来源:ModernDialog.cs


示例8: ShowAsyncModified

        public static async Task<MessageBoxResult> ShowAsyncModified(string msg, string cap, string optionOne, string optionTwo)
        {
            MessageBoxResult i = new MessageBoxResult();

            // Create the message dialog and set its content and title
            var messageDialog = new MessageDialog("New updates have been found for this program. Would you like to install the new updates?", "Updates available");

            // Add commands and set their callbacks
            messageDialog.Commands.Add(new UICommand(optionOne, (command) =>
            {
                i = MessageBoxResult.Working;
            }));

            messageDialog.Commands.Add(new UICommand(optionTwo, (command) =>
            {
                i = MessageBoxResult.NonWorking;
            }));

            messageDialog.Commands.Add(new UICommand("Cancel", (command) =>
            {
                i = MessageBoxResult.Cancel;
            }));

            // Set the command that will be invoked by default
            messageDialog.DefaultCommandIndex = (uint)MessageBoxResult.Cancel;

            // Show the message dialog
            await messageDialog.ShowAsync();

            return i;
        }
开发者ID:jonnylin,项目名称:TimeTracking,代码行数:31,代码来源:MessageBox.cs


示例9: Show

        public static MessageBoxResult Show(
            Action<Window> setOwner,
            string messageBoxText, 
            string caption, 
            MessageBoxButton button, 
            MessageBoxImage icon, 
            MessageBoxResult defaultResult, 
            MessageBoxOptions options)
        {
            if ((options & MessageBoxOptions.DefaultDesktopOnly) == MessageBoxOptions.DefaultDesktopOnly)
            {
                throw new NotImplementedException();
            }

            if ((options & MessageBoxOptions.ServiceNotification) == MessageBoxOptions.ServiceNotification)
            {
                throw new NotImplementedException();
            }

            _messageBoxWindow = new WpfMessageBoxWindow();

            setOwner(_messageBoxWindow);

            PlayMessageBeep(icon);

            _messageBoxWindow._viewModel = new MessageBoxViewModel(_messageBoxWindow, caption, messageBoxText, button, icon, defaultResult, options);
            _messageBoxWindow.DataContext = _messageBoxWindow._viewModel;
            _messageBoxWindow.ShowDialog();
            return _messageBoxWindow._viewModel.Result;
        }
开发者ID:suvjunmd,项目名称:Windows-10-Login-Background-Changer,代码行数:30,代码来源:WPFMessageBoxWindow.xaml.cs


示例10: Show

        public static MessageBoxResult Show(
            Action<Window> setOwner,
            CultureInfo culture,
            string messageBoxText,
            string caption,
            WPFMessageBoxButton button,
            MessageBoxImage icon,
            MessageBoxResult defaultResult,
            MessageBoxOptions options)
        {
            if ((options & MessageBoxOptions.DefaultDesktopOnly) == MessageBoxOptions.DefaultDesktopOnly)
            {
                throw new NotImplementedException();
            }

            if ((options & MessageBoxOptions.ServiceNotification) == MessageBoxOptions.ServiceNotification)
            {
                throw new NotImplementedException();
            }
            //LocalizeDictionary.Instance.Culture = CultureInfo.GetCultureInfo("de");
            _messageBoxWindow = new WPFMessageBoxWindow();

            setOwner(_messageBoxWindow);

            PlayMessageBeep(icon);
            //FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(
            //            XmlLanguage.GetLanguage(culture.IetfLanguageTag)));
            _messageBoxWindow._viewModel = new MessageBoxViewModel(_messageBoxWindow, culture, caption, messageBoxText, button, icon, defaultResult, options);
            _messageBoxWindow.DataContext = _messageBoxWindow._viewModel;
            _messageBoxWindow.ShowDialog();
            return _messageBoxWindow._viewModel.Result;
        }
开发者ID:nullkuhl,项目名称:driverGalaxy-release,代码行数:32,代码来源:WPFMessageBoxWindow.xaml.cs


示例11: MessageBoxButtonViewModel

 public MessageBoxButtonViewModel(string text, MessageBoxResult result, Action<MessageBoxResult> returnAction, bool hasInitFocus = false)
 {
     m_text = text;
       m_result = result;
       m_hasInitFocus = hasInitFocus;
       m_command = new GenericManualCommand<MessageBoxResult>(returnAction);
 }
开发者ID:grarup,项目名称:SharpE,代码行数:7,代码来源:MessageBoxButtonViewModel.cs


示例12: ToOleDefault

      private static OLEMSGDEFBUTTON ToOleDefault(MessageBoxResult defaultResult, MessageBoxButton button)
      {
         switch (button)
         {
            case MessageBoxButton.OK:
               return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;

            case MessageBoxButton.OKCancel:
               if (defaultResult == MessageBoxResult.Cancel)
                  return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND;

               return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;

            case MessageBoxButton.YesNoCancel:
               if (defaultResult == MessageBoxResult.No)
                  return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND;
               if (defaultResult == MessageBoxResult.Cancel)
                  return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_THIRD;

               return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;

            case MessageBoxButton.YesNo:
               if (defaultResult == MessageBoxResult.No)
                  return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND;

               return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;
         }

         return OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST;
      }
开发者ID:modulexcite,项目名称:AlphaVSX,代码行数:30,代码来源:DialogService.cs


示例13: ShowCore

        private static MessageBoxResult ShowCore(
            string messageBoxText,
            string caption,
            MessageBoxButton button,
            MessageDialogImage icon,
            MessageBoxResult defaultResult)
        {
            if (!IsValidMessageBoxButton(button))
            {
                throw new InvalidEnumArgumentException("button", (int)button, typeof(MessageBoxButton));
            }

            if (!IsValidMessageDialogImage(icon))
            {
                throw new InvalidEnumArgumentException("icon", (int)icon, typeof(MessageBoxImage));
            }

            if (!IsValidMessageBoxResult(defaultResult))
            {
                throw new InvalidEnumArgumentException("defaultResult", (int)defaultResult, typeof(MessageBoxResult));
            }

            var dialog = new Dialog(messageBoxText, caption, button, icon, defaultResult);
            var flag = dialog.ShowDialog();
            return flag == true ? MessageBoxResult.No : MessageBoxResult.None;
        }
开发者ID:Orange637,项目名称:WpfStudy,代码行数:26,代码来源:MessageDialog.cs


示例14: Show

        /// <summary>
        /// Displays the specified message box as a modal dialog.
        /// </summary>
        /// <param name="mb">The message box to display.</param>
        /// <param name="text">The text to display.</param>
        /// <param name="caption">The caption to display.</param>
        /// <param name="button">A <see cref="MessageBoxButton"/> value that specifies the set of buttons to display.</param>
        /// <param name="image">A <see cref="MessageBoxImage"/> value that specifies the image to display.</param>
        /// <param name="defaultResult">A <see cref="MessageBoxResult"/> value that specifies the message box's default option.</param>
        public static void Show(MessageBoxModal mb, String text, String caption, MessageBoxButton button, MessageBoxImage image, MessageBoxResult defaultResult)
        {
            Contract.Require(mb, "mb");
            
            mb.Prepare(text, caption, button, image, defaultResult);

            Modal.ShowDialog(mb);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:17,代码来源:MessageBox.cs


示例15: Prompt

 public MessageBoxResult Prompt(string message,
     string title = DefaultTitle,
     MessageBoxButton button = DefaultButton,
     MessageBoxImage icon = MessageBoxImage.Question,
     MessageBoxResult defaultResult = DefaultResult)
 {
     return this.uiShell.Prompt(message, title, button, icon, defaultResult);
 }
开发者ID:MobileEssentials,项目名称:clide,代码行数:8,代码来源:MessageBoxService.cs


示例16: Prepare

 /// <summary>
 /// Prepares the message box to be displayed.
 /// </summary>
 /// <param name="text">The message box's text.</param>
 /// <param name="caption">The message box's caption.</param>
 /// <param name="button">A <see cref="MessageBoxButton"/> value that specifies the set of buttons to display.</param>
 /// <param name="image">A <see cref="MessageBoxImage"/> value that specifies the image to display.</param>
 /// <param name="defaultResult">A <see cref="MessageBoxResult"/> value that specifies the message box's default option.</param>
 internal void Prepare(String text, String caption, MessageBoxButton button, MessageBoxImage image, MessageBoxResult defaultResult)
 {
     var vm = screen.View.GetViewModel<MessageBoxViewModel>();
     if (vm != null)
     {
         vm.Prepare(text, caption, button, image, defaultResult);
     }
 }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:16,代码来源:MessageBoxModal.cs


示例17: Show

 public MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxResult defaultResult) {
     MessageBoxTest = messageBoxText;
     Caption = caption;
     Button = button;
     DefaultResult = defaultResult;
     ShowCount++;
     return Result;
 }
开发者ID:JustGitHubUser,项目名称:DevExpress.Mvvm.Free,代码行数:8,代码来源:ConfirmationBehaviorTests.cs


示例18: IsValidMessageBoxResult

 private static bool IsValidMessageBoxResult(MessageBoxResult value)
 {
     return value == MessageBoxResult.Cancel
         || value == MessageBoxResult.No
         || value == MessageBoxResult.None
         || value == MessageBoxResult.OK
         || value == MessageBoxResult.Yes;
 }
开发者ID:Orange637,项目名称:WpfStudy,代码行数:8,代码来源:MessageDialog.cs


示例19: Show

 public bool? Show(string message,
     string title = DefaultTitle,
     MessageBoxButton button = DefaultButton,
     MessageBoxImage icon = DefaultIcon,
     MessageBoxResult defaultResult = DefaultResult)
 {
     return this.uiShell.ShowMessageBox(message, title, button, icon, defaultResult);
 }
开发者ID:MobileEssentials,项目名称:clide,代码行数:8,代码来源:MessageBoxService.cs


示例20: DatabaseSettingButtonExitClick

 //Button Exit Click
 private void DatabaseSettingButtonExitClick(object sender, System.Windows.RoutedEventArgs e)
 {
     MessageBoxResult messBoxResult = new MessageBoxResult();
     messBoxResult = Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[1, 1], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.YesNo, MessageBoxImage.Question);
     if (messBoxResult.Equals(MessageBoxResult.Yes))
     {
         Application.Current.Shutdown();
     }
 }
开发者ID:shuvo009,项目名称:ProcestaPetunia,代码行数:10,代码来源:WindowDataBaseSetting.xaml.cs



注:本文中的MessageBoxResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MessageBus类代码示例发布时间:2022-05-24
下一篇:
C# MessageBoxOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap