本文整理汇总了C#中Windows.UI.Popups.MessageDialog.AddButton方法的典型用法代码示例。如果您正苦于以下问题:C# MessageDialog.AddButton方法的具体用法?C# MessageDialog.AddButton怎么用?C# MessageDialog.AddButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Popups.MessageDialog
的用法示例。
在下文中一共展示了MessageDialog.AddButton方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecentThreadsViewModel
public RecentThreadsViewModel(
RecentThreadsService repositoryService,
IBoard board,
IShell shell,
FavoriteThreadsService favoriteThreads)
: base(repositoryService, board, shell) {
FavoriteThreads = favoriteThreads;
var dialog = new MessageDialog(
Localization.GetForView("RecentThreads", "ClearConfirmationContent"),
Localization.GetForView("RecentThreads", "ClearConfirmationTitle"));
dialog.AddButton(
Localization.GetForView("RecentThreads", "ConfirmClear"),
async () => {
IsLoading = true;
Threads.Clear();
RepositoryService.Items.Clear();
await RepositoryService.Save();
IsLoading = false;
});
dialog.AddButton(
Localization.GetForView("RecentThreads", "DontClear"), () => { });
ClearConfirmationDialog = dialog;
}
示例2: ShowTwoOptionsDialog
/// <summary>
/// Shows a dialog with two options to choose from
/// </summary>
/// <param name="text"></param>
/// <param name="leftButtonText"></param>
/// <param name="rightButtonText"></param>
/// <param name="leftButtonAction"></param>
/// <param name="rightButtonAction"></param>
/// <returns></returns>
public static IAsyncOperation<IUICommand> ShowTwoOptionsDialog(string text, string leftButtonText, string rightButtonText, Action leftButtonAction, Action rightButtonAction)
{
var dialog = new MessageDialog(text);
dialog.AddButton(leftButtonText, leftButtonAction);
dialog.AddButton(rightButtonText, rightButtonAction);
dialog.DefaultCommandIndex = 1;
return dialog.ShowAsync();
}