/// <summary> /// 发布按钮事件处理 /// </summary> /// <param name="strTmpTitle"></param> /// <param name="strTmpDescription"></param> /// <param name="strTmpCategories"></param> private String btnPublishClick(String strTmpTitle, String strTmpDescription, String strTmpCategories) { System.Threading.Thread.Sleep(1500); String strResult = String.Empty; try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strTmpTitle; post.description = strTmpDescription; post.categories = strTmpCategories.Split(','); String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); txtSetCategories.Text = "Select Blog Categories"; txtTitle.Text = "Input Blog Title"; txtDescription.Text = String.Empty; for (int i = 0; i < chkBoxListCategories.Items.Count; i++) { chkBoxListCategories.SetItemChecked(i, false); } chkBoxListCategories.Focus(); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } return(strResult); }
/// <summary> /// 发布按钮事件处理 /// </summary> /// <param name="strTmpTitle"></param> /// <param name="strTmpDescription"></param> /// <param name="strTmpCategories"></param> private String btnPublishClick(String strTmpTitle, String strTmpDescription, String strTmpCategories) { System.Threading.Thread.Sleep(1500); String strResult = String.Empty; try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strTmpTitle; post.description = strTmpDescription; post.categories = strTmpCategories.Split(','); String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); txtSetCategories.Text = "Select Blog Categories"; txtTitle.Text = "Input Blog Title"; txtDescription.Text = String.Empty; for (int i = 0; i < chkBoxListCategories.Items.Count; i++) { chkBoxListCategories.SetItemChecked(i, false); } chkBoxListCategories.Focus(); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } return strResult; }
/// <summary> /// 重新绑定最近的 Post 列表 /// </summary> private void ReBindRecentPost() { /* 重新绑定数据 */ recentPostList.Clear(); try { recentPostList = new List <MetaWeblogEntity.Post>(metaWeblog.getRecentPosts(String.Empty, strUserName, strPassword, ConfigEntity.Recent_Post_Count)); if (recentPostList != null && recentPostList.Count > 0) { List <Int32> indexList = new List <Int32>(); for (int i = 0; i < recentPostList.Count; i++) { try { MetaWeblogEntity.Post post = metaWeblog.getPost(recentPostList[i].postid.ToString(), strUserName, strPassword); if (recentPostList[i].postid.ToString() == post.postid.ToString()) { indexList.Add(i); } } catch (Exception ex) { } } List <MetaWeblogEntity.Post> tmpRecentPostList = new List <MetaWeblogEntity.Post>(); dgvRecent.Rows.Clear(); for (int i = 0; i < indexList.Count; i++) { dgvRecent.Rows.Add(i + 1, recentPostList[indexList[i]].title, strUserName, recentPostList[indexList[i]].dateCreated.ToString("yyyy-MM-dd HH:mm")); tmpRecentPostList.Add(recentPostList[indexList[i]]); } recentPostList.Clear(); recentPostList.AddRange(tmpRecentPostList); } } catch (Exception ex) { PInvokeAPI.OutputDebugString("Error In ReBindRecentPost,ErrorMessage: " + ex.Message); recentPostList.Clear(); } }
public bool editPost(String postid, String username, String password, MetaWeblogEntity.Post content, bool publish) { return((bool)this.Invoke("editPost", new object[] { postid, username, password, content, publish })); }
public String newPost(String blogid, String username, String password, MetaWeblogEntity.Post content, bool publish) { content.dateCreated.AddHours(-1); return((String)this.Invoke("newPost", new object[] { blogid, username, password, content, publish })); }
/// <summary> /// 发布用户选择的按钮单击事件处理 /// </summary> private String btnPublishSelectedClick() { String strResult = String.Empty; String strSelected = cbBoxDefaultURL.SelectedItem.ToString(); if (String.IsNullOrEmpty(strSelected) == false) { String strCategories = GetSelectedCategories(); switch (strSelected) { case ConfigEntity.TechCrunch_Article_Name: { /* TechCrunch 文章列表 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strTechCrunchHTML = String.Empty; String strTechCrunchURL = strTechCrunchUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strTechCrunchURL, Encoding.UTF8, ref strTechCrunchHTML) == true && String.IsNullOrEmpty(strTechCrunchHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; TechCrunchBLL.GetArticleBodyFromTechCrunch(strTechCrunchHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.title = strTechCrunchTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.post_status = "new"; post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.InfoSecurity_Article_Name: { /* 资安人文章列表 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strInfoSecurityHTML = String.Empty; String strInfoSecurityURL = strInfoSecurityUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strInfoSecurityURL, Encoding.UTF8, ref strInfoSecurityHTML) == true && String.IsNullOrEmpty(strInfoSecurityHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; InfoSecurityBLL.GetArticleBodyFromInfoSecurity(strInfoSecurityHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.title = strInfoSecurityTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.post_status = "new"; post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CIOAge_HomePage_Name: { /* CIOAge 首页 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCIOAgeBlogsHTML = String.Empty; String strCIOAgeBlogsURL = strCIOAgeHomePageUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strCIOAgeBlogsURL, Encoding.Default, ref strCIOAgeBlogsHTML) == true && String.IsNullOrEmpty(strCIOAgeBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CIOAgeBLL.GetArticleBodyFromCIOAge(strCIOAgeBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.title = strCIOAgeHomePageTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.post_status = "new"; post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CppBlog_HomePage_Name: { /* C++ 博客首页区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCppBlogBlogsHTML = String.Empty; String strCppBlogBlogsURL = strCppBlogHomePageUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strCppBlogBlogsURL, Encoding.UTF8, ref strCppBlogBlogsHTML) == true && String.IsNullOrEmpty(strCppBlogBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CppBlogBLL.GetBlogsBodyFromCppBlog(strCppBlogBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCppBlogHomePageTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CnBlogs_HomePage_Name: { /* 博客园首页区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCnBlogsBlogsHTML = String.Empty; String strCnBlogsBlogsURL = strCnBlogsHomePageUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strCnBlogsBlogsURL, Encoding.UTF8, ref strCnBlogsBlogsHTML) == true && String.IsNullOrEmpty(strCnBlogsBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CnBlogsBLL.GetBlogsBodyFromCnBlogs(strCnBlogsBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCnBlogsHomePageTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CnBlogs_News_Name: { /* 博客园新闻区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCnBlogsNewsHTML = String.Empty; String strCnBlogsNewsURL = strCnBlogsNewsUrlList[nIndex]; ; if (DownloadBLL.DownloadHTML2String(strCnBlogsNewsURL, Encoding.UTF8, ref strCnBlogsNewsHTML) == true && String.IsNullOrEmpty(strCnBlogsNewsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CnBlogsBLL.GetNewsBodyFromCnBlogs(strCnBlogsNewsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCnBlogsNewsTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CnBlogs_Precious_Name: { /* 博客园精华区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCnBlogsBlogsHTML = String.Empty; String strCnBlogsBlogsURL = strCnBlogsPreciousUrlList[nIndex]; ; if (DownloadBLL.DownloadHTML2String(strCnBlogsBlogsURL, Encoding.UTF8, ref strCnBlogsBlogsHTML) == true && String.IsNullOrEmpty(strCnBlogsBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CnBlogsBLL.GetBlogsBodyFromCnBlogs(strCnBlogsBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCnBlogsPreciousTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } default: { break; } } ClearDefaultSelectedBlogs(); } System.Threading.Thread.Sleep(1500); return strResult; }
/// <summary> /// 发布用户选择的按钮单击事件处理 /// </summary> private String btnPublishSelectedClick() { String strResult = String.Empty; String strSelected = cbBoxDefaultURL.SelectedItem.ToString(); if (String.IsNullOrEmpty(strSelected) == false) { String strCategories = GetSelectedCategories(); switch (strSelected) { case ConfigEntity.TechCrunch_Article_Name: { /* TechCrunch 文章列表 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strTechCrunchHTML = String.Empty; String strTechCrunchURL = strTechCrunchUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strTechCrunchURL, Encoding.UTF8, ref strTechCrunchHTML) == true && String.IsNullOrEmpty(strTechCrunchHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; TechCrunchBLL.GetArticleBodyFromTechCrunch(strTechCrunchHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.title = strTechCrunchTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.post_status = "new"; post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.InfoSecurity_Article_Name: { /* 资安人文章列表 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strInfoSecurityHTML = String.Empty; String strInfoSecurityURL = strInfoSecurityUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strInfoSecurityURL, Encoding.UTF8, ref strInfoSecurityHTML) == true && String.IsNullOrEmpty(strInfoSecurityHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; InfoSecurityBLL.GetArticleBodyFromInfoSecurity(strInfoSecurityHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.title = strInfoSecurityTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.post_status = "new"; post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CIOAge_HomePage_Name: { /* CIOAge 首页 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCIOAgeBlogsHTML = String.Empty; String strCIOAgeBlogsURL = strCIOAgeHomePageUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strCIOAgeBlogsURL, Encoding.Default, ref strCIOAgeBlogsHTML) == true && String.IsNullOrEmpty(strCIOAgeBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CIOAgeBLL.GetArticleBodyFromCIOAge(strCIOAgeBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.title = strCIOAgeHomePageTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.post_status = "new"; post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CppBlog_HomePage_Name: { /* C++ 博客首页区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCppBlogBlogsHTML = String.Empty; String strCppBlogBlogsURL = strCppBlogHomePageUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strCppBlogBlogsURL, Encoding.UTF8, ref strCppBlogBlogsHTML) == true && String.IsNullOrEmpty(strCppBlogBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CppBlogBLL.GetBlogsBodyFromCppBlog(strCppBlogBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCppBlogHomePageTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CnBlogs_HomePage_Name: { /* 博客园首页区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCnBlogsBlogsHTML = String.Empty; String strCnBlogsBlogsURL = strCnBlogsHomePageUrlList[nIndex]; if (DownloadBLL.DownloadHTML2String(strCnBlogsBlogsURL, Encoding.UTF8, ref strCnBlogsBlogsHTML) == true && String.IsNullOrEmpty(strCnBlogsBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CnBlogsBLL.GetBlogsBodyFromCnBlogs(strCnBlogsBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCnBlogsHomePageTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CnBlogs_News_Name: { /* 博客园新闻区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCnBlogsNewsHTML = String.Empty; String strCnBlogsNewsURL = strCnBlogsNewsUrlList[nIndex];; if (DownloadBLL.DownloadHTML2String(strCnBlogsNewsURL, Encoding.UTF8, ref strCnBlogsNewsHTML) == true && String.IsNullOrEmpty(strCnBlogsNewsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CnBlogsBLL.GetNewsBodyFromCnBlogs(strCnBlogsNewsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCnBlogsNewsTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } case ConfigEntity.CnBlogs_Precious_Name: { /* 博客园精华区 */ for (int i = 0; i < dgvDefault.SelectedRows.Count; i++) { Int32 nIndex = (Int32)dgvDefault.SelectedRows[i].Cells[0].Value - 1; String strCnBlogsBlogsHTML = String.Empty; String strCnBlogsBlogsURL = strCnBlogsPreciousUrlList[nIndex];; if (DownloadBLL.DownloadHTML2String(strCnBlogsBlogsURL, Encoding.UTF8, ref strCnBlogsBlogsHTML) == true && String.IsNullOrEmpty(strCnBlogsBlogsHTML) == false) { String strBodyOuterHtml = String.Empty; String strBodyInnerHtml = String.Empty; String strBodyInnerText = String.Empty; CnBlogsBLL.GetBlogsBodyFromCnBlogs(strCnBlogsBlogsHTML, ref strBodyOuterHtml, ref strBodyInnerHtml, ref strBodyInnerText); try { MetaWeblogEntity.Post post = new MetaWeblogEntity.Post(); post.dateCreated = DateTime.Now; post.title = strCnBlogsPreciousTitleList[nIndex]; post.description = strBodyOuterHtml; post.categories = String.IsNullOrEmpty(strCategories) == true ? null : strCategories.Split(','); post.dateCreated = DateTime.Now; String strPostID = metaWeblog.newPost(String.Empty, strUserName, strPassword, post, true); strResult = " Publish Blog Succeed."; } catch (Exception ex) { strResult = " Publish Blog Failed,Error Message: " + ex.Message; } } } break; } default: { break; } } ClearDefaultSelectedBlogs(); } System.Threading.Thread.Sleep(1500); return(strResult); }