本文介绍了启动一个Metro风格的应用程序在桌面应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有在Windows 8推出从Metro风格应用程序的桌面应用程序的方法吗?我试图创建一些简单的快捷方式,桌面应用程序来代替开始屏幕上的桌面图标,这看出来的地方。
我只需要在C#中的东西超级简单,preferably,尽快打开一个应用程序的应用程序加载。我打算使这些快捷方式一些游戏,软件,等等,没有什么我做我自己。他们还只是供个人使用的,所以我可以使用应用程序的直接路径,如C:\\ Program Files文件(x86)的\\蒸汽\\ steamapps \\ COMMON \\天际\\ TESV.exe
解决方案
如果您只是想运行像(记事本,写字板,IE浏览器等)的桌面应用程序,然后通过的并的
尝试
{
//启动子进程。
进程p =新的Process();
//重定向子进程的输出流。
p.StartInfo.UseShellExecute = FALSE;
p.StartInfo.FileName =C:\\路径\\为\\ APP.EXE
p.Start();
}
//实验2
//使用的ProcessStartInfo类来开始新工艺,
//都以最小化模式。
无效OpenWithStartInfo()
{
的ProcessStartInfo的StartInfo =新的ProcessStartInfo(IEXPLORE.EXE);
startInfo.WindowStyle = ProcessWindowStyle.Minimized; 的Process.Start(StartInfo的); startInfo.Arguments =www.northwindtraders.com; 的Process.Start(StartInfo的);
}
Check this:
Can I use Windows.System.Launcher.LauncherDefaultProgram(Uri) to invoke another metro style app?
Ref: How to launch a Desktop app from within a Metro app?
Try this - I have not test yet but may be it will help you..
// Path to the file in the app package to launch
string exeFile = @"C:\Program Files (x86)\Steam\steamapps\common\Skyrim\TESV.exe";
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(exeFile);
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
}
}
这篇关于启动一个Metro风格的应用程序在桌面应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!