Launching windows 10 store apps - c#

I am looking for a way to launch/run windows store apps on windows 10/8.1 from C#.
Examples of the apps I am trying to run are
Calculator
Photos
Settings
Note: in Windows 10 these are no longer standard .exe files that can be executed by double clicking or calling Process.Start() as they are now windows store apps.
I have tried to use IApplicationActivationManager but I cannot find decent documentation with examples of how to use it.

There are several ways to do it. The easiest way is to use Process.Start and the URL or file handlers.
For example this will open the Video app:
Process.Start("microsoftvideo://");
Or the Store on the updates page:
Process.Start("ms-windows-store:updates");
Or the Photos app:
Process.Start("ms-photos://");
There are several more handles, some of them can you find here. You can find the names when you open the registry key HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId. Look for the CustomProperties key. It has an attribute Name. That is the one to use.
Some other useful pointer can be found on SU: How do I run a Metro-Application from the command-line in Windows 8?.

I found a cool way to run every Windows Universal apps which downloaded via Windows Store or preinstalled.
Each Windows 10 Universal app has an AUMID which stands for 'Application User Model ID'.
PowerShell Command to get all AUMID:
get-StartApps
Output:
PS C:\> get-StartApps
Name AppID
---- -----
Skype Microsoft.SkypeApp_kzf8qxf38zg5c!App
Snip & Sketch Microsoft.ScreenSketch_8wekyb3d8bbwe!App
Mail microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w...
Calendar microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w...
Movies & TV Microsoft.ZuneVideo_8wekyb3d8bbwe!Microsoft.ZuneVideo
OneNote for Windows 10 Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim
Photos Microsoft.Windows.Photos_8wekyb3d8bbwe!App
Video Editor Microsoft.Windows.Photos_8wekyb3d8bbwe!SecondaryEntry
Maps Microsoft.WindowsMaps_8wekyb3d8bbwe!App
Alarms & Clock Microsoft.WindowsAlarms_8wekyb3d8bbwe!App
Voice Recorder Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App
Feedback Hub Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe!App
Xbox Game Bar Microsoft.XboxGamingOverlay_8wekyb3d8bbwe!App
Camera Microsoft.WindowsCamera_8wekyb3d8bbwe!App
Microsoft Store Microsoft.WindowsStore_8wekyb3d8bbwe!App
Weather Microsoft.BingWeather_8wekyb3d8bbwe!App
Cortana Microsoft.549981C3F5F10_8wekyb3d8bbwe!App
Instagram Facebook.InstagramBeta_8xx8rvfyw5nnt!Instagram
...
So now, you can start any universal app via its AUMID like this:
explorer shell:appsfolder\[AUMID]
For example, if you want to execute Skype:
explorer shell:appsfolder\Microsoft.SkypeApp_kzf8qxf38zg5c!App
Now it's the time to back to Csharp:
Process.Start("explorer shell:appsfolder\Microsoft.BingWeather_8wekyb3d8bbwe!App");
The Windows Weather App will execute.

Related

how to get open window store app using C# windows application and get uwp installed list

how to open windows stores app uwp app using C# windows application
How to open a windows stores app using C# windows application
using Process.Start("");
How to open any voice command like cortana ?
not sure you can link to the exe since it's a UWP app but fortunately it supports protocol activivation so causing this to work
Process.Start("ms-windows-store://");
Regarding #2,
To build skills (in US markets in English, including Cortana) start here:
botframework then skills kit
If you don't want to build skills but just want STT/TTS, start here:
Bing Speech

how to get list of all installed apps and run them in UWP WinRT 8.1

I'm actually creating an UWP 8.1 app for one of my client.And I've got some little issue with it.At some point of my app I've to get all the names of installed app in the device and view it as a list.When the user will click on any of them, I've to launch that certain app.
I've already tried to add restricted capabilities in the app manifest but it shows a blue line when I add,
Morever I can get access to the AppData/Packages by using folderpicker somehow but don't know what to do.
The app is for WinRT surface 3 and it isn't going to store or anything it has only one user. So if anyone know any sort of solution please let me know.
The PackageManager class has the methods to enumerate all installed apps.
However, in 8.1 the PackageManager can only be used in desktop apps (e.g. WPF, Winforms, Win32). It cannot be used from a Store app on that version of the operating system.
On Windows 10 you can use the class from both Store/UWP apps as well as classic desktop apps.

UWP app start automatically at startup

All is in the title, I currently searching a way to launch my UWP app automatically at Windows startup with the UWP framework only, no file manipulation on the machine. The application must be able to be shared on the Store AND open when Windows starts.
Is it a feasible thing? If so how?
Thank you!
#hsmiths wrote easist solution to start app automatically and I'd like to summarize in step by step.
Open File Explorer
In address bar, copy-and-paste shell:AppsFolder
Right-click the app and then click Create Shorcut.
The message box asks to create shorcut on the Desktop. Click Yes.
In File Explorer address bar, copy-and-paste shell:startup
Go to Desktop and copy-and-paste shorcut to File Explorer.
Reboot your computer if you want to test.
+Tip: if you want to by-pass login dialog on Windows startup.
Start > Run
type control userpasswords2
User Accounts window will be opened. Uncheck Users must enter a user name ...
When you click OK, you will be asked to enter account password. Type password.
Reboot your computer if you want to test.
It seems that MS will add this feature - windows.startupTask - not only for converted desktop apps, but also UWP apps.
You can see it from about 37:00
Tip, tricks, and secrets: Building a great UWP app for PC
But this feature is not ready yet - It'll be available with Windows 10 Fall Creators Update.(I've tried with SDK 16225 but not ready yet)
Added 12/18/2017 - You can do it with Win10 Fall Creators Update.Following post show the details.
Configure your app to start at log-in (Windows Blog)
One consideration point is: By the feature, you can just 'start' the app - the app window is not shown. To see the app window, the user should click the app task at the task bar. It's a slightly ridiculous implementation for me. From the view of customer, 'click to start' and 'click to activate' is same behavior. You can do the some task in background before the user activate the app, but this is an another story.
If it's a desktop application converted to UWP you can declare a startup task in your appmanifest like this:
<desktop:Extension Category="windows.startupTask" Executable="bin\MyStartupTask.exe"
EntryPoint="Windows.FullTrustApplication">
<desktop:StartupTask TaskId="MyStartupTask" Enabled="true" DisplayName="My App Service" />
</desktop:Extension>
See Converted desktop app extensions
You can on Windows 10 (I'm not sure about Windows 8 or earlier versions), here's the instructions from Microsoft:
https://learn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-a-background-task
Even in Windows 10 IoT you can set an app to autostart through a PS command:
[192.168.0.243]: PS C:\> iotstartup list MyBackgroundApp
You can create a .bat script that execute "start AppID!App"
"AppID!App" string is available in shell:AppsFolder view, you have to add the given column.
Then place the .bat file in the startup folder:
"shell:startup" for the given user,
"c:\windows\system32\GroupPolicy\User\Scripts\Logon" for all the users of the given computer
I think that is not possible, but maybe you can use a trigger in order to activating a background task when something happen..
Here's a list of the available triggers:
SystemTrigger
MaintenanceTrigger
TimeTrigger
PushNotificationTrigger
NetworkOperatorNotificationTrigger
NetworkOperatorHotspotAuthenticationTrigger
However you have some constraint.. take a look here: http://blogs.msdn.com/b/windowsappdev/archive/2012/05/24/being-productive-in-the-background-background-tasks.aspx

Launch my app in background using voice commands from Cortana

I modified my Windows Phone 8.1 application (universal app with just the Windows Phone project live yet) to have a VoiceCommandDefinition (VCD) file in place and this works fine to start my app in foreground mode and handle parameters.
But I want to let my app quickly answer some app specific questions like it is described in this blog for Windows 10. I have tried to apply this blog but the app manifest modification fails. It does not know the:
uap:AppService
When I looked it up, it seems to be available for Windows 10 only. So I searched up the internet mainly MSDN and stack overflow, but I could only find examples that run the app in foreground.
Does anyone know an example how to provide answers to the Cortana content page with a background service?
Only App service can meet your requirements.
But App service is new in Windows 10, so you cannot use uap:appservice in Windows Phone 8.1 application. You can see App to app communication video from 26th minutes which introduce the app service.
So you can use universe windows app to develop. Sample is Cortana voice command sample as you see in that blog.

Get process info (window title) by process ID

Quick question ... Microsoft removed support for Process class in Metro Apps. How to get Window title of known Process ID?
I literally Google'd the whole internet for answer without success :/
Microsoft has not supported the Process class in Windows Store apps.
Windows Store Apps are not supposed to have that kind of access, unlike desktop apps. Besides, if you have Windows RT and you're running a Metro App that uses the Process class, you're not going to be able to because Windows RT does not run desktop apps.
Sorry to disappoint you, but if you need to do that, create a desktop app (not able to run on Windows RT).
P.S. They're called Windows Store apps now (not Metro) due to a lawsuit.

Categories

Resources