示例#1
0
        protected override async Task OnUriActivatedAsync(Frame frame, Boolean newInstance, ProtocolActivatedEventArgs args)
        {
            var activation = Activation.Create(args);

            if (activation.SharedLinkParameter != null)
            {
                Model.MapView.SetSharedLinkSettings(activation.SharedLinkParameter);
            }

            frame.Navigation.Navigate(typeof(MapPage), activation.NavigationParameter);
            if (activation.Type == ActivationType.SharedLink)
            {
                if (activation.SharedLinkParameter != null)
                {
                    App.Diagnostics.Telemetry.Log("Shared link", "status", "opened");
                    if (!newInstance)
                    {
                        await SharedLink.TryApplySettingsAsync();
                    }
                }
                else
                {
                    App.Diagnostics.Telemetry.Log("Shared link", "status", "failed");
                    await SharedLink.ShowLinkCreationFailedDialogAsync();
                }
            }
        }
示例#2
0
        public static Activation Create(IActivatedEventArgs args)
        {
            if (!(args is ProtocolActivatedEventArgs))
            {
                return(new Activation());
            }

            var uri        = ((ProtocolActivatedEventArgs)args).Uri;
            var activation = new Activation()
            {
                Type = ActivationType.SharedLink
            };

            activation.SharedLinkParameter = SharedLink.Parse(uri);
            if (activation.SharedLinkParameter != null)
            {
                activation.NavigationParameter = new FrameNavigation.Parameter("share");
            }
            return(activation);
        }