13

I'm beginning to develop apps for the Universal Windows Platform (Windows 10), and I'm making an app that needs to be able to run on multiple instances. I've seen that this is possible with the universal apps as there are some apps that can already do this (e.g. Calculator, Edge).

I have already tried searching on Google, on Microsoft's API reference, and here to no avail. I'd really appreciate your help.

  • New version 1803 this spring will have [multi-instance](https://learn.microsoft.com/en-us/windows/uwp/launch-resume/multi-instance-uwp). – Michael Hawker - MSFT Feb 26 '18 at 06:23
  • @MichaelHawker-MSFT Would it be easy to switch on the multi-instancing only while developing? And if so, then how? My app isn't multi-instance but is multi-client. It would be nice to test on a single machine w/o making a ton of changes just for that purpose. – HappyNomad Sep 20 '18 at 15:43
  • @HappyNomad you should be able to just modify the manifest. But it may still behave differently as the open app can choose to redirect still I believe. So, it may still be best to have a VM to test the app on the same machine but in an isolated environment. – Michael Hawker - MSFT Sep 20 '18 at 18:33

1 Answers1

9

UWP/store apps use no multiinstance, but use multi-view style. (Edge is an exception, maybe...)

In multi-view, the instance is same but each windows' 'Views' are running on each threads.

Design guideline: Guidelines for multiple windows

Sample: MultipleViews Sample

[Added Feb 2018] From Windows 10 RS4 (1803), we can use the 'true' multi instance with UWP App :) Applicable device families are Desktop and IoT. This is a sort of 'opt-in' option - you need to declare it on your application manifest to use it. The detail and samples available on the following Microsoft Docs site.

Create a multi-instance Universal Windows App


[Added June 2017] As of build2017 presentations, it seems that Microsoft have a plan to extend their UWP App model to allow the real "Multi Instance" by their future Update of Windows. But the details are not available yet.


[Added 2015] I've uploaded the sample bogusCalc to my OneDrive.

This is based on VS2015 'blank' template and ViewLifetimeControl.cs, picked from multiple views sample. Each time you start the bogusCalc from the start menu, Application::OnLaunched is invoked.

screenshot of boguscalc =)

Community
  • 1
  • 1
Mamoru Satoh
  • 2,670
  • 23
  • 23
  • This is good, but it's not what I'm looking for. What I mean is real instancing. For example, the universal Calculator app; if you click several times on it's icon or tile it will open another instance of the app, without having to open another view from within the app. – Yaroslav de la Peña Smirnov Sep 28 '15 at 12:19
  • 2
    UWP Calc app is a good example of multi-view model. User can use the several Views of calc in simultaneously. But, you can see only one instance (process) of calc by using task manager. When user launch the app if the app already running, the event 'OnActivated(in app.xaml.cs)' is fired. At this handler, you can create a new view of your app. This is the way of calc app. – Mamoru Satoh Sep 29 '15 at 01:12
  • I tried using the OnActivated event, but it doesn't fire in that case. – Yaroslav de la Peña Smirnov Oct 01 '15 at 22:58
  • 1
    Oh, I've misunderstood. OnLaunched is the one. I'll edit my answer to paste the sample code. – Mamoru Satoh Oct 02 '15 at 13:27
  • Doesn't look like creators update got multi-instance. https://learn.microsoft.com/en-us/windows/uwp/whats-new/windows-10-version-1703 – Joe Healy Jun 29 '17 at 19:39
  • 1
    New version 1803 this spring will have [multi-instance](https://learn.microsoft.com/en-us/windows/uwp/launch-resume/multi-instance-uwp). – Michael Hawker - MSFT Feb 26 '18 at 06:22