views:

809

answers:

5

The System.Diagnostics assembly is part of the Silverlight CLR framework, but it only includes classes related to debugging, the Process class is not available. Is there any other way to start an outside process from a Silverlight application?

+3  A: 

Being able to start another process would break the Silverlight model, allowing your application access to the machine outside the browser sandbox.

Why do you want to start another process?

ChrisF
This might be useful if you are running your app out of browser and want to launch something on the client, I imagine the user would have to grant permission to perform an action like this however.
Crackerjack
@Crackerjack - Out of browser applications are still sandboxed (from what I've read), you might be able to do this with full trust applications in SL4 - but I've not looked at this aspect yet.
ChrisF
A: 

If you are using Silverlight inside an ASPX page you could use HtmlDocument.Window.Invoke to call a JavaScript function which could in turn call a static method within your page (using WebMethod attribute)

The article here describes the JS/ASPX bridge well.

Kindness,

Dan

NB: Not sure I agree with what you are trying to do; just want to help you do it :)

Daniel Elliott
+2  A: 

Using an elevated trust out of browser app (shall we coin ETOOB or OOBET for short) Silverlight 4 application you may be able to start a new app in a new process if it is a COM Automation server. For example:-

dynamic excel = ComAutomationFactory.CreateObject("Excel.Application"); 

Should fire up Excel in its own procress.

AnthonyWJones
A: 

There is no short answers, but there is a complex one...

If you are runnign SL4 Out-Of-Browser, and you indicated that you are ok running elivated (which really mean SL doesnt run in IE-Protected mode, but rather as standard app...) there is a way for you by using WMI to basically do ANY THING you want to. This blog post will help you - http://justinangel.net/CuttingEdgeSilverlight4ComFeatures . Just keep in mind, this is high end fancy coding, so watch yourself ;)

There are two great sample chapters on Windows Phone and Silverlight for Windows Phone on the LearningWindosPhone.com site. There is great Windows Phone Trainng material , and dont forget the Windows Phone Develoeprs Blog

Yochay Kiriaty
A: 

Yes, you can in Silverlight 4 (in out-of-browser with elevated full trust), example:

dynamic cmd = AutomationFactory.CreateObject("WScript.Shell");
cmd.Run("calc.exe", 1, true);
Shurup