[UWP] MFC的CDialog :: DoModal()和UWP的ContentDialog.ShowAsync()之间的区别 [英] [UWP]Difference between MFC's CDialog::DoModal() and UWP's ContentDialog.ShowAsync()

查看:87
本文介绍了[UWP] MFC的CDialog :: DoModal()和UWP的ContentDialog.ShowAsync()之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!


如果我在桌面MFC应用程序中使用CDialog :: DoModal显示模式对话框(),保证在我执行
CDialog :: DoModal()调用之后和关闭对话框之前,单击应用程序工具栏中的按钮。但目前尚不清楚,我们是否可以说明UWP的

ContentDialog.ShowAsync()
?我应该在用户点击某个应用程序栏按钮时处理这种情况,例如,在我调用

ContentDialog.ShowAsync()
屏幕上出现对话框并阻止了主窗口?

我目前的C ++代码
游戏选项按钮处理程序:

 void OpenGLESPage :: GameOptions_Click(Platform :: Object ^ sender,Windows :: UI :: Xaml :: RoutedEventArgs ^ e)
{
GameOptionsDialog ^ dialog = ref new GameOptionsDialog();

dialog-> SetParams(...);

dialog-> ShowAsync();
}


如果一些快速用户能够在一纳秒内点击
游戏选项按钮两次?

解决方案

所以我尝试了你的场景:显示一个模态对话框并在操作栏中点击一些东西,大致同时用双手点击,按钮点击和对话框都没有运行,所以我认为可以安全地说这些情况由UI调度员自动处理


您也可以手动或使用UI编码测试自行测试。


Hello!

If I show a modal dialog in a desktop MFC application with CDialog::DoModal(), it is guaranteed that no button in application toolbar, for example, can be clicked after I made CDialog::DoModal() call and before the dialog is closed. But it is not clear a bit, can we state the same about UWP’s ContentDialog.ShowAsync()? Should I handle the situation when the user clicked some application bar button, for example, after I called ContentDialog.ShowAsync() but before the dialog appeared on the screen and blocked the main window?

My current C++ code of Game Options button handler:

void OpenGLESPage::GameOptions_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
	GameOptionsDialog ^ dialog = ref new GameOptionsDialog();

	dialog->SetParams(...);

	dialog->ShowAsync();
}

what if some rapid user is able to click Game Options button two times within a nanosecond?

解决方案

So I just tried your scenario: show a modal dialog and tap something in the action bar, roughly at the same time, using both hands, and neither the button click nor the dialog got to run, so i think it is safe to say these situations are handled automatically by the UI dispatcher.

You can also test this yourself manually or using a UI coded test.


这篇关于[UWP] MFC的CDialog :: DoModal()和UWP的ContentDialog.ShowAsync()之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆