diff options
author | Brian Noyes <brian.noyes@gmail.com> | 2015-10-23 15:58:38 +0300 |
---|---|---|
committer | Brian Noyes <brian.noyes@gmail.com> | 2015-10-23 15:58:38 +0300 |
commit | ea656610a452df1043ce7326dd415f4935c36a56 (patch) | |
tree | 1f387c8f0d547e4d55e9823898e34cd409e798cf | |
parent | 0139866d75fd13bcebd784f3d6c5a6df56697c56 (diff) | |
parent | 4f629d2bf46df74a2b0abc2235d341d5c18c07db (diff) |
Merge pull request #259 from briannoyes/master
Made OnActivateAppAsync virtual instead of abstract
-rw-r--r-- | Source/Windows10/Prism.Windows/PrismApplication.cs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Source/Windows10/Prism.Windows/PrismApplication.cs b/Source/Windows10/Prism.Windows/PrismApplication.cs index 0a2be59..632a50a 100644 --- a/Source/Windows10/Prism.Windows/PrismApplication.cs +++ b/Source/Windows10/Prism.Windows/PrismApplication.cs @@ -98,10 +98,12 @@ namespace Prism.Windows protected abstract Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args); /// <summary> - /// Override this method with logic that will be performed after the application is activated. For example, navigating to the application's home page. + /// Override this method with logic that will be performed after the application is activated through other means + /// than a normal launch (i.e. Voice Commands, URI activation, being used as a share target from another app). + /// For example, navigating to the application's home page. /// </summary> /// <param name="args">The <see cref="IActivatedEventArgs"/> instance containing the event data.</param> - protected abstract Task OnActivateApplicationAsync(IActivatedEventArgs args); + protected virtual Task OnActivateApplicationAsync(IActivatedEventArgs args) { return Task.FromResult<object>(null); } /// <summary> /// Creates and Configures the container if using a container @@ -192,14 +194,7 @@ namespace Prism.Windows { base.OnActivated(args); - if (Window.Current.Content == null) - { - Frame rootFrame = await InitializeFrameAsync(args); - - Shell = CreateShell(rootFrame); - - Window.Current.Content = Shell ?? rootFrame; - } + await InitializeShell(args); if (Window.Current.Content != null && (!_isRestoringFromTermination || args != null)) { @@ -210,13 +205,7 @@ namespace Prism.Windows Window.Current.Activate(); } - /// <summary> - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used when the application is launched to open a specific file, to display - /// search results, and so forth. - /// </summary> - /// <param name="args">Details about the launch request and process.</param> - protected override async void OnLaunched(LaunchActivatedEventArgs args) + private async Task InitializeShell(IActivatedEventArgs args) { if (Window.Current.Content == null) { @@ -226,6 +215,17 @@ namespace Prism.Windows Window.Current.Content = Shell ?? rootFrame; } + } + + /// <summary> + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used when the application is launched to open a specific file, to display + /// search results, and so forth. + /// </summary> + /// <param name="args">Details about the launch request and process.</param> + protected override async void OnLaunched(LaunchActivatedEventArgs args) + { + await InitializeShell(args); // If the app is launched via the app's primary tile, the args.TileId property // will have the same value as the AppUserModelId, which is set in the Package.appxmanifest. |