Beispiel #1
0
        private bool UpdateTextInput(int formId, string name, string text)
        {
            bool             successful = false;
            IHTMLFormElement form       = GetForm(formId);

            if (form != null)
            {
                var element = form.item(name: name);
                if (element != null)
                {
                    var textinput = element as HTMLInputElement;
                    textinput.value = text;
                    successful      = true;
                }
            }

            return(successful);
        }
Beispiel #2
0
        private void RegCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            wb_.DocumentCompleted -= RegCompleted;

            // Input Reg Info.
            IHTMLDocument2   doc  = (IHTMLDocument2)wb_.Document.DomDocument;
            IHTMLFormElement form = doc.forms.item("main");

            IDictionary <string, string> info = GetRegInfo();

            // Account
            {
                IHTMLInputElement accEle = form.item("username");
                accEle.value = info["username"];
            }

            // Pwd
            {
                IHTMLInputElement pwdEle = form.item("password");
                pwdEle.value = info["password"];
                IHTMLInputElement pwdConfirmEle = form.item("password2");
                pwdConfirmEle.value = info["password"];
            }

            // Real Name
            {
                IHTMLInputElement aliasEle = form.item("alias");
                aliasEle.value = info["alias"];
            }

            // PwdSecurityQuestion
            {
                IHTMLSelectElement qEle = form.item("question");
                qEle.selectedIndex = int.Parse(info["question"]);
            }

            // PwdSecurityAnswer
            {
                IHTMLInputElement aEle = form.item("answer");
                aEle.value = info["answer"];
            }

            // Sex
            // Use default value.
            //{
            //    IHTMLSelectElement sexEle = form.item("answer");
            //    sexEle.selectedIndex = int.Parse(info["answer"]);
            //}

            //  CreditCard Pwd
            {
                IHTMLSelectElement aEle = form.item("drpAuthCodea");
                aEle.selectedIndex = int.Parse(info["drpAuthCodea"]);

                IHTMLSelectElement bEle = form.item("drpAuthCodeb");
                bEle.selectedIndex = int.Parse(info["drpAuthCodeb"]);

                IHTMLSelectElement cEle = form.item("drpAuthCodec");
                cEle.selectedIndex = int.Parse(info["drpAuthCodec"]);

                IHTMLSelectElement dEle = form.item("drpAuthCoded");
                dEle.selectedIndex = int.Parse(info["drpAuthCoded"]);
            }

            // BirthDay
            {
                IHTMLSelectElement yearEle = form.item("year11");
                yearEle.selectedIndex = int.Parse(info["year11"]);

                IHTMLSelectElement monthEle = form.item("maoth11");
                monthEle.selectedIndex = int.Parse(info["month11"]);

                IHTMLSelectElement dayEle = form.item("day11");
                dayEle.selectedIndex = int.Parse(info["day11"]);
            }

            // All use default.
            // Nation
            {
                IHTMLInputElement nationEle = form.item("contory");
            }

            // City
            {
                IHTMLInputElement cityEle = form.item("city");
            }
            // KnownWay
            {
                //...
            }
            // Agreement
            {
            }


            // Submit
            {
                IHTMLElement submitEle = form.item("submitBtn");
                submitEle.click();
            }
        }