Inter application communication in WinRT

后端 未结 4 1369
渐次进展
渐次进展 2021-01-23 00:06

There are two WinRT applications (C#/Xaml if it matters) on Windows 8. The first app should receive and send some data into the second one. What the best way to do that? Can WCF

相关标签:
4条回答
  • 2021-01-23 00:38

    I am not sure if it has been answered but I found that it is possible to do this using LaunchFileAsync. An example is as follows: //To launch app var launchFileName = "june.kit";

                var folder = Windows.Storage.ApplicationData.Current.LocalFolder;
                var option = Windows.Storage.CreationCollisionOption.ReplaceExisting;
    
                // create file 
                var launchFile = await folder.CreateFileAsync(launchFileName, option);
    
                // write content
                await Windows.Storage.FileIO.WriteTextAsync(launchFile, tempChk);
    
                // launch file
                bool success = await Launcher.LaunchFileAsync(launchFile);
    

    Where launchFileName is possible to have any name with any extension, and this extension should mention in the calling application's FileTypeAssociation in the packager.manifest file.

    0 讨论(0)
  • 2021-01-23 00:38

    Not possible, this requires loopback support. Something you can only turn on for testing, you cannot rely on it on your user's machine. The CheckNetIsolation.exe utility is available to enable it, MSDN article is here.

    Emphasis on only for testing, you can't ship an app like this. Your authentication server needs to run on another machine. Pretty essential anyway considering the odds it will be compromised when it runs on the same machine.

    0 讨论(0)
  • 2021-01-23 00:38

    Not having the full picture, it seems like a rather odd design decision to have an authentication server running in an UI centric application model such as WinRT. Can't it considered to be a "cloud" based service? I would prefer that anyway, not having to distribute the code for that server on every device out there.

    Having said that, take a look a custom share contracts solution. You should essentially be able to send the authentication request as a DataRequest and let the "server" respond with a DataResponse.

    There are two sample apps on code.msdn.com:

    • Sharing content source app sample
    • Sharing content target app sample
    0 讨论(0)
  • 2021-01-23 00:42

    One thing I stumbled across is: Windows.Networking.BackgroundTransfer

    Basically coming from this article: Transferring data in the background (Windows Store apps using C#/VB/C++ and XAML)

    But I'm actually not through the hole article & concept of background tasks. Maybe someone can comment on this?

    0 讨论(0)
提交回复
热议问题