/// <summary>
 /// 登录成功回调处理
 /// </summary>
 private void LoginSuccess()
 {
     try
     {
         loginSuccessTime = DateTime.Now;
         SetTitle("登录成功!正在获取Token...");
         var visitor = new CookieMonster();
         if (Cef.GetGlobalCookieManager().VisitUrlCookies(LoginSuccessUrl, true, visitor))
         {
             visitor.WaitForAllCookies();
         }
         JArray           jsons   = new JArray();
         CookieCollection cookies = new CookieCollection();
         foreach (System.Net.Cookie cookie in visitor.NamesValues)
         {
             JObject json = new JObject();
             json["name"]   = cookie.Name;
             json["path"]   = cookie.Path;
             json["domain"] = cookie.Domain;
             json["value"]  = cookie.Value;
             jsons.Add(json);
             cookies.Add(cookie);
         }
         string cookiesJson = JsonConvert.SerializeObject(jsons);
         //页面加载完成回调
         LoginSuccessHandle?.Invoke(cookies);
         SetTitle("登录成功!获取Token成功,正在验证token...");
         HideWindow();
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
 }
示例#2
0
        private void loginSuccess()
        {
            CookieContainer cookies = GetUriCookieContainer(webBrowser1.Url);
            JArray          jsons   = new JArray();

            foreach (Cookie cookie in cookies.GetCookies(webBrowser1.Url))
            {
                JObject json = new JObject();
                json["name"]   = cookie.Name;
                json["path"]   = cookie.Path;
                json["domain"] = cookie.Domain;
                json["value"]  = cookie.Value;
                jsons.Add(json);
            }
            LoginSuccessHandle?.Invoke(jsons);
        }
示例#3
0
        public void LoginSuccess()
        {
            var visitor = new CookieMonster();

            if (Cef.GetGlobalCookieManager().VisitUrlCookies(LoginSuccessUrl, true, visitor))
            {
                visitor.WaitForAllCookies();
            }
            JArray jsons = new JArray();

            foreach (System.Net.Cookie cookie in visitor.NamesValues)
            {
                JObject json = new JObject();
                json["name"]   = cookie.Name;
                json["path"]   = cookie.Path;
                json["domain"] = cookie.Domain;
                json["value"]  = cookie.Value;
                jsons.Add(json);
            }
            //页面加载完成回调
            LoginSuccessHandle?.Invoke(jsons);
        }
示例#4
0
        private void loginSuccess()
        {
            CookieContainer cookies = GetUriCookieContainer(browser.Url);

            if (cookies == null)
            {
                return;
            }
            isLogin = true;
            JArray jsons = new JArray();

            foreach (System.Net.Cookie cookie in cookies.GetCookies(browser.Url))
            {
                JObject json = new JObject();
                json["name"]   = cookie.Name;
                json["path"]   = cookie.Path;
                json["domain"] = cookie.Domain;
                json["value"]  = cookie.Value;
                jsons.Add(json);
            }
            LoginSuccessHandle?.Invoke(jsons);
        }
示例#5
0
        /// <summary>
        /// 登录成功回调处理
        /// </summary>
        private void LoginSuccess()
        {
            SetTitle("登录成功!正在获取Token...");
            var visitor = new CookieMonster();

            if (Cef.GetGlobalCookieManager().VisitUrlCookies(LoginSuccessUrl, true, visitor))
            {
                visitor.WaitForAllCookies();
            }
            JArray           jsons   = new JArray();
            CookieCollection cookies = new CookieCollection();

            foreach (System.Net.Cookie cookie in visitor.NamesValues)
            {
                JObject json = new JObject();
                json["name"]   = cookie.Name;
                json["path"]   = cookie.Path;
                json["domain"] = cookie.Domain;
                json["value"]  = cookie.Value;
                jsons.Add(json);
                cookies.Add(cookie);
            }
            string cookiesJson = JsonConvert.SerializeObject(jsons);

            //页面加载完成回调
            LoginSuccessHandle?.Invoke(cookies);
            SetTitle("登录成功!获取Token成功,正在验证token...");
            new Thread(() =>
            {
                Thread.Sleep(3000);
                HideWindow();
            })
            {
                IsBackground = true
            }.Start();
        }