使用拆分应用程序和网格应用程序模板
在开发应用程序时,有许多实用的模板可以帮助我们快速搭建项目结构。其中,拆分应用程序模板和网格应用程序模板是两个非常实用的Visual Studio应用程序模板,下面我们将详细介绍它们。
1. 启动文件相关代码
以下代码用于启动文件并设置相关选项:
options.UI.PreferredPlacement = Placement.Below; options.UI.InvocationPoint = popupLocation; bool success = await Launcher.LaunchFileAsync(file, options); // --- Handle launch status } // --- Handle file issues这段代码将DisplayApplicationPicker属性设置为true,这会使“打开方式”选择对话框弹出。在该对话框中,你可以选择用于打开指定文件的应用程序。PreferredPlacement属性被设置为Placement.Below,因此InvocationPoint属性会被视为选择对话框的左上角位置,此位置是根据用于运行此代码片段的按钮(StartOpenWithButton)的位置计算得出的。