在Silverlight OOB模式中可以調用其它程序,方式如下:
1.系統中引入Microsoft.CSharp.DLL
2.程序:
dynamic cmd = AutomationFactory.CreateObject("WScript.Shell");
cmd.Run(@"對應的程序", 1, true);
2.1調用網址:
dynamic cmd = AutomationFactory.CreateObject("WScript.Shell");
cmd.Run(@"http://www.badu.com", 1, true);
2.2調用普通Exe文件
dynamic cmd = AutomationFactory.CreateObject("WScript.Shell");
cmd.Run(@"notepad.exe" 1, true);
2.3調用別的Silerlight OOB模塊
我自己寫了一個ProgStart程序,代碼如下:
[csharp]
namespace ProgStart
{
class Program
{
static void Main(string[] args)
{
string ext = args[0];
string para="";
if (ext.ToLower() == "sllauncher.exe")
{
ext=@"C:\Program Files\Microsoft Silverlight\"+ext;
}
if (args.Length > 1)
{
para = args[1];
}
Console.WriteLine(ext+","+para);
Process.Start(ext, para);
}
}
}
將ProgStart.exe放在Windows目錄中
調用代碼如下: www.2cto.com
dynamic cmd = AutomationFactory.CreateObject("WScript.Shell");
cmd.Run(@"ProgStart.exe sllauncher.exe 3559137000.localhost", 1, true);