public async Task ActivateAsync(IActivatedEventArgs activationArgs)
        {
            bool isLaunch = false;

            if (IsInteractive(activationArgs))
            {
                // Retrieve current user if available
                if (activationArgs is IActivatedEventArgsWithUser argsWithUser)
                {
                    CurrentUser = argsWithUser.User;
                    await ContactHelper.CreateContactFromCurrentUserAsync();
                }

                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
                if (Window.Current.Content == null)
                {
                    isLaunch = true;

                    // Initialize things like registering background task before the app is loaded
                    await InitializeAsync();

                    // Create a Frame to act as the navigation context to navigate to the first page
                    var frame = new Frame();
                    frame.ContentTransitions = new TransitionCollection();
                    frame.ContentTransitions.Add(new NavigationThemeTransition());
                    Window.Current.Content = frame;

                    NavigationService.MainFrame         = frame;
                    NavigationService.NavigationFailed += OnNavigationFailed;
                    NavigationService.Navigated        += OnNavigated;

                    if (CurrentView != null)
                    {
                        CurrentView.BackRequested += OnBackRequested;
                    }
                }
            }

            ActivationState activationState   = null;
            var             activationHandler = GetActivationHandlers().FirstOrDefault(h => h.CanHandle(activationArgs));

            if (activationHandler != null)
            {
                activationState = await activationHandler.HandleAsync(activationArgs);
            }
            activationState = activationState ?? _activationState;

            if (IsInteractive(activationArgs))
            {
                if (isLaunch)
                {
                    NavigationService.Navigate(_view.FullName, activationState, mainFrame: true);

                    // Ensure the current window is active
                    Window.Current.Activate();

                    // Tasks after activation
                    await StartupAsync();
                }
                else
                {
                    NavigationService.Navigate(activationState.ViewModel.ToString(), activationState.Parameter);

                    // Ensure the current window is active
                    Window.Current.Activate();
                }
            }
        }
 public ActivationService(App app, Type view, ActivationState state)
 {
     _app             = app;
     _view            = view;
     _activationState = state;
 }