protected override async Task OnActivateApplicationAsync(IActivatedEventArgs args) { if (args.Kind == ActivationKind.ToastNotification && args.PreviousExecutionState != ApplicationExecutionState.Running) { // Handle a toast notification here // Since dev center, toast, and Azure notification hub will all active with an ActivationKind.ToastNotification // you may have to parse the toast data to determine where it came from and what action you want to take // If the app isn't running then launch the app here await OnLaunchApplicationAsync(args as LaunchActivatedEventArgs); } // By default, this handler expects URIs of the format 'wtsapp:sample?paramName1=paramValue1¶mName2=paramValue2' if (args.Kind == ActivationKind.Protocol && args is ProtocolActivatedEventArgs protocolArgs && protocolArgs.Uri != null) { // Create data from activation Uri in ProtocolActivatedEventArgs var data = new SchemeActivationData(protocolArgs.Uri); if (data.IsValid) { await LaunchApplicationAsync(data.PageToken, data.Parameters); } else if (args.PreviousExecutionState != ApplicationExecutionState.Running) { // If the app isn't running and not navigating to a specific page based on the URI, navigate to the home page await OnLaunchApplicationAsync(args as LaunchActivatedEventArgs); } } }
protected override async Task OnActivateApplicationAsync(IActivatedEventArgs args) { //{[{ // By default, this handler expects URIs of the format 'wtsapp:sample?paramName1=paramValue1¶mName2=paramValue2' if (args.Kind == ActivationKind.Protocol && args is ProtocolActivatedEventArgs protocolArgs && protocolArgs.Uri != null) { // Create data from activation Uri in ProtocolActivatedEventArgs var data = new SchemeActivationData(protocolArgs.Uri); if (data.IsValid) { var frame = Window.Current.Content as Frame; if (frame.Content is PivotPage pivotPage) { pivotPage.InitializeFromSchemeActivation(data); } else { await LaunchApplicationAsync(PageTokens.PivotPage, data); } } else if (args.PreviousExecutionState != ApplicationExecutionState.Running) { // If the app isn't running and not navigating to a specific page based on the URI, navigate to the home page await OnLaunchApplicationAsync(args as LaunchActivatedEventArgs); } } //}]} await Task.CompletedTask; }
public UserActivityData(string activityId, SchemeActivationData activationData, string displayText, Color backgroundColor = default(Color), string description = null) { ActivityId = activityId; ActivationData = activationData; DisplayText = displayText; BackgroundColor = backgroundColor; Description = description ?? string.Empty; }
public async Task InitializeFromSchemeActivationAsync(SchemeActivationData schemeActivationData) { var selected = pivot.Items.Cast <PivotItem>() .FirstOrDefault(i => i.IsOfViewModelName(schemeActivationData.ViewModelName)); var page = selected?.GetPage <IPivotActivationPage>(); pivot.SelectedItem = selected; await page?.OnPivotActivatedAsync(schemeActivationData.Parameters); }
//{[{ public void InitializeFromSchemeActivation(SchemeActivationData schemeActivationData) { var selected = pivot.Items.Cast <PivotItem>() .FirstOrDefault(i => i.IsOfPageType(schemeActivationData.PageToken)); pivot.SelectedItem = selected; var viewModel = selected?.GetPage <INavigationAware>(); var args = new NavigatedToEventArgs(); args.Parameter = schemeActivationData.Parameters; viewModel.OnNavigatedTo(args, null); }