Наследование: IProtocolActivatedEventArgs, IActivatedEventArgs
 /// <summary>
 /// Selects the scenario corresponding with the Uri used to activate this app via a protocol. If there is no corresponding
 /// scenario then there is no effect.
 /// </summary>
 /// <param name="protocolArgs">Container for the protocol activation information which includes the Uri that activated this app</param>
 public void LoadScenarioForProtocolActivation(ProtocolActivatedEventArgs protocolArgs)
 {
     foreach (Scenario scenario in scenarios)
     {
         if (protocolArgs.Uri.Equals(SharePage.GetApplicationLink(scenario.ClassType.Name)))
         {
             // By setting the selected index, the Scenarios_SelectionChanged(...) method will be called
             ScenarioControl.SelectedIndex = scenarios.IndexOf(scenario);
             break;
         }
     }
 }
         public static void HandleProtocolLaunch(ProtocolActivatedEventArgs protocolArgs)
         {
             if (protocolArgs.Uri.OriginalString.StartsWith("vk") && protocolArgs.Uri.OriginalString.Contains("://authorize"))
             {
                 var launchUriDecoded = protocolArgs.Uri.ToString();
                 launchUriDecoded = launchUriDecoded.Replace("authorize/#", "authorize/?");

                 var innerQueryParamsString = VKUtil.GetParamsOfQueryString(launchUriDecoded);

                 VKSDK.ProcessLoginResult(innerQueryParamsString, false, null);
             }
         }
Пример #3
0
        //
        // http://tozon.info/blog/post/2011/10/06/Windows-8-Metro-declarations-Protocol.aspx
        //
        private async void OnProtocolActivated(ProtocolActivatedEventArgs args)
        {
            // Format:  risdok://NOR12110323
            string dokumentNummer = args.Uri.Host;
            string title = "Dokument " + dokumentNummer;

            var action = DocumentDetailNavigationParameter
                .CreateNavigationParameter(title, NavigationAction.LoadFromService, dokumentNummer);

            await CommonInitialize();
            await EnsureRootFrameInitialization(args.PreviousExecutionState, Window.Current.Content as Frame);

            NavigationService.Navigate<DocumentDetailPage>(action);
            Window.Current.Activate();
        }
Пример #4
0
 public Splash(ProtocolActivatedEventArgs args)
     : this(args.SplashScreen)
 {
     var _Decoder = new WwwFormUrlDecoder(args.Uri.Query);
     var _Id = _Decoder.Where(q => q.Name.ToLower() == "module").Select(q => q.Value).FirstOrDefault();
     if (string.IsNullOrWhiteSpace(_Id))
         _Decoder.Where(q => q.Name.ToLower() == "episode").Select(q => q.Value).FirstOrDefault();
     if (string.IsNullOrWhiteSpace(_Id))
     {
         Services.Navigation.GotoFail("The Uri specified was incorrect.");
         return;
     }
     AllowResume = false;
     GotoType = typeof(Views.Detail);
     GotoParam = _Id;
 }
        public static void FacebookAuthenticationReceived(ProtocolActivatedEventArgs protocolArgs)
        {
            if (protocolArgs == null)
            {
                throw new ArgumentNullException("protocolArgs");
            }

            // If this invocation is because of a dialog dismissal, dismiss the dialog
            // TODO: (sanjeevd) Fire the event handler when the dialog is done - via the browser
            if (OnDialogDismissed != null)
            {
                OnDialogDismissed(protocolArgs.Uri);
            }


            // parse and fill out the token data
            try
            {
                AccessTokenData tokenData = new AccessTokenData();
                tokenData.ParseQueryString(Facebook.HttpHelper.UrlDecode(protocolArgs.Uri.ToString()));
                if (!String.IsNullOrEmpty(tokenData.AccessToken))
                {
                    tokenData.AppId = Session.AppId;
                    Session.ActiveSession.CurrentAccessTokenData = tokenData;

                    // trigger the event handler with the session
                    if (Session.OnFacebookAuthenticationFinished != null)
                    {
                        Session.OnFacebookAuthenticationFinished(tokenData);
                    }

                    if (Session.OnSessionStateChanged != null)
                    {
                        Session.OnSessionStateChanged(LoginStatus.LoggedIn);
                    }
                }
            }
            catch (Facebook.FacebookOAuthException exc)
            {
                  // TODO: (sanjeevd) catch appropriately
            }
        }
Пример #6
0
 /// <summary>
 /// Handles protocol activation i.e. MediaAppSample:4
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 protected override bool OnActivation(ProtocolActivatedEventArgs e)
 {
     return this.HandleArgumentsActivation(e.Uri.PathAndQuery);
 }
 protected virtual Task OnProtocolStartAsync(ProtocolActivatedEventArgs protocolArgs, object e)
 {
     return Task.FromResult<object>(null);
 }
Пример #8
0
 protected virtual Task OnActivatedByProtocolAsync(ProtocolActivatedEventArgs e) { return Task.FromResult<object>(null); }
Пример #9
0
 protected abstract bool OnActivation(ProtocolActivatedEventArgs e);
        void Scenarios_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (Scenarios.SelectedItem != null)
            {
                NotifyUser("", NotifyType.StatusMessage);

                ListBoxItem selectedListBoxItem = Scenarios.SelectedItem as ListBoxItem;
                SuspensionManager.SessionState["SelectedScenarioIndex"] = Scenarios.SelectedIndex;

                Scenario scenario = selectedListBoxItem.Content as Scenario;
                LoadScenario(scenario.ClassType);
                InvalidateSize();

                ContactEvent = null;
                ProtocolEvent = null;

                // Fire the ScenarioLoaded event since we know that everything is loaded now.
                if (ScenarioLoaded != null)
                {
                    ScenarioLoaded(this, new EventArgs());
                }
            }
        }
Пример #11
0
        private void RespondToBackgroundVoiceCommand(ProtocolActivatedEventArgs e, IAppPage page)
        {
            var commandArgs = e as ProtocolActivatedEventArgs;
            Windows.Foundation.WwwFormUrlDecoder decoder = new Windows.Foundation.WwwFormUrlDecoder(commandArgs.Uri.Query);
            var passedArg = decoder.GetFirstValueByName("LaunchContext");

            // Ensure the current window is active.
            Window.Current.Activate();
        }
Пример #12
0
        private void InvalidateLayout()
        {
            if (this.ActualWidth < 768)
            {
                Grid.SetRow(DescriptionText, 3);
                Grid.SetColumn(DescriptionText, 0);

                Grid.SetRow(InputSection, 4);
                Grid.SetColumn(InputSection, 0);

                Grid.SetRow(FooterPanel, 2);
                Grid.SetColumn(FooterPanel, 0);
            }
            else
            {
                Grid.SetRow(DescriptionText, 1);
                Grid.SetColumn(DescriptionText, 1);

                Grid.SetRow(InputSection, 2);
                Grid.SetColumn(InputSection, 1);

                Grid.SetRow(FooterPanel, 1);
                Grid.SetColumn(FooterPanel, 1);
            }

            // Since we don't load the scenario page in the traditional manner (we just pluck out the
            // input and output sections from the page) we need to ensure that any VSM code used
            // by the scenario's input and output sections is fired.
            VisualStateManager.GoToState((Control)InputSection, "Input" + DetermineVisualState(this.ActualWidth), false);
            VisualStateManager.GoToState((Control)OutputSection, "Output" + DetermineVisualState(this.ActualWidth), false);

            FileEvent = null;
            ProtocolEvent = null;
        }