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

C# MessageBoxImage类代码示例

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

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



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

示例1: GetMessageIcon

        private static MessageIcon GetMessageIcon(MessageBoxImage image)
        {
            MessageIcon icon;
            switch (image)
            {
                case MessageBoxImage.Exclamation:
                    icon = MessageIcon.Warning;
                    break;

                case MessageBoxImage.Asterisk:
                    icon = MessageIcon.Information;
                    break;

                case MessageBoxImage.Hand:
                    icon = MessageIcon.Error;
                    break;

                case MessageBoxImage.Question:
                    icon = MessageIcon.Question;
                    break;

                default:
                    icon = MessageIcon.None;
                    break;
            }
            return icon;
        }
开发者ID:4lx,项目名称:Profiler,代码行数:27,代码来源:IWindowManagerEx.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: MessageEventArgs

 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="MsgType">メッセージボックスに表示するアイコンの種類</param>
 /// <param name="ContinueFlg">処理を継続できるかのフラグ(true:可能、false:不可)</param>
 /// <param name="MsgCd">メッセージコード</param>
 /// <param name="AddMsg">追加メッセージ</param>
 public MessageEventArgs(MessageBoxImage MsgType, bool ContinueFlg, string MsgCd, params object[] AddMsg)
 {
     this.MsgType = MsgType;
     this.ContinueFlg = ContinueFlg;
     this.MsgCd = MsgCd;
     this.AddMsg = AddMsg;
 }
开发者ID:higeneko2015,项目名称:WCFCommon,代码行数:14,代码来源:MessageEventArgs.cs


示例4: DialogErrorEntity

 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="ErrorCd">メッセージコード</param>
 /// <param name="DialogType">ダイアログの種類</param>
 public DialogErrorEntity(MessageBoxImage DialogType, bool ContinueFlg, string ErrorCd, params string[] AddMessage)
 {
     this.ErrorCd = ErrorCd;
     this.ContinueFlg = ContinueFlg;
     this.DialogType = DialogType;
     this.AddMessage = AddMessage;
 }
开发者ID:higeneko2015,项目名称:WCFCommon,代码行数:12,代码来源:DialogErrorEntity.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: 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


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


示例8: popup

 public static void popup(string message, MessageBoxImage mbi)
 {
     mainWindow.Dispatcher.Invoke(mainWindow.DelShowOkMsg, message, mbi);
     mainWindow.Dispatcher.BeginInvoke(mainWindow.DelWriteLog, message);
     Trace.WriteLine(message);
     Trace.Flush();
 }
开发者ID:denbyk,项目名称:ProgSis2015_cl,代码行数:7,代码来源:MyLogger.cs


示例9: PlayMessageBeep

		private static void PlayMessageBeep(MessageBoxImage icon)
		{
			switch (icon)
			{
				//case MessageBoxImage.Hand:
				//case MessageBoxImage.Stop:
				case MessageBoxImage.Error:
					SystemSounds.Hand.Play();
					break;

				//case MessageBoxImage.Exclamation:
				case MessageBoxImage.Warning:
					SystemSounds.Exclamation.Play();
					break;

				case MessageBoxImage.Question:
					SystemSounds.Question.Play();
					break;

				//case MessageBoxImage.Asterisk:
				case MessageBoxImage.Information:
					SystemSounds.Asterisk.Play();
					break;

				default:
					SystemSounds.Beep.Play();
					break;
			}
		}
开发者ID:nullkuhl,项目名称:fdu-dev,代码行数:29,代码来源:WPFMessageBoxWindow.xaml.cs


示例10: ShowAsync

        public Task<MessageBoxResult> ShowAsync(string message, string title, MessageBoxButton buttons, MessageBoxImage image)
        {
            var tcs = new TaskCompletionSource<MessageBoxResult>();

            _dispatcherService.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                MessageBoxResult result;
                Window activeWindow = null;
                for (var i = 0; i < Application.Current.Windows.Count; i++)
                {
                    var win = Application.Current.Windows[i];
                    if ((win != null) && (win.IsActive))
                    {
                        activeWindow = win;
                        break;
                    }
                }

                if (activeWindow != null)
                {
                    result = MessageBox.Show(activeWindow, message, title, buttons, image);
                }
                else
                {
                    result = MessageBox.Show(message, title, buttons, image);
                }

                tcs.SetResult(result);
            }));


            return tcs.Task;
        }
开发者ID:modulexcite,项目名称:nvmsharp,代码行数:33,代码来源:MessageService.cs


示例11: MessageBoxMessage

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


示例12: Show

 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>
 /// Displays a customized message box in front of the specified window.
 /// </summary>
 /// <param name="owner">Owner window of the message box.</param>
 /// <param name="messageBoxText">Text to display.</param>
 /// <param name="caption">Title bar caption to display.</param>
 /// <param name="button">A value that specifies which button or buttons to display.</param>
 /// <param name="icon">Icon to display.</param>
 /// <returns>Button value which message box is clicked by the user.</returns>
 public static MessageBoxExButtonType Show(Window owner, string messageBoxText, string caption,
                                           MessageBoxButtons button, MessageBoxImage icon)
 {
     bool checkBoxState = false; // NOTE: ignored
     MessageBoxEx msbBox = new MessageBoxEx();
     return msbBox._Show(owner, messageBoxText, caption, button, icon, null, ref checkBoxState);
 }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:19,代码来源:MessageBoxEx.cs


示例13: DisplayMessage

        private static MessageBoxResult DisplayMessage(string message, MessageBoxImage image, MessageBoxButton button, Window owner)
        {
            var dialogOwner = owner;
            var result = MessageBoxResult.None;

            if (dialogOwner != null)
            {
                if (dialogOwner.Dispatcher != null)
                {
                    dialogOwner.Dispatcher.adoptAsync(() =>
                    {
                        result = MessageBox.Show(dialogOwner, message, "MeTL", button, image);
                    });
                } else
                {
                    Application.Current.Dispatcher.adoptAsync(() =>
                    {
                        result = MessageBox.Show(dialogOwner, message, "MeTL", button, image);
                    });

                }
            }
            else
            {
                // calling from non-ui thread
                if (Application.Current != null && Application.Current.Dispatcher != null)
                    Application.Current.Dispatcher.adoptAsync(() =>
                    {
                        dialogOwner = GetMainWindow();
                        result = MessageBox.Show(dialogOwner, message, "MeTL", button, image);
                    });
            }

            return result;
        }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:35,代码来源:MeTLMessage.cs


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


示例15: MoqPopup

 public MoqPopup(string headerText, string discriptionText, MessageBoxImage imageType, MessageBoxButton buttons)
 {
     Header = headerText;
     Description = discriptionText;
     ImageType = imageType;
     Buttons = buttons;
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:7,代码来源:MoqPopup.cs


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


示例17: MyMessageBox

 public static MessageBoxResult MyMessageBox(string p_strMessage, MessageBoxButton p_objButtons,MessageBoxImage p_objImage = MessageBoxImage.Question)
 {
     return MessageBox.Show(p_strMessage, APP_NAME,
                            p_objButtons,
                            p_objImage,
                            MessageBoxResult.OK);
 }
开发者ID:itsho,项目名称:ItshoMultiVisualizer,代码行数:7,代码来源:UiHelper.cs


示例18: MessageBoxImageToImageSource

 public static ImageSource MessageBoxImageToImageSource(MessageBoxImage image)
 {
     Icon icon;
     switch (image)
     {
         case MessageBoxImage.None:
             icon = null;
             break;
         case MessageBoxImage.Error: // also MessageBoxImage.Hand ans MessageBoxImage.Stop:
             icon = SystemIcons.Hand;
             break;
         case MessageBoxImage.Question:
             icon = SystemIcons.Question;
             break;
         case MessageBoxImage.Warning: // also MessageBoxImage.Exclamation
             icon = SystemIcons.Exclamation;
             break;
         case MessageBoxImage.Information: //case MessageBoxImage.Asterisk
             icon = SystemIcons.Asterisk;
             break;
         default:
             icon = SystemIcons.Application;
             break;
     }
     return (icon == null) ? null : Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
 }
开发者ID:borndead,项目名称:PoESkillTree,代码行数:26,代码来源:MetroMessageBoxWindow.xaml.cs


示例19: ShowDialog

        /// <summary>
        /// Shows MessageBox dialog with specified buttons texts
        /// </summary>
        /// <param name="message">Message to display</param>
        /// <param name="title">Title to display</param>
        /// <param name="buttons">Optonal buttons definiton</param>
        /// <param name="icon">Optional icon definition</param>
        /// <param name="buttonsTexts">Optional buttons texts</param>
        /// <returns></returns>
        public static MessageBoxResult ShowDialog(
            string message,
            string title,
            MessageBoxButton buttons = MessageBoxButton.OK,
            MessageBoxImage icon = MessageBoxImage.Information,
            Dictionary<Buttons, string> buttonsTexts = null)
        {
            try
            {
                // Register buttons texts
                if (buttonsTexts != null)
                {
                    foreach (Buttons button in buttonsTexts.Keys)
                    {
                        // Set given text to a proper buttons
                        switch (button)
                        {
                            case Buttons.OK:
                                MessageBoxManager.OK = buttonsTexts[button];
                                break;

                            case Buttons.YES:
                                MessageBoxManager.Yes = buttonsTexts[button];
                                break;

                            case Buttons.NO:
                                MessageBoxManager.No = buttonsTexts[button];
                                break;

                            case Buttons.CANCEL:
                                MessageBoxManager.Cancel = buttonsTexts[button];
                                break;
                        }
                    }

                    // Register buttons
                    MessageBoxManager.Register();
                }

                MessageBoxResult result =
                    System.Windows.MessageBox.Show(message, title, buttons, icon);

                return result;
            }
            catch (Exception ex)
            {
                Karafa.Errors.KarafaLogger.LogError(ex);

                return default(MessageBoxResult);
            }
            finally
            {
                if (buttonsTexts != null)
                {
                    // Unregister buttons
                    MessageBoxManager.Unregister();
                }
            }
        }
开发者ID:onashackem,项目名称:KaRaFa,代码行数:68,代码来源:MessageBoxLocalizer.cs


示例20: Warning

 public Warning(string text, string title, MessageBoxButton button, MessageBoxImage image)
 {
     messageTitle = title;
     messageText = text;
     messageImage = image;
     messageButton = button;
     result = MessageBox.Show(messageText, messageTitle, messageButton, messageImage);
 }
开发者ID:xigolle,项目名称:MapEditorcSharp,代码行数:8,代码来源:Warning.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MessageBoxOptions类代码示例发布时间:2022-05-24
下一篇:
C# MessageBoxIcon类代码示例发布时间: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