Пример C ++ / winRT xaml ContentDialog - PullRequest
0 голосов
/ 16 января 2019

Документация показывает этот фрагмент C #:

async void DisplayDeleteFileDialog(){
    ContentDialog deleteFileDialog = new ContentDialog{
        Title = "Delete file permanently?",
        Content = "If you delete this file, you won't be able to recover it. Do you want to delete it?",
        PrimaryButtonText = "Delete",
        CloseButtonText = "Cancel"
    };

    ContentDialogResult result = await deleteFileDialog.ShowAsync();

    // Delete the file if the user clicked the primary button.
    /// Otherwise, do nothing.
    if (result == ContentDialogResult.Primary) {
         // Delete the file.
        }
    else {
         // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button.
         // Do nothing.
        }
    }

Я запрашиваю версию этого фрагмента на C ++ / winRT.

1 Ответ

0 голосов
/ 16 января 2019
IAsyncAction Async()
{
    ContentDialog dialog;
    dialog.Title(box_value(L"title"));
    dialog.Content(box_value(L"content"));
    dialog.PrimaryButtonText(L"primary");
    dialog.CloseButtonText(L"close");

    auto result = co_await dialog.ShowAsync();

    if (result == ContentDialogResult::Primary)
    {

    }
}
...