Cookie Consent by Free Privacy Policy Generator
Privacy
Polipone
<novembre 2024>
lunmarmergiovensabdom
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678
Immagini

Universal App - Uri association schema

 

http://social.technet.microsoft.com/wiki/contents/articles/27173.windows-phone-uri-association-schemes-list.aspx

 

 

Per associare ad un'app un uri per poterla chiamare da un'altra app:

  • Aprire il file AppxManifest.xml con l'editor xml, e aggiungere dentro al tag <Application> di <Applications> il seguente tag

<Extensions>

        <Extension Category="windows.protocol">

          <Protocol Name="MIONOME" m2:DesiredView="useLess" />

        </Extension>

      </Extensions>

  • Dove MIONOME sarà il nome dell'uri che le altre app dovranno usare per richiamare la nostra app con la seguente sintassi: Windows.System.Launcher.LaunchUriAsync(new System.Uri("MIONOME:"));
  • NOTA: il nome deve essere tutto in minuscolo!

 

  • Nel file App.xaml.cs aggiungere l'event-handler come sotto riportato

 

 

        protected override void OnActivated(IActivatedEventArgs e)

        {

            if (e.Kind == ActivationKind.Protocol)

            {

                ProtocolActivatedEventArgs protocolArgs = e as ProtocolActivatedEventArgs;

                Frame rootFrame = Window.Current.Content as Frame;

                if (rootFrame == null)

                {

                    rootFrame = new Frame();

                    rootFrame.CacheSize = 1;

                    if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)

                    {

                    }

                    Window.Current.Content = rootFrame;

                }

                if (rootFrame.Content == null)

                {

#if WINDOWS_PHONE_APP

                    if (rootFrame.ContentTransitions != null)

                    {

                        this.transitions = new TransitionCollection();

                        foreach (var c in rootFrame.ContentTransitions)

                        {

                            this.transitions.Add(c);

                        }

                    }

                    rootFrame.ContentTransitions = null;

                    rootFrame.Navigated += this.RootFrame_FirstNavigated;

#endif

                    if (!rootFrame.Navigate(typeof(MainPage)))

                    {

                        throw new Exception("Failed to create initial page");

                    }

                }

                Window.Current.Activate();

            }

        }

 

Notifiche