Beispiel #1
0
        private void WebBrowser_LoadCompleted(object sender, NavigationEventArgs e)
        {
            _timer.Change(-1, -1);

            WebBrowser.IsEnabled = true;

            WebBrowser.Visibility = Visibility.Visible;

            if (e.Uri.AbsolutePath == "/o/oauth2/approval")
            {
                HTMLDocument document = ((HTMLDocument)WebBrowser.Document);
                IHTMLElement element  = document.getElementById("code");
                if (element == null)
                {
                    Close();
                }
                else
                {
                    IHTMLInputTextElement input = (IHTMLInputTextElement)element;

                    string code = input.value;

                    CodeReceived(code);
                }
            }
        }
Beispiel #2
0
        private void WBTaoLoginState_Click(object sender, HtmlElementEventArgs e)
        {
            var doc = (HTMLDocument)WB.Document.DomDocument;
            IHTMLInputTextElement TPL_username_1 = (IHTMLInputTextElement)doc.getElementById("TPL_username_1");
            var userName = TPL_username_1.value;

            InitAppUserSetting(userName);
            IHTMLInputTextElement TPL_password_1 = (IHTMLInputTextElement)doc.getElementById("TPL_password_1");
            var password = TPL_password_1.value;

            AppSetting.UserSetting.Set("TaoUserName", userName, true);
            AppSetting.UserSetting.Set("TaoPassword", password, true);
        }
Beispiel #3
0
        private async void StaticLogin(HTMLDocument doc)
        {
            IHTMLInputTextElement TPL_username_1 = (IHTMLInputTextElement)doc.getElementById("TPL_username_1");

            if (AppSetting.UserSetting != null)
            {
                TPL_username_1.value = AppSetting.UserSetting.UserName;
            }
            var userName = TPL_username_1.value;

            InitAppUserSetting(userName);
            //J_Static表单登录
            if (!string.IsNullOrEmpty(TPL_username_1.value))
            {
                if (AppSetting.UserSetting.UserName != TPL_username_1.value)
                {
                    userName = TPL_username_1.value;
                    InitAppUserSetting(userName);
                }
                var userNameEl = WB.Document.GetElementById("TPL_username_1");
                if (userNameEl != null)
                {
                    userNameEl.InvokeMember("focus");

                    var passwordEl = WB.Document.GetElementById("TPL_password_1");
                    passwordEl.InvokeMember("focus");
                    if (AppSetting.UserSetting.Get <bool>("AutoSelectLoginedAccount"))
                    {
                        var password = AppSetting.UserSetting.Get <string>("TaoPassword");
                        if (!string.IsNullOrEmpty(password))
                        {
                            passwordEl.SetAttribute("value", password);
                            Application.DoEvents();
                            //如果验证码窗口没有显示就点击提交按钮,否则用户自己去点
                            var xdoc      = new Nx.EasyHtml.Html.Parser.JumonyParser().Parse(WB.Document.Body.InnerHtml, WB.Document.Url);
                            var checkCode = xdoc.Find(".field-checkcode.hidden");
                            if (checkCode.Any())
                            {
                                await Task.Delay(200);

                                WB.Document.All["J_SubmitStatic"].InvokeMember("click");
                            }
                            return;
                        }
                    }
                }
            }
        }
Beispiel #4
0
 public SUIHtmlInputText(SUIHtmlControlBase ctrl)
     : base(ctrl)
 {
     textElement = (IHTMLInputTextElement)ctrl.HtmlElement;
 }
Beispiel #5
0
 public SUIHtmlInputText(SUIHtmlDocument _doc, IHTMLElement _element)
     : base(_doc, _element)
 {
     textElement = (IHTMLInputTextElement)_element;
 }
Beispiel #6
0
 public SUIHtmlInputText(SUIHtmlControlBase ctrl)
     : base(ctrl)
 {
     textElement = (IHTMLInputTextElement)ctrl.HtmlElement;
 }
Beispiel #7
0
 public SUIHtmlInputText(SUIHtmlDocument _doc, IHTMLElement _element)
     : base(_doc, _element)
 {
     textElement = (IHTMLInputTextElement)_element;
 }