/// <summary> /// 登录按钮单击事件处理例程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { //String strBlogURL = txtBlogURL.Text.Trim(); String strBlogURL = cbBoxBlogURL.Text.Trim(); String strUserName = txtUserName.Text.Trim(); String strPassword = txtPassword.Text.Trim(); if (String.IsNullOrEmpty(strBlogURL) == true) { MessageBox.Show("Sorry,Please Input Correct Blog URL.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrEmpty(strUserName) == true) { MessageBox.Show("Sorry,Please Input Correct User Name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrEmpty(strPassword) == true) { MessageBox.Show("Sorry,Please Input Correct Password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } /* 显示加载窗口 */ Loading loadForm = new Loading(this.Location, this.Size); loadForm.Show(); Application.DoEvents(); MetaWeblogEntity.UserBlog[] allUserBlog = this.ClientLogin(strBlogURL, strUserName, strPassword); if (allUserBlog != null && allUserBlog.Length > 0) { loadForm.Close(); String strURL = allUserBlog[0].url; String strTitle = allUserBlog[0].blogName; this.Visible = false; if (chkBoxManualMode.Checked == true) { ManualPostBlog postBlog = new ManualPostBlog(strUserName, strPassword, strBlogURL, strTitle, strURL); postBlog.ShowDialog(); } else { AutoPostBlog postBlog = new AutoPostBlog(strUserName, strPassword, strBlogURL, strTitle, strURL); postBlog.ShowDialog(); } this.Visible = true; } else { loadForm.Close(); } }