protected override async Task HandleInternalAsync(ToastNotificationActivatedEventArgs args) { var toastActivationArgs = args as ToastNotificationActivatedEventArgs; StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault(); string originalArgs = engagementManager.ParseArgumentsAndTrackAppLaunch(toastActivationArgs.Argument); // Use the originalArgs variable to access the original arguments // that were passed to the app. await Task.CompletedTask; }
public void Run(IBackgroundTaskInstance taskInstance) { var details = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail; if (details != null) { StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault(); string originalArgs = engagementManager.ParseArgumentsAndTrackAppLaunch(details.Argument); // Use the originalArgs variable to access the original arguments // that were passed to the app. } }
protected override void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); if (args is ToastNotificationActivatedEventArgs) { var toastActivationArgs = args as ToastNotificationActivatedEventArgs; StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault(); string originalArgs = engagementManager.ParseArgumentsAndTrackAppLaunch( toastActivationArgs.Argument); // Use the originalArgs variable to access the original arguments // that were passed to the app. } }
protected override async void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); await ActivationService.ActivateAsync(args); Helpers.ThemeHelper.SetThemeForJPDict(); if (args is ToastNotificationActivatedEventArgs) { var toastActivationArgs = args as ToastNotificationActivatedEventArgs; QueryString parameters = QueryString.Parse(toastActivationArgs.Argument); Frame rootFrame = Window.Current.Content as Frame; if (parameters.Contains("action")) { switch (parameters["action"]) { case "detailResult": string keyword = parameters["keyword"]; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage)); rootFrame.Navigate(typeof(ResultPage), keyword); } else { if (rootFrame.CanGoBack) { rootFrame.GoBack(); } rootFrame.Navigate(typeof(ResultPage), keyword); await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default); } break; } } CopyMainDb(); InitOnlineServiceAsync(); Helpers.ThemeHelper.SetThemeForJPDict(); // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter UpdatePromptHelper.LoadState(); if (UpdatePromptHelper.Updated) { rootFrame.Navigate(typeof(UpdatePage)); } else { rootFrame.Navigate(typeof(MainPage)); } } // Ensure the current window is active Window.Current.Activate(); StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault(); string originalArgs = engagementManager.ParseArgumentsAndTrackAppLaunch(toastActivationArgs.Argument); // Use the originalArgs variable to access the original arguments // that were passed to the app. } if (args.Kind == ActivationKind.Protocol) { var uriArgs = args as ProtocolActivatedEventArgs; if (uriArgs != null) { Frame rootFrame = Window.Current.Content as Frame; CopyMainDb(); InitOnlineServiceAsync(); // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { if (uriArgs.Uri.Host == "result") { //rootFrame.BackStack.Insert(0,new PageStackEntry(typeof(MainPage), null, new EntranceNavigationTransitionInfo())); rootFrame.Navigate(typeof(MainPage)); rootFrame.Navigate(typeof(ResultPage), Uri.UnescapeDataString(uriArgs.Uri.Query.Replace("?keyword=", ""))); } } // Ensure the current window is active Window.Current.Activate(); } } }
protected override void OnActivated(IActivatedEventArgs e) { if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView")) { var titleBar = ApplicationView.GetForCurrentView().TitleBar; if (titleBar != null) { titleBar.ButtonBackgroundColor = (Application.Current.Resources["splitwiseGreen"] as SolidColorBrush).Color; titleBar.ButtonHoverBackgroundColor = (Application.Current.Resources["splitwiseGreenHover"] as SolidColorBrush).Color; titleBar.ButtonPressedBackgroundColor = (Application.Current.Resources["splitwiseGreenPressed"] as SolidColorBrush).Color; titleBar.ButtonForegroundColor = Colors.White; titleBar.BackgroundColor = (Application.Current.Resources["splitwiseGreen"] as SolidColorBrush).Color; ; titleBar.ForegroundColor = Colors.White; titleBar.InactiveBackgroundColor = (Application.Current.Resources["splitwiseGreen"] as SolidColorBrush).Color; titleBar.InactiveForegroundColor = Colors.White; titleBar.ButtonInactiveBackgroundColor = (Application.Current.Resources["splitwiseGreen"] as SolidColorBrush).Color; titleBar.ButtonInactiveForegroundColor = Colors.White; } } //Mobile customization if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) { var statusBar = StatusBar.GetForCurrentView(); if (statusBar != null) { statusBar.BackgroundOpacity = 1; statusBar.BackgroundColor = (Application.Current.Resources["splitwiseGreen"] as SolidColorBrush).Color; statusBar.ForegroundColor = Colors.White; } } Advertisement.UpdateInAppPurchases(); //#if DEBUG // if (System.Diagnostics.Debugger.IsAttached) // { // this.DebugSettings.EnableFrameRateCounter = true; // } //#endif Helpers dbHelper = new Helpers(); dbHelper.CreateDatabase(); rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { App.accessToken = Helpers.AccessToken; App.accessTokenSecret = Helpers.AccessTokenSecret; // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (ApplicationData.Current.LocalSettings.Values[Constants.ACCESS_TOKEN_TAG] != null && ApplicationData.Current.LocalSettings.Values[Constants.ACCESS_TOKEN_SECRET_TAG] != null) { rootFrame.Navigate(typeof(MainPage), false); } else { rootFrame.Navigate(typeof(LoginPage)); } } // Ensure the current window is active Window.Current.Activate(); if (e is ToastNotificationActivatedEventArgs) { var toastActivationArgs = e as ToastNotificationActivatedEventArgs; StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault(); engagementManager.ParseArgumentsAndTrackAppLaunch(toastActivationArgs.Argument); } }