Пример #1
0
 private void LoginService_CheckWhenFragmentReceived(FragmentCheckArgs args)
 {
     if (string.IsNullOrEmpty(args.Fragment) == false)
     {
         args.IsDone = args.Fragment.Contains("code=");
     }
 }
        private void WebBox_Navigated(object sender, NavigationEventArgs e)
        {
            // Set WebBrowser to silent mode.
            dynamic activeX = this.WebBox.GetType().InvokeMember("ActiveXInstance",
                                                                 BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,
                                                                 null, this.WebBox, new object[] { });

            activeX.Silent = true;


            // Check fragment.
            if (CheckWhenFragmentReceived != null)
            {
                var args = new FragmentCheckArgs(e.Uri?.Fragment);
                CheckWhenFragmentReceived(args);

                if (args.IsDone)
                {
                    LoginFragment = e.Uri?.Fragment;

                    this.Close();
                }
            }
        }