コード例 #1
0
ファイル: BlogLogin.cs プロジェクト: gzhjic/PostBlog
        /// <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();
            }
        }
コード例 #2
0
        /// <summary>
        /// 用户选择 URL 选择事件改变处理例程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbBoxDefaultURL_SelectedIndexChanged(object sender, EventArgs e)
        {
            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);

            loadForm.Show();
            Application.DoEvents();
            this.cbBoxDefaultURLChanged();
            loadForm.Close();
        }
コード例 #3
0
        /// <summary>
        /// 窗体加载事件处理例程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutoPostBlog_Load(object sender, EventArgs e)
        {
            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);

            loadForm.Show();
            Application.DoEvents();
            this.InitForm();
            loadForm.Close();
        }
コード例 #4
0
        /// <summary>
        /// 刷新最近 Post 列表按钮单击事件处理例程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRefreshRecent_Click(object sender, EventArgs e)
        {
            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);

            loadForm.Show();
            Application.DoEvents();
            this.ReBindRecentPost();
            loadForm.Close();
        }
コード例 #5
0
ファイル: ManualPostBlog.cs プロジェクト: gzhjic/PostBlog
        /// <summary>
        /// 发布按钮单击事件处理例程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPublish_Click(object sender, EventArgs e)
        {
            String strTmpTitle       = txtTitle.Text.Trim();
            String strTmpDescription = txtDescription.Text.Trim();
            String strTmpCategories  = txtSetCategories.Text.Trim();

            if (String.IsNullOrEmpty(strTmpCategories) || strTmpCategories == "Select Blog Categories")
            {
                MessageBox.Show("   Sorry,Please Select Blog Categories.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (String.IsNullOrEmpty(strTmpTitle) || strTmpTitle == "Input Blog Title")
            {
                MessageBox.Show("   Sorry,Please Input Blog Title.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (String.IsNullOrEmpty(strTmpDescription))
            {
                MessageBox.Show("   Sorry,Please Input Blog Content.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);

            loadForm.Show();
            Application.DoEvents();
            String strResult = this.btnPublishClick(strTmpTitle, strTmpDescription, strTmpCategories);

            loadForm.Close();

            if (String.IsNullOrEmpty(strResult) == false)
            {
                if (strResult.Contains("Succeed") == true)
                {
                    MessageBox.Show(strResult, "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(strResult, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// 删除用户选择的最近的 Post 文章
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDeleteSelected_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Sure you want to delete the selected blog ? ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                ClearRecentSelectedBlogs();

                return;
            }

            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);

            loadForm.Show();
            Application.DoEvents();
            this.btnDeleteSelectedClick();
            this.ReBindRecentPost();
            loadForm.Close();

            MessageBox.Show("   Delete Blog Succeed.", "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #7
0
        /// <summary>
        /// 发布用户选择的按钮单击事件处理例程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPublishSelected_Click(object sender, EventArgs e)
        {
            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);

            loadForm.Show();
            Application.DoEvents();
            String strResult = this.btnPublishSelectedClick();

            loadForm.Close();

            if (String.IsNullOrEmpty(strResult) == false)
            {
                if (strResult.Contains("Succeed") == true)
                {
                    MessageBox.Show(strResult, "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(strResult, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #8
0
ファイル: AutoPostBlog.cs プロジェクト: 735756516/PostBlog
 /// <summary>
 /// 用户选择 URL 选择事件改变处理例程
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cbBoxDefaultURL_SelectedIndexChanged(object sender, EventArgs e)
 {
     /* 显示加载窗口 */
     Loading loadForm = new Loading(this.Location, this.Size);
     loadForm.Show();
     Application.DoEvents();
     this.cbBoxDefaultURLChanged();
     loadForm.Close();
 }
コード例 #9
0
ファイル: AutoPostBlog.cs プロジェクト: 735756516/PostBlog
 /// <summary>
 /// 刷新最近 Post 列表按钮单击事件处理例程
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnRefreshRecent_Click(object sender, EventArgs e)
 {
     /* 显示加载窗口 */
     Loading loadForm = new Loading(this.Location, this.Size);
     loadForm.Show();
     Application.DoEvents();
     this.ReBindRecentPost();
     loadForm.Close();
 }
コード例 #10
0
ファイル: AutoPostBlog.cs プロジェクト: 735756516/PostBlog
        /// <summary>
        /// 发布用户选择的按钮单击事件处理例程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPublishSelected_Click(object sender, EventArgs e)
        {
            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);
            loadForm.Show();
            Application.DoEvents();
            String strResult = this.btnPublishSelectedClick();
            loadForm.Close();

            if(String.IsNullOrEmpty(strResult) == false)
            {
                if (strResult.Contains("Succeed") == true)
                {
                    MessageBox.Show(strResult, "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(strResult, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #11
0
ファイル: AutoPostBlog.cs プロジェクト: 735756516/PostBlog
        /// <summary>
        /// 删除用户选择的最近的 Post 文章
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDeleteSelected_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Sure you want to delete the selected blog ? ", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            {
                ClearRecentSelectedBlogs();

                return;
            }

            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);
            loadForm.Show();
            Application.DoEvents();
            this.btnDeleteSelectedClick();
            this.ReBindRecentPost();
            loadForm.Close();

            MessageBox.Show("   Delete Blog Succeed.", "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #12
0
ファイル: AutoPostBlog.cs プロジェクト: 735756516/PostBlog
 /// <summary>
 /// 窗体加载事件处理例程
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void AutoPostBlog_Load(object sender, EventArgs e)
 {
     /* 显示加载窗口 */
     Loading loadForm = new Loading(this.Location, this.Size);
     loadForm.Show();
     Application.DoEvents();
     this.InitForm();
     loadForm.Close();
 }
コード例 #13
0
ファイル: BlogLogin.cs プロジェクト: 735756516/PostBlog
        /// <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();
            }
        }
コード例 #14
0
ファイル: ManualPostBlog.cs プロジェクト: 735756516/PostBlog
        /// <summary>
        /// 发布按钮单击事件处理例程
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPublish_Click(object sender, EventArgs e)
        {
            String strTmpTitle = txtTitle.Text.Trim();
            String strTmpDescription = txtDescription.Text.Trim();
            String strTmpCategories = txtSetCategories.Text.Trim();

            if (String.IsNullOrEmpty(strTmpCategories) || strTmpCategories == "Select Blog Categories")
            {
                MessageBox.Show("   Sorry,Please Select Blog Categories.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (String.IsNullOrEmpty(strTmpTitle) || strTmpTitle == "Input Blog Title")
            {
                MessageBox.Show("   Sorry,Please Input Blog Title.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (String.IsNullOrEmpty(strTmpDescription))
            {
                MessageBox.Show("   Sorry,Please Input Blog Content.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            /* 显示加载窗口 */
            Loading loadForm = new Loading(this.Location, this.Size);
            loadForm.Show();
            Application.DoEvents();
            String strResult = this.btnPublishClick(strTmpTitle, strTmpDescription, strTmpCategories);
            loadForm.Close();

            if (String.IsNullOrEmpty(strResult) == false)
            {
                if (strResult.Contains("Succeed") == true)
                {
                    MessageBox.Show(strResult, "Succeed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(strResult, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }