Esempio n. 1
0
        /// <summary>
        ///     Invoked when the application is launched through a custom URI scheme, such as
        ///     is the case in an OAuth 2.0 authorization flow.
        /// </summary>
        /// <param name="args">Details about the URI that activated the app.</param>
        protected override void OnActivated(IActivatedEventArgs args)
        {
            // When the app was activated by a Protocol (custom URI scheme), forwards
            // the URI to the SystemBrowser through a static method.
            if (args.Kind == ActivationKind.Protocol)
            {
                // Extracts the authorization response URI from the arguments.
                var protocolArgs = (ProtocolActivatedEventArgs)args;
                var uri          = protocolArgs.Uri;
                Debug.WriteLine("Authorization Response: " + uri.AbsoluteUri);
                SystemBrowser.ProcessResponse(uri);
            }
            //自启动
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                Window.Current.Content = rootFrame;
            }

            if (args.Kind == ActivationKind.StartupTask)
            {
                var startupArgs = args as StartupTaskActivatedEventArgs;
            }

            rootFrame.Navigate(typeof(MainPage), args.Kind);
            Window.Current.Activate();
        }
Esempio n. 2
0
 /// <summary>
 ///     Invoked when the application is launched through a custom URI scheme, such as
 ///     is the case in an OAuth 2.0 authorization flow.
 /// </summary>
 /// <param name="args">Details about the URI that activated the app.</param>
 protected override void OnActivated(IActivatedEventArgs args)
 {
     // When the app was activated by a Protocol (custom URI scheme), forwards
     // the URI to the SystemBrowser through a static method.
     if (args.Kind == ActivationKind.Protocol)
     {
         // Extracts the authorization response URI from the arguments.
         var protocolArgs = (ProtocolActivatedEventArgs)args;
         var uri          = protocolArgs.Uri;
         Debug.WriteLine("Authorization Response: " + uri.AbsoluteUri);
         SystemBrowser.ProcessResponse(uri);
     }
 }