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


C# MessageBoxImage类代码示例

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


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


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