c# - How to execute Process commands (or similar) using a Universal Windows Platform (UWP) App? -


i'm working on creating custom cortana commands. commands registered , executed using universal windows platform application. (github)

for instance, i've registered following command

<command name="shutdown">         <listenfor>shut down</listenfor>   <navigate/>     </command> 

to run function in uwp application

static async void shutdown() {     var dialog = new messagedialog("this shut computer down.");     await dialog.showasync();     //system.diagnostics.process.start("shutdown", "-s -t 10"); } 

but after setting learned system.diagnostics.process isn't supported in uwp.

the custom commands want run involve sort of execution such launching external programs, running other scripts, or opening websites.

it makes sense uwp doesn't support them given it's universal , xbox or phone might not able these, hoping there alternative or hacky way accomplish on windows 10 pc.

is there way me execute process commands or else similar functionality in uwp application? seems though can cortana execute c# code, uwp doesn't support useful in situation.

thanks in advance.

there - limited - ways achieve similar behavior.

  1. you use launchuri trigger other apps registered uri-scheme. should work webbrowser scenario. more details here: https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.launcher.launchuriasync.aspx

  2. you trigger app , results using launchforresults. called app has support this. more details here: https://msdn.microsoft.com/en-us/library/windows/apps/mt269386.aspx

  3. you trigger app services provided app. called app has support this. app service executed in background. ( think pretty cool.) more details here:http://blogs.msdn.com/b/mvpawardprogram/archive/2015/06/11/writing-windows-10-app-services-in-javascript.aspx

  4. this little hacky: i'm not sure if still works did work windows 8.1: create called "brokered component". allows trigger app on machine, won't able publish brokered component store. allowed process.start() on windows 8.1. worked sideloaded apps. i'm not sure if still works on windows 10. more info here: https://msdn.microsoft.com/en-us/library/windows/apps/dn630195.aspx

summary: starting app pretty easy long target app registered app service or registered protocol handler (uri scheme). starting scripts or other *.exe impossible if option 4 doesn't work longer.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -