ATTENZIONE: Questo sito impiega diversi tipi di cookies. Alla pagina MAGGIORI INFORMAZIONI è possibile avere informazioni aggiuntive. Cliccando su ACCETTO o continuando a navigare sul sito acconsenti al loro utilizzo.
<aprile 2024>
lunmarmergiovensabdom
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345
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