C# (WinRT): ダイアログの表示

AlertDialogPage

xaml: AlertDialogPage.xaml

<Page
    x:Class="Snippets.AlertDialogPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Snippets"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid x:Name="grid" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Button Content="Open Alert" HorizontalAlignment="Left" Margin="24,23,0,0" VerticalAlignment="Top" Click="Button_Click_1"/>

    </Grid>
</Page>

C#: AlertDialogPage.xaml.cs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Popups;

namespace Snippets
{
    public sealed partial class AlertDialogPage : Page
    {
        public AlertDialogPage()
        {
            this.InitializeComponent();
        }

        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            UICommand itemOK = new UICommand("OK", new UICommandInvokedHandler(this.CommandInvokedHandler));
            UICommand itemCancel = new UICommand("Cancel", new UICommandInvokedHandler(this.CommandInvokedHandler));
            UICommand itemOther = new UICommand("Other", new UICommandInvokedHandler(this.CommandInvokedHandler));
            MessageDialog dialog = new MessageDialog("Hello World.", "Alert Dialog Test");
            dialog.Commands.Add(itemOK);
            dialog.Commands.Add(itemCancel);
            dialog.Commands.Add(itemOther);
            await dialog.ShowAsync();
            
        }

        private void CommandInvokedHandler(IUICommand command)
        {
            System.Diagnostics.Debug.WriteLine(command.Label);
        }
    }
}