本文整理汇总了C#中DialogMessage.ProcessCallback方法的典型用法代码示例。如果您正苦于以下问题:C# DialogMessage.ProcessCallback方法的具体用法?C# DialogMessage.ProcessCallback怎么用?C# DialogMessage.ProcessCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DialogMessage
的用法示例。
在下文中一共展示了DialogMessage.ProcessCallback方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStatusUpdateMessage
private static void OnStatusUpdateMessage(DialogMessage dialogMessage)
{
if (dialogMessage != null)
{
MessageBoxResult result = MessageBox.Show(dialogMessage.Content,
dialogMessage.Caption, dialogMessage.Button);
dialogMessage.ProcessCallback(result);
}
}
示例2: ShowMessageBox
/// <summary>
/// Shows a message box.
/// </summary>
/// <param name="message">
/// A <see cref="T:DialogMessage"/> that defines the message box.
/// </param>
public void ShowMessageBox(DialogMessage message)
{
MessageBoxResult result =
MessageBox.Show(
message.Content,
message.Caption,
message.Button);
message.ProcessCallback(result);
}
示例3: ShowMessageBox
/// <summary>
/// Shows a message box.
/// </summary>
/// <param name="message">
/// A <see cref="T:DialogMessage"/> that defines the message box.
/// </param>
public void ShowMessageBox(DialogMessage message)
{
TaskDialogOptions options = new TaskDialogOptions();
options.Owner = DialogHelper.TryGetOwnerFromSender(message.Sender);
options.MainInstruction = message.Content;
options.Title = message.Caption;
switch (message.Button)
{
case MessageBoxButton.OK:
options.CommonButtons = TaskDialogCommonButtons.Close;
options.DefaultButtonIndex = 0;
break;
case MessageBoxButton.OKCancel:
options.CommonButtons = TaskDialogCommonButtons.OKCancel;
if (message.DefaultResult == MessageBoxResult.OK)
options.DefaultButtonIndex = 0;
else
options.DefaultButtonIndex = 1;
break;
case MessageBoxButton.YesNo:
options.CommonButtons = TaskDialogCommonButtons.YesNo;
if (message.DefaultResult == MessageBoxResult.Yes)
options.DefaultButtonIndex = 0;
else
options.DefaultButtonIndex = 1;
break;
case MessageBoxButton.YesNoCancel:
options.CommonButtons = TaskDialogCommonButtons.YesNoCancel;
if (message.DefaultResult == MessageBoxResult.Yes)
options.DefaultButtonIndex = 0;
else if (message.DefaultResult == MessageBoxResult.No)
options.DefaultButtonIndex = 1;
else
options.DefaultButtonIndex = 2;
break;
}
switch (message.Icon)
{
default:
case MessageBoxImage.None:
case MessageBoxImage.Question:
break;
case MessageBoxImage.Information:
options.MainIcon = VistaTaskDialogIcon.Information;
break;
case MessageBoxImage.Warning:
options.MainIcon = VistaTaskDialogIcon.Warning;
break;
case MessageBoxImage.Error:
options.MainIcon = VistaTaskDialogIcon.Error;
break;
}
TaskDialogResult result = TaskDialog.Show(options);
// TaskDialogSimpleResult is directly convertable to DialogResult (WinForms) and MessageBoxResult (WPF)
message.ProcessCallback((MessageBoxResult)result.Result);
}