当前位置: 首页>>代码示例>>C#>>正文


C# MessageBoxButton类代码示例

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


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

示例1: Show

 public static MessageBoxResult Show(
     string messageBoxText,
     string caption,
     MessageBoxButton button)
 {
     return ShowCore(messageBoxText, caption, button, MessageDialogImage.None, 0);
 }
开发者ID:Orange637,项目名称:WpfStudy,代码行数:7,代码来源:MessageDialog.cs

示例2: 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

示例3: Show

        /// <summary>
        /// Displays a message box that has a message, title bar caption, and button; and that returns a result.
        /// </summary>
        /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
        /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
        /// <param name="button">A System.Windows.MessageBoxButton value that specifies which button or buttons to display.</param>
        /// <returns>A System.Windows.MessageBoxResult value that specifies which message box button is clicked by the user.</returns>
        public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button)
        {
            CustomMessageBoxWindow msg = new CustomMessageBoxWindow(messageBoxText, caption, button);
            msg.ShowDialog();

            return msg.Result;
        }
开发者ID:Baajl,项目名称:GestionPresse,代码行数:14,代码来源:CustomMessageBox.cs

示例4: 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

示例5: MessageBoxMessage

 public MessageBoxMessage(string text, string caption, MessageBoxButton button, Action<MessageBoxResult> resultCallback)
 {
     this.Text = text;
     this.Caption = caption;
     this.Button = button;
     this.ResultCallback = resultCallback;
 }
开发者ID:karno,项目名称:Lycanthrope,代码行数:7,代码来源:MessageBoxMessage.cs

示例6: Show

        public static MessageBoxResult Show(Window parent, string msg, string title, MessageBoxButton btns, MessageBoxImage icon)
        {
            // Create a callback delegate
            _hookProcDelegate = new Win32.WindowsHookProc(HookCallback);

            // Remember the title & message that we'll look for.
            // The hook sees *all* windows, so we need to make sure we operate on the right one.
            _msg = msg;
            _title = title;

            // Set the hook.
            // Suppress "GetCurrentThreadId() is deprecated" warning.
            // It's documented that Thread.ManagedThreadId doesn't work with SetWindowsHookEx()
            #pragma warning disable 0618
            _hHook = Win32.SetWindowsHookEx(Win32.WH_CBT, _hookProcDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId());
            #pragma warning restore 0618

            // Pop a standard MessageBox. The hook will center it.
             MessageBoxResult rslt;
             if (parent == null)
                 rslt = MessageBox.Show(msg, title, btns, icon);
             else
                 rslt = MessageBox.Show(parent, msg, title, btns, icon);

            // Release hook, clean up (may have already occurred)
            Unhook();

            return rslt;
        }
开发者ID:ed4053,项目名称:YDownloader,代码行数:29,代码来源:MsgBox.cs

示例7: MessageBoxMessage

 public MessageBoxMessage(string key, string text, string caption, MessageBoxButton button)
     : base(key)
 {
     this.Text = text;
     this.Caption = caption;
     this.Button = button;
 }
开发者ID:karno,项目名称:NagoyaMetro,代码行数:7,代码来源:MessageBoxMessage.cs

示例8: ShowQuestion

 internal static MessageBoxResult ShowQuestion(string message, MessageBoxButton messageBoxButton)
 {
     return  MessageBox.Show(message,
                            "Question",
                            messageBoxButton,
                            MessageBoxImage.Question);
 }
开发者ID:hudo,项目名称:Pragmatic,代码行数:7,代码来源:UserInteraction.cs

示例9: ShowResponse

        internal static MessageBoxResult ShowResponse(string message, Response response, MessageBoxButton messageBoxButton)
        {
            MessageBoxImage messageBoxImage = MessageBoxImage.Information;
            string caption = "Information";

            if (response.HasErrors)
            {
                messageBoxImage = MessageBoxImage.Error;
                caption = "Error";
            }
            else if (response.HasWarnings)
            {
                messageBoxImage = MessageBoxImage.Warning;
                caption = "Warning";
            }
            else if (response.HasInformation)
            {
                messageBoxImage = MessageBoxImage.Information;
                caption = "Information";
            }

            string responseMessage = (response.Errors.Aggregate(string.Empty, (result, error) => string.Format("{1}{2}{0}", System.Environment.NewLine, result, error.Message)) + System.Environment.NewLine +
                                      response.Warnings.Aggregate(string.Empty, (result, error) => string.Format("{1}{2}{0}", System.Environment.NewLine, result, error.Message)) + System.Environment.NewLine +
                                      response.Information.Aggregate(string.Empty, (result, error) => string.Format("{1}{2}{0}", System.Environment.NewLine, result, error.Message))).Trim();

            return MessageBox.Show((message + System.Environment.NewLine + responseMessage).Trim(), caption, messageBoxButton, messageBoxImage);
        }
开发者ID:hudo,项目名称:Pragmatic,代码行数:27,代码来源:UserInteraction.cs

示例10: 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

示例11: Show

 public static void Show(string msg, string caption, MessageBoxButton button, MessageImage msgImage, Action<MessageBoxResult> callback)
 {
     DialogMessage result = new DialogMessage(null, msg, callback);
     result.Caption = caption + ";" + ((int)msgImage).ToString();
     result.Button = button;
     AppMessages.SendMessage.Send(result);
 }
开发者ID:hieu292,项目名称:hrm-k14vlu,代码行数:7,代码来源:MessageCustomize.cs

示例12: MessageWindow

 public MessageWindow(string text, MessageBoxButton buttons)
 {
     InitializeComponent();
     Message.Text = text;
     if (buttons == MessageBoxButton.OK)
     {
         AcceptButton.Content = "OK";
         AcceptButton.Visibility = Visibility.Visible;
         CancelButton.Visibility = Visibility.Hidden;
         NoButton.Visibility = Visibility.Hidden;
     }
     else if (buttons == MessageBoxButton.OKCancel)
     {
         AcceptButton.Content = "OK";
         AcceptButton.Visibility = Visibility.Visible;
         CancelButton.Visibility = Visibility.Visible;
         NoButton.Visibility = Visibility.Hidden;
     }
     else if (buttons == MessageBoxButton.YesNo)
     {
         AcceptButton.Content = "Yes";
         AcceptButton.Visibility = Visibility.Visible;
         CancelButton.Visibility = Visibility.Hidden;
         NoButton.Visibility = Visibility.Visible;
     }
     else if (buttons == MessageBoxButton.YesNoCancel)
     {
         AcceptButton.Content = "Yes";
         AcceptButton.Visibility = Visibility.Visible;
         CancelButton.Visibility = Visibility.Visible;
         NoButton.Visibility = Visibility.Visible;
     }
 }
开发者ID:Bang-Bang-Studios,项目名称:Big-Sunday,代码行数:33,代码来源:MessageWindow.xaml.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: IsValidMessageBoxButton

 private static bool IsValidMessageBoxButton(MessageBoxButton value)
 {
     return value == MessageBoxButton.OK
         || value == MessageBoxButton.OKCancel
         || value == MessageBoxButton.YesNo
         || value == MessageBoxButton.YesNoCancel;
 }
开发者ID:Orange637,项目名称:WpfStudy,代码行数:7,代码来源:MessageDialog.cs

示例15: Show

        public static MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button)
        {
            UIAlertView messageBox;
            if (button == MessageBoxButton.OKCancel)
                messageBox = new UIAlertView (caption, messageBoxText, null, "OK", "Cancel");
            else
                messageBox = new UIAlertView (caption, messageBoxText, null, "OK");
            messageBox.Show ();

            int clicked = -1;

            messageBox.Clicked += (s, buttonArgs) =>
            {
                clicked = buttonArgs.ButtonIndex;
            };
            while (clicked == -1)
            {
                NSRunLoop.Current.RunUntil (NSDate.FromTimeIntervalSinceNow (0.5));
                if (messageBox.BecomeFirstResponder() == false)
                    break;
            }

            if (clicked == 0)
                return MessageBoxResult.OK;
            else
                return MessageBoxResult.Cancel;
        }
开发者ID:ogazitt,项目名称:zaplify,代码行数:27,代码来源:MessageBox.cs


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