我想开发一个应用程序,从地铁应用程序使用启动类启动一个常规的.exe应用程序。 MSDN提供了一个样本here和一个计算器样本是hereC#启动与地铁api外部应用程序
问题是,我的地铁给出了“找不到文件”的错误,即使文件存在。我试图把文件上的其他驱动器,但问题仍然存在
这里是我的代码示例
// Path to the file in the app package to launch
string imageFile = @"E:\App.exe";
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
/*错误在上面的线。它说找不到文件的文件名,目录名,或卷标语法不正确。 (来自HRESULT的例外:0x8007007B)*/
if (file != null)
{
// Launch the retrieved file
var success = await Windows.System.Launcher.LaunchFileAsync(file);
if (success)
{
// File launched
}
else
{
// File launch failed
}
}
else
{
// Could not find file
}
我也试过它在同一个地方的JPG文件,但没有解决 – Umair
尝试使用Windows.Storage? http://msdn.microsoft.com/en-us/library/windows/apps/hh967755.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1 – KingCronus