Invoking desktop app from Windows Store app - c#

I have a Windows form desktop application developed using c#. I want to make use of the live tile feature available in WinRT apps (especially for Windows 10). The data in the live tile is to be fetched using WMI queries (Win32_LogicalDisk).
How do I accomplish this? I don't want to rewrite the entire app. Live tiles should update on the background and on clicking the tile, my desktop app exe needs to be invoked. Is it possible to fetch WMI data and invoke exe from Windows Store apps?
I tried using Brokered Windows Runtime components as given in http://blogs.msdn.com/b/dmx/archive/2014/04/30/how-to-trigger-a-desktop-process-from-windows-store-apps-the-easy-way-using-the-brand-new-visual-studio-templates.aspx . But could not get it to work as I get a 'TypeLoadException'.
Thanks in advance.

Metro app can't run a desktop app. However, they can commumicate using wcf. So, you can create tiny windows service that will open wcf host. Then you create windows store app with your live tile(s). When windows service recieves a wcf call, it starts the desktop application.
There is also devexpress' solution that is capable of adding live tiles for desktop apps, however it is not free: https://www.devexpress.com/Products/NET/Controls/WinForms/Live-Tile-Manager/

WinRT blocks network loopback so wcf won't work. You can disable this for testing but I suspect that won't satisfy you. Read more here (and search for WinRT network loopback to find articles on this topic).
https://msdn.microsoft.com/en-us/library/windows/apps/Hh780593.aspx

Related

UWP and Unpackaged Desktop App Communication

I'm attempting to develop an Xbox Game Bar Widget, which obviously needs to be UWP. I need it to communicate with my separate unpackaged desktop app. The regular desktop app has to be unpackaged because it requires admin rights in order to read CPU temperatures.
I've tried using Named Pipes as the Microsoft Docs page suggests, but I'm having issues creating/connecting the pipes on the UWP side. I just keep getting Access Denied exceptions. I've had trouble finding information/examples on interprocess communication between UWP and unpackaged apps. Any direction / advice is much appreciated.

Communication channel between a windows app and UWP app

I have a uwp project and a windows app (net5).
Both are installed in the same machine (same will happen in production), but the uwp is installed using sideloading, not on windows store.
The windows app gets some data by listening to a wss port. I have to pass those data from the windows app to the uwp app and also wait for a response back from it.
To do this internal communication I came across the AppServiceBridgeSamples in this repo https://github.com/microsoft/DesktopBridgeToUWP-Samples but it is outdated and I can't use it.
Is there any alternatives to it? What would be the easiest implementation to achieve this?
Any suggestions/comments are appreciated.
Currently, the general way to implement a communication channel between a UWP app and a windows app is by using App service. This is not outdated. If you don't want to use the App service, you have to build your own socket server so that both of your apps could communicate with it. Another way is that your windows app could save the data in a local file and load them in the UWP app.

Is it possible to have a windows desktop app with metro interface (or a metro app with no intention of going to the windows store)?

Apologies for the noobish question, and I did try to search but couldn't find the right answer (or didn't search properly).
Currently have an app developed in a windows desktop environment because it gives us access to deeper features of the PC such as serial port comms etc. that the normal metro environment wouldn't allow. We're currently developing the UI based on metroUI so we can run it on an 8.1 touchscreen (metroUI looks good, gives us a touch-screen experience with PC features) but we have no intention of putting it on the marketplace.
Just wanted to confirm if this is in fact doable, and we can have this desktop application with a metro UI? Or is my noobishness meaning I'm overlooking some technical feasibility that makes it impossible?
This is doable with the Windows 8.1 Update (from April 2014). It's not supported before that since Windows Store apps were blocked from communicating with desktop processes.
The Windows 8.1 Update adds a feature "Brokered Windows Runtime Components" designed to allow side-loaded Windows Store apps to communicate with a desktop back-end. This will allow your Windows Store app UI to call the desktop component to access API that aren't available in the limited app package environment.
See Brokered Windows Runtime Components for side-loaded Windows Store apps for details.
See Try It Out: Sideload Windows Store Apps on TechNet for how to enable side-loading on your systems. See Windows 8.1 Update: Sideloading Enhancements for updates on how to enable a system for sideloading (no license required when on a domain, and significantly easier to get a sideloading license for non-domain joined systems).
The developer license system is designed for development and test purposes only. You really don't want to use it for production. Use the proper enterprise side-loading system instead.
From my understanding, the whole point here is to make it look like a Windows Store app. If you're app is a WPF one, you can already use Mahapps.metro.
You can create a Windows Store app without going to the store by Sideloading it. You create an app package first. The user has to right click the .ps1 file in that package to see the option Run with PowerShell and install it in a very old fashioned DOS like manor. It will only run when the user has a Microsoft Developer License and renew it every month. However, it is not allowed to keep using a Developer License of the end user to run a Store app. In the end, the system has to be domain bound to be allowed to run these apps, or you have to buy a Enterprise Sideloading key. These come in packages of 100 for $ 3000,- or you can unlock all PC's for 1 client for $ 100-.
It would be nicer if the specific pros of a Store program were available in a desktop environment but with W10 coming up I do expect a bit more integration and less restrictions.
Hope this answers your question.

Is there a possibility to start another App or Program from a Windows 8 Store App (C#)

I want to start another App or Program from my Windows Store App. For example my App is showing emails, so if someone clicks on such an email Outlook should open. Is this possible in an "App-Sandbox"?
It is not possible to just launch an arbitrary application, but with custom protocol activation you can launch an app that handles that protocol and if it is not installed - the OS will ask the user to install it. It means that if you can define a custom protocol in your app - you can launch it from another app with this protocol assuming no other app registers to handle it. An example of that is any XBOX Live app - if you check their manifest files - they all handle custom protocols.
If your specific question is about launching a specific app by name or location then no, this is not possible, but if you know a protocol handled by the app you want to launch - you can try using that - just bear in mind that there might be other apps that handle that protocol.
Short answer: no, it's not possible.
You can open files with their associated application but not spawn any arbitrary external process.
As #mitch-wheat pointed out, that's why it's called a sandbox.
Check out this sample
The sample is for Windows 8.1 but I think will work for Windows 8 as well.

Waking the computer in Windows Store apps

How can we wake the computer from standby, sleep and/or hibernate in a Windows 8 metro-style application?
I have tried using the code I had for my old Winforms and WPF apps and even read and tried many tutorials online but nothing works. Also when searching for this there appears to be no results pointing to any kind of documentation.
Windows RT does not expose such low level API if i am correct. Windows Store apps are for simple easy to use - mainly consumption apps.
You can however couple your windows store app with a ful windows app (desktop / traditional app) that your windows store app communicates with (WCF etc). The traditional app can do all it did before.
the only downside is that you cannot install your traditional app on Windows RT

Categories