[UWP]单键MessageDialog

编程入门 行业动态 更新时间:2024-10-10 23:15:30
本文介绍了[UWP]单键MessageDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的App.xml.cs中只有一个按钮就有一个MessageDialog 我希望从其他页面使用它。 有几种方法似乎有效,但由于异步和任务有微妙之处是特定的一种吗?

I have a MessageDialog with just a single button in my App.xml.cs I wish to use it from other pages. Several approaches seem to work but as there are subtleties with async and Tasks is a particular one correct? 推荐答案

大多数开发人员(和开发人员工具)会建议静态版本,但从异步/任务的角度来看,两者之间没有技术差异。请记住在通话中使用 await - 无论实施如何。否则,打开对话框的代码将在对话框打开时继续。因此,对静态方法的调用应该是:

most developers (and developer tools) will advice the Static version, but from an async/task perspective there is no technical difference between the two. Please remember to useawaitin the call - regardless of the implementation. Otherwise the code that opens the dialog continues while the dialog is open. Therefor the call to the static method should be:

await App.mymessagebox("A message");

更多推荐

[UWP]单键MessageDialog

本文发布于:2023-08-06 14:40:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1313032.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单键   UWP   MessageDialog

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!