gpt4 book ai didi

c++-winrt - C++/winRT xaml ContentDialog 示例

转载 作者:行者123 更新时间:2023-12-02 20:08:04 32 4
gpt4 key购买 nike

文档显示了这个 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 版本。

最佳答案

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)
{

}
}

关于c++-winrt - C++/winRT xaml ContentDialog 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54209679/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com