本文整理汇总了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;
}
示例2: AlertDialogBackend
public AlertDialogBackend()
{
this.buttons = MessageBoxButton.OKCancel;
this.icon = MessageBoxImage.None;
this.options = MessageBoxOptions.None;
this.defaultResult = MessageBoxResult.Cancel;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
示例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;
}
示例11: MessageBoxMessage
public MessageBoxMessage(string text, string caption, MessageBoxImage image)
{
this.Text = text;
this.Caption = caption;
this.Button = MessageBoxButton.OK;
this.Image = image;
}
示例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);
}
示例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;
}
示例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;
}
示例15: MoqPopup
public MoqPopup(string headerText, string discriptionText, MessageBoxImage imageType, MessageBoxButton buttons)
{
Header = headerText;
Description = discriptionText;
ImageType = imageType;
Buttons = buttons;
}