Open application from Universal Windows(UWP) - c#

So for our project, we have this app that's in the Windows Store. It is a Unity UWP app. At some point, we want to check if program X is installed on the user's machine. If yes, we want to launch it, if no we want to provide the user with a download link (or whatever.)
The app we want to launch, however, is a Unity standalone app. The user can download it from our website.
I tried multiple things. PlayerPrefs, Register checking etc. None of these really work. Register checking turned out to work decently well, but that only works between standalone apps. UWP apps seem to have no access to the Register.
Which left me thinking about URIs etc. But, I'm a complete noob regarding all of this and I have no clue how or where to start. Any help or direction is highly appreciated.
Ideal scenario:
User downloads our app from the Windows Store
Users click a button within our app
Our app checks the user's system for App X
If App X is installed, we launch it, if not we do something else
App X opens.

The UWP app cannot interact with the standalone Unity app directly.
You can write another standalone desktop “helper” app that does the actual work of checking the registry and launching the Unity app, and then make this “helper” app part of the UWP package and resubmit the package to the Windows Store.
Keep the “helper” app as simple as possible so it doesn’t have other dependencies.
Use FullTrustProcessLauncher to launch the helper app when the user clicks the button.
And the UWP app needs to have runFullTrust capability in order to use FullTrustProcessLauncher.
runFullTrust is a restricted capacity and when you submit the app to the Windows Store it is required for you to specify the reason why the capacity is necessary for your app. See this answer for more details.

Related

Detecting programmatically whether a specific UWP app is installed on system

Without going through Windows Registry, is there a quicker way to detect programmatically whether a specific Universal Windows Platform (UWP) app is installed on a system? App will be installed through Windows Apps Store and its installation need to be verified from a Winform program written in C#. But the language doesn't matter.
You should be able to use PackageManager.FindPackage or PackageManager.FindPackageForUser to see if the target package is available universally or for the specific or current user.
See Calling Windows 10 APIs From a Desktop Application for info on how to call this from your WinForms app.
Also check out the Enumerate app packages by user SID sample which demonstrates enumerating app packages from a C# console app. The project used is out of date (it's for VS2013), but the overall code flow should still work.
Depending on your specific scenario (why do you need to know this and what will you do with that information?) there may be better ways for your specific use case. For example: you asked elsewhere about launching a UWP app. If you define and launch a protocol for the app you don't need to check if it's already there first as the protocol launch will offer to look for the app in the store if it's not installed.

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.

Launch Windows Explorer from Metro style app

I would like to download a file to the DownloadsFolder in a Windows Store App. And then I'd like to bring up a Windows Explorer open on the DownloadsFolder (actually on the folder I create in the DownloadsFolder)
But I can't figure out how to do it.
This stackoverflow question Launching a Desktop Application with a Metro-style app suggests using Launcher.LaunchUriAsync. But the documentation claims:
You cannot use this method to launch a URI in the local zone. For example, apps cannot use the file:/// protocol to access files on the local computer. Instead, you must use the Storage APIs to access files.
And indeed, I was trying to use the "file:" protocol to bring up the explorer window. When I did try this mechanism Launcher.LaunchIUriAsync fails.
If the browser can do this, why can't I?
Is there a way for me to bring up windows explorer, or is that outside the real of possibility?
I don't think you can launch the Windows Explorer from metro. One thing you can use, however, is the File Picker.
http://code.msdn.microsoft.com/windowsapps/File-picker-app-extension-0cb95155
If you're willing to have some non-Windows Store components in your solution, there is a workaround for this. Although you can't launch a process directly, you can always run a HTTP listener inside a Windows service which listens for commands from your sandboxed Windows Store (Metro-style) app and launches Explorer (or any other process) for you. A trivial way to do this would be a Web API service inside a Windows service - just implement the GET action in your controller and have arguments for the executable to launch and optionally executable arguments as well.
This is kind of doing an end-run around the sandbox security, though, so you might want to have a tailored Web API instead which just launches a pre-packaged set of apps (like Explorer or one of your own apps).
Of course, for consumer apps this is not a good solution because you can't just install everything from the Windows Store. For LOB apps, though, it's not a bad compromise because you typically have more control over the environment. This is a good way to surface some metrics or other data into a live tile and have your desktop app launch when the tile is clicked. Whether or not this makes for a good user experience is a totally different conversation.
BatRT allows you to run batch file commands from WinRT applications. It utilizes URI calls. This can be used to open up applications or perform file operations.

WinRT - Start an application on Windows boot?

I'm working on a Metro style application in the new WinRT (.NET 4.5) framework for Windows 8, and I was wondering if it would be possible somehow for an application (through the registry or some other means) to register itself to start up when Windows starts as well.
I haven't been able to find anything about this anywhere else, only for Windows 7 or below, with normal-style applications.
There is no way to make a Metro style application launch at boot. The user will have to invoke the application from the start screen. Metro style applications cannot be services and so launching them at boot time doesn't seem like the right approach any more than launching Microsoft Word or Adobe Photoshop at boot time would be.
Microsoft's goal with Metro-style apps is that the user is always in control. Therefore, Metro-style apps cannot activate themselves when a machine boots up. Furthermore, traditional Win32/.NET desktop code cannot interact with Metro-style apps and so cannot start a Metro-style app behind the scenes.
That said, if your app has registered itself as the handler for the rendering of its own tile, then it gets called periodically and is asked to re-render its tile's content so it should always be able to show its latest status/news/info to the user when they view their start page.
I think you could have all your star tup stuff running as a service that exposes the appropriate WinRT level connectivity. Then the user only needs to fir up the client app.
Goo separation too.

Application on windows startup C#

i have designed an application which validates users against online database and then allow users to work, after authentication it shows desktop, it loads on startup.
i would like to start my login application at windows start up, i have added my login application path to registry it is started well with windows. but it has one issue
first windows desktop appears few seconds and then my login application loaded
i would like to show my application before windows desktop
or
any other way to use windows login to validate user against online server database and then allow users to work.
If you don't want the desktop to show at all you can run your application as the Windows Shell.
You use this registry key
[HKEY_LOCAL_MACHINE\SOFTWARE\Micro­soft\Windows NT\CurrentVersion\Winlogon]
"Shell"="C:\\WINDOWS\\explorer.exe­"
The other solution is to use XP Embedded Standard so you can totally customise the Windows experience. Takes a lot more work than the simple shell replacement though, but much more robust
You could replace the shell as above, then have your application launch explorer.exe when you were ready to have the start menu and taskbar show up...

Categories

Resources