Ejemplo n.º 1
0
        protected override void OnActivated(IActivatedEventArgs args)
        {
            D($"Application activated by {args.Kind}");
            switch (args.Kind)
            {
            case ActivationKind.ToastNotification:
                var argument = (args as ToastNotificationActivatedEventArgs)?.Argument;
                ToastManager.HandleToastActivation(argument);
                break;

            case ActivationKind.Protocol:
                try
                {
                    ProtocolActivatedEventArgs protocalArgs = args as ProtocolActivatedEventArgs;
                    D($"Activated by URI <{protocalArgs.Uri.OriginalString}>");
                    StupActionManager.Register(() => MainPage.Current.NavigateNewTaskPage(protocalArgs.Uri));
                }
                catch (Exception e)
                {
                    D($"Handling protocol activation failed: {e.Message}");
                    StupActionManager.Register(() => MainPage.Current.NavigateNewTaskPage());
                    ToastManager.ProtocolActivationErrorToast(e);
                }
                break;
            }

            if (!EnsurePageCreatedAndActivate())
            {
                D($"Exist UI content, navigate to new task page");
                StupActionManager.Do();
            }

            base.OnActivated(args);
        }