日期:2014-05-17  浏览次数:20964 次

最近做了个回帖工具,大家看看有什么毛病
新手第一次做项目,以前学校的都是和同学一起做的,这次可以算独立完成,不会的问百度,大多数功能都实现了
现在没有解决的就是界面循环回帖的假死,和操作失误提示不会写,异步找了几天也没写出来,
想验证注册机但是也没实现,想开个登录框,是否是我设置的帐号密码也没写,但是程序可以用,现在大神帮我修改修改整合整合,提提意见,谢谢大家了。
C# code
        #region 获取网页回复按钮
        private void button1_Click(object sender, EventArgs e)
        {

            HtmlElement htmlBtn = webBrowser1.Document.GetElementById("imageField");
            htmlBtn.InvokeMember("click");

        }
        
        String huifucishu = "";//初始化回复次数
        #endregion
        #region 文本1打印
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                HtmlElement tbUserid = webBrowser1.Document.All["post_body"];
                string Run = "";
                Run = textBox1.Text;
                //文字打印
                tbUserid.SetAttribute("value", Run);
                tbUserid.InvokeMember("click");
                button1_Click(sender, e);
                //3秒不可点击
                huifu1.Enabled = false;
                huifu2.Enabled = false;
                Timer1.Interval = 3100;//3.1秒
                Timer1.Enabled = true;
                huifu2.BringToFront();
                //回复次数计算
                huifucishu = label8.Text = (Convert.ToInt32(label8.Text) + 1).ToString();

            }
            catch (Exception)
            {
                MessageBox.Show("你日你妹,还没加载完毕呢");
            }
        }
        #endregion
        #region 文本2打印
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                HtmlElement tbUserid = webBrowser1.Document.All["post_body"];
                string Run = "";
                Run = textBox2.Text;
                tbUserid.SetAttribute("value", Run);
                tbUserid.InvokeMember("click");
                button1_Click(sender, e);

                //3秒不可点击
                huifu1.Enabled = false;
                huifu2.Enabled = false;
                Timer1.Interval = 3100;//3.1秒
                Timer1.Enabled = true;
                huifu1.BringToFront();

                //回复次数
                huifucishu = label8.Text = (Convert.ToInt32(label8.Text) + 1).ToString();

            }
            catch (Exception)
            {
                MessageBox.Show("你日你妹,急啥急,还没加载完毕呢!");
            }
        }
        #endregion
        #region 大量重复操作判断
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //this.webBrowser1.ScriptErrorsSuppressed = true;
            if (webBrowser1.ReadyState < WebBrowserReadyState.Complete || webBrowser1.Url.ToString() == LastUrl) return;
            LastUrl = webBrowser1.Url.ToString();
            //执行正常流程代码…………
        }
        private string _LastUrl;
        public string LastUrl
        {
            get
            {
                return _LastUrl;
            }
            set
            {
                _LastUrl = value;
            }
        }
        #endregion
        #region 网页正在加载、请勿操作
        private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            label3.Text = "网页正在加载、请勿操作";
            jishiqi1.Enabled = true;
        }
        //页面加载完成、可以操作了
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (webBrowser1.ReadyState == WebBrowserReadyState.Complete != webBrowser1.IsBusy == false)
            {
                label3.Text = "页面加载完成、可以操作了";
                jishiqi1.Enabled = false;
            }

        }
        #endregion
        #region 按钮3.1秒结束不可点
        private void timer2_Tick(object sender, EventArgs e)
        {
            button1.E