通用 Windows 平台 (UWP)
一个 Microsoft 平台,用于生成和发布适用于 Windows 桌面设备的应用。
29 个问题
你好
您可以参考文档启动文件的默认应用程序,选择文件打开方法,选择记事本打开txt文件。
async void DefaultLaunch()
{
// Path to the file in the app package to launch
string imageFile = @"images\test.png";
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
if (file != null)
{
// Set the option to show the picker
var options = new Windows.System.LauncherOptions();
options.DisplayApplicationPicker = true;
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(file, options);
if (success)
{
// File launched
}
else
{
// File launch failed
}
}
else
{
// Could not find file
}
}
谢谢。
如果答案是正确的,请点击“接受答案”并点赞。 如果您对此答案还有其他疑问,请点击“评论”。 注意:如果您想接收电子邮件通知,请按照我们的文档中的步骤启用电子邮件通知 此线程的相关电子邮件通知。