This headline really made me feel the egg hurts. I don't know what to call Microsoft's name-changing maniac.
This is the process by which your desktop program interacts with the Windows Store app.
For some reason, Microsoft's Store app's security sandbox has led to a lot of things that can't be done, so an extra one has been made. NET Desktop Engine to assist, you now need to interact with the two programs in different environments.
First step: In the Desktop app Engine, wake up the store app.
According to MSDN, the simplest approach here is to use the Protocol (URI protocol) to resolve it.
1: Open the package.appxmanifest of the program, add the Protocol in the Declaration
The protocol added to the name is what you want.
For example:bingnews://
can open Bing News
The name is the red part of the front.
Let's try input weipaisuperbar.
After you add the agreement,
Processing of the introduced protocol content in App.xaml.cs
protected override void OnActivated (Iactivatedeventargs args) { if (args. Kind = = Activationkind.protocol) { Protocolactivatedeventargs Protocolargs = args as Protocolactivatedeventargs; var rootframe = new Frame (); Rootframe.navigate (typeof (blogitems), args); Window.Current.Content = Rootframe; } Window.Current.Activate ();}
Turn around and automatically navigate to the Blogitems page.
Now that the app has been started, go to WinForm and write code to try it out.
The startup code is simple, too.
Process.Start ("Weipaisuperbar://whatever");
This solves the problem of starting the store application WinForm.
In the second step, WinForm reads the configuration file for the store app.
Because the security sandbox, so pinch you also don't want to read the store app's root directory, there is no registry permissions, so to interact with external programs please use
Roaming (can roam the data, the user to change the device after the login account can continue to roam back)
Local (only used locally)
It's certainly best to help us roam the data, and we'll use this as an example.
Initialize the configuration file string _name = "Settings.xml"; Windows.Storage.StorageFolder storagefolder = Windows.Storage.ApplicationData.Current.RoamingFolder; Create File var _file = await Storagefolder.createfileasync (_name, Windows.Storage.CreationCollisionOption.ReplaceExisting);
OK, so in the C:\Users\ user name \appdata\local\packages\ program name \roamingstate inside will have settings.xml this file, then read and write is simple
Interaction on desktop Programs (Winform or others) and Metro/modern programs (Windows store app) (open each other, configure read, etc.)