本文整理汇总了C#中MessageBox.ShowInternal方法的典型用法代码示例。如果您正苦于以下问题:C# MessageBox.ShowInternal方法的具体用法?C# MessageBox.ShowInternal怎么用?C# MessageBox.ShowInternal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageBox
的用法示例。
在下文中一共展示了MessageBox.ShowInternal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
/// <summary>
/// Displays a <see cref="MessageBox"/> an returns the <see cref="MessageBoxResult"/> depending on the user's choice.
/// </summary>
/// <param name="owner">A <see cref="Window"/> that represents the owner window of the message box.</param>
/// <param name="message">A <see cref="string"/> that specifies the text to display.</param>
/// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
/// <param name="buttons">A n enumeration of <see cref="DialogButtonInfo"/> that specifies buttons to display</param>
/// <param name="image">A <see cref="MessageBoxImage"/> value that specifies the icon to display.</param>
/// <returns>A <see cref="MessageBoxResult"/> value that specifies which message box button is clicked by the user.</returns>
public static MessageBoxResult Show(Window owner, string message, string caption, IEnumerable<DialogButtonInfo> buttons, MessageBoxImage image)
{
var messageBox = new MessageBox
{
Owner = owner,
WindowStartupLocation = owner != null ? WindowStartupLocation.CenterOwner : WindowStartupLocation.CenterScreen,
Title = caption,
Content = message,
ButtonsSource = buttons.ToList(),
};
SetImage(messageBox, image);
return (MessageBoxResult)messageBox.ShowInternal();
}
示例2: Show
/// <summary>
/// Displays a <see cref="MessageBox"/> an returns the <see cref="MessageBoxResult"/> depending on the user's choice.
/// </summary>
/// <param name="owner">The intended owner window of the message box.</param>
/// <param name="message">A <see cref="string"/> that specifies the text to display.</param>
/// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
/// <param name="buttons">A n enumeration of <see cref="DialogButtonInfo"/> that specifies buttons to display</param>
/// <param name="image">A <see cref="MessageBoxImage"/> value that specifies the icon to display.</param>
/// <returns>A <see cref="MessageBoxResult"/> value that specifies which message box button is clicked by the user.</returns>
public static async Task<MessageBoxResult> Show(WindowOwner owner, string message, string caption, IEnumerable<DialogButtonInfo> buttons, MessageBoxImage image)
{
var buttonList = buttons.ToList();
var messageBox = new MessageBox
{
Title = caption,
Content = message,
ButtonsSource = buttonList,
};
SetImage(messageBox, image);
SetKeyBindings(messageBox, buttonList);
return (MessageBoxResult)await messageBox.ShowInternal(owner);
}