private async void OnLaunchedOrActivated(IActivatedEventArgs args) { IsForeground = true; Frame frame = ConstructUI(); Dispatcher = Window.Current.Dispatcher; if (!PermissionSystem.IsAllPermissionsObtained && !await ObtainingAccess) { await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { ObtainingAccess = PermissionSystem.RequestAllPermissions(); }); await ObtainingAccess; } if (Initializating == null) { Initializating = InitializateSystems(); } await Initializating; UISystem.Initializate(Dispatcher); NotificationSystem.RemoveCallToastNotifications(); switch (args.Kind) { case ActivationKind.Launch: LaunchActivatedEventArgs launchActivationArgs = args as LaunchActivatedEventArgs; if (launchActivationArgs.PrelaunchActivated == false) { if (frame.Content == null) { if (PhoneCallManager.IsCallActive) { CompactOverlayId = await CallUIPage.ShowInCallUI(); } frame.Navigate(typeof(MainPage), launchActivationArgs.Arguments); } } break; case ActivationKind.LockScreen: LockApplicationHost = LockApplicationHost.GetForCurrentView(); LockApplicationHost.Unlocking += LockApplicationHost_Unlocking; frame.Navigate(typeof(MainPage)); break; case ActivationKind.Protocol: ProtocolActivatedEventArgs protocolActivationArgs = args as ProtocolActivatedEventArgs; switch (protocolActivationArgs.Uri.Scheme) { case TEL: frame.Navigate(typeof(MainPage), protocolActivationArgs.Uri.LocalPath); break; default: throw new NotSupportedException(); } break; case ActivationKind.ToastNotification: ToastNotificationActivatedEventArgs toastActivationArgs = args as ToastNotificationActivatedEventArgs; OnToastNotificationActivated(ToastActivationType.Foreground, toastActivationArgs.Argument); break; default: throw new NotSupportedException(); } Window.Current.Activate(); }