本文整理匯總了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();
}