private async void Loader() { pre_btn.IsEnabled = false; next_btn.IsEnabled = false; pgbarLoading.IsIndeterminate = true; pgbarLoading.Visibility = Visibility.Visible; tbMessage.Text = string.Empty; StatusButton(); string contentHtml = Resource.STR_EMPTY; url = Resource.URL_THREAD.Replace("{rpIdThread}", idThread).Replace("{rpIDPage}", CurrentPage.ToString()); try { await Task.Run(() => threadController.GetContent(url, ref contentHtml)); if (!string.IsNullOrEmpty(contentHtml) && contentHtml != Resource.DIALOG_ERROR) { appSetting.Token = AccountHelper.GetToken(contentHtml); helper.GetMessagePrivate(contentHtml); ThreadModelData threadModelData = new ThreadModelData(contentHtml); // Title TitleThread.Text = threadModelData.TitleThread(); if (TitleThread.Text == Resource.STR_VB_MSG) { DialogResult.DialogOnlyOk(Resource.DIALOG_THREAD_DELETED); return; } // Get max page var CurrentPagePeerMaxPage = threadModelData.GetMaxPage(); fl_page_btnflyout.DataContext = CurrentPagePeerMaxPage; MaxPage = CurrentPagePeerMaxPage.Split('/').LastOrDefault(); // Display Content myWebview.NavigateToString(helper.FullPageThreadHtml(threadModelData.GetThreadData())); pre_btn.IsEnabled = true; next_btn.IsEnabled = true; } else if (contentHtml == Resource.DIALOG_ERROR) { TitleThread.Text = Resource.DIALOG_ERROR; } } catch (Exception) { TitleThread.Text = Resource.DIALOG_ERROR; } pgbarLoading.IsIndeterminate = false; pgbarLoading.Visibility = Visibility.Collapsed; }
private void GetContenFromQuote(string urlQuote) { HtmlDocument docQuote = new HtmlDocument(); string contentHtml = string.Empty; ThreadController.GetContent(urlQuote, ref contentHtml); docQuote.LoadHtml(contentHtml); var contentQuote = (from tx in docQuote.DocumentNode.Descendants("textarea") where (tx.GetAttributeValue("id", "") == "vB_Editor_001_textarea") select tx).FirstOrDefault(); tbComment.Text = HtmlEntity.DeEntitize(contentQuote.InnerText.Trim()); }
private async void Loader() { lv_Post.IsEnabled = false; pgRing.IsActive = true; tbComment.Text = string.Empty; try { doc = new HtmlAgilityPack.HtmlDocument(); await Task.Run(() => ThreadController.GetContent(url, ref contentHtml)); doc.LoadHtml(contentHtml); Hap.RemoveComment(doc); Hap.AnalyzeEmoticon(doc); Hap.RemoveQuoteButton(doc); if (!string.IsNullOrEmpty(appSetting.token)) { if (appSetting.token == "guest") { tbComment.IsEnabled = false; sentMessage.IsEnabled = false; btnEmoticon.IsEnabled = false; } else { tbComment.IsEnabled = true; btnEmoticon.IsEnabled = true; } } else { tbComment.IsEnabled = false; sentMessage.IsEnabled = false; btnEmoticon.IsEnabled = false; } GetMaxPage(); GetTitleThread(); GetComment(); CheckRate(); if (string.IsNullOrEmpty(mxp) == false) { mxp = mxp.Replace("of", "/").Replace("Page", string.Empty).Replace(" ", string.Empty).Trim(); } fl_page_btnflyout.DataContext = mxp; fly_PanelEmoticon.Hide(); } catch (Exception ex) { LogError("Lỗi mạng: \n * Kiểm tra lại kết nối, DNS \n * Có thể lỗi máy chủ. \n *********** \n Chi tiết lỗi: \n" + ex.ToString()); } }