private async Task HandleActivationAsync(object activationArgs)
        {
            var activationHandler = GetActivationHandlers()
                                    .FirstOrDefault(h => h.CanHandle(activationArgs));

            if (activationHandler != null)
            {
#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task
                await activationHandler.HandleAsync(activationArgs);

#pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task
            }

            if (IsInteractive(activationArgs))
            {
                var defaultHandler = new DefaultActivationHandler(_defaultNavItem);
                if (defaultHandler.CanHandle(activationArgs))
                {
#pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task
                    await defaultHandler.HandleAsync(activationArgs);

#pragma warning restore CA2007 // Consider calling ConfigureAwait on the awaited task
                }
            }
        }
Ejemplo n.º 2
0
        private async Task HandleActivationAsync(object activationArgs)
        {
            var defaultHandler = new DefaultActivationHandler(_defaultNavItem);

            if (defaultHandler.CanHandle(activationArgs))
            {
                await defaultHandler.HandleAsync(activationArgs);
            }
        }
Ejemplo n.º 3
0
        public async Task ActivateAsync(object activationArgs)
        {
            if (IsInteractive(activationArgs))
            {
                // Initialize services that you need before app activation
                // take into account that the splash screen is shown while this code runs.
                await InitializeAsync();

                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
                if (Window.Current.Content == null)
                {
                    // Create a Shell or Frame to act as the navigation context
                    if (_shell?.Value == null)
                    {
                        var frame = new Frame();
                        NavigationService      = _container.RegisterNavigationService(frame);
                        Window.Current.Content = frame;
                    }
                    else
                    {
                        var viewModel = ViewModelLocator.LocateForView(_shell.Value);

                        ViewModelBinder.Bind(viewModel, _shell.Value, null);

                        ScreenExtensions.TryActivate(viewModel);

                        NavigationService      = _container.GetInstance <INavigationService>();
                        Window.Current.Content = _shell?.Value;
                    }
                }
            }

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

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

            if (IsInteractive(activationArgs))
            {
                var defaultHandler = new DefaultActivationHandler(_defaultNavItem, NavigationService);
                if (defaultHandler.CanHandle(activationArgs))
                {
                    await defaultHandler.HandleAsync(activationArgs);
                }

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

                // Tasks after activation
                await StartupAsync();
            }
        }
Ejemplo n.º 4
0
        public async Task ActivateAsync(object activationArgs)
        {
            //_logHelper.Log(LogLevel.Trace, "Entered ActivateAsync");

            if (IsInteractive(activationArgs))
            {
                // Initialize services that you need before app activation
                // take into account that the splash screen is shown while this code runs.
                await InitializeAsync();

                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
                if (Window.Current.Content is null)
                {
                    // Create a Frame to act as the navigation context and navigate to the first page
                    Window.Current.Content = _shell?.Value ?? new Frame();
                }
            }

            // Depending on activationArgs one of ActivationHandlers or DefaultActivationHandler
            // will navigate to the first page
            //await HandleActivationAsync(activationArgs);
            //_lastActivationArgs = activationArgs;

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

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

            if (IsInteractive(activationArgs))
            {
                //var defaultHandler = new DefaultLaunchActivationHandler(_defaultNavItem);
                var defaultHandler = new DefaultActivationHandler(_defaultNavItem);
                if (defaultHandler.CanHandle(activationArgs))
                {
                    await defaultHandler.HandleAsync(activationArgs);
                }

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

                // Tasks after activation
                await StartupAsync();
            }
        }
Ejemplo n.º 5
0
        private async Task HandleActivationAsync(object activationArgs)
        {
            //var activationHandler = GetActivationHandlers().FirstOrDefault(h => h.CanHandle(activationArgs));
            //if (activationHandler != null)
            //{
            //    await activationHandler.HandleAsync(activationArgs);
            //}

            if (IsInteractive(activationArgs))
            {
                var defaultHandler = new DefaultActivationHandler(_defaultNavItem);
                if (defaultHandler.CanHandle(activationArgs))
                {
                    await defaultHandler.HandleAsync(activationArgs);
                }
            }
        }
Ejemplo n.º 6
0
        private async Task HandleActivationAsync(object activationArgs)
        {
            var activationHandler = GetActivationHandlers().FirstOrDefault(h => h.CanHandle(activationArgs));

            if (activationHandler != null)
            {
                await activationHandler.HandleAsync(activationArgs).ConfigureAwait(true);
            }

            if (IsInteractive(activationArgs))
            {
                var defaultHandler = new DefaultActivationHandler(this.defaultNavItem);
                if (defaultHandler.CanHandle(activationArgs))
                {
                    await defaultHandler.HandleAsync(activationArgs).ConfigureAwait(true);
                }
            }
        }
Ejemplo n.º 7
0
        static private async Task HandleActivationAsync(object activationArgs)
        {
            ActivationHandler activationHandler = GetActivationHandlers()
                                                  .FirstOrDefault(h => h.CanHandle(activationArgs));

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

            if (IsInteractive(activationArgs))
            {
                DefaultActivationHandler defaultHandler = new DefaultActivationHandler(_startupViewType);
                if (defaultHandler.CanHandle(activationArgs))
                {
                    await defaultHandler.HandleAsync(activationArgs);
                }
            }
        }