private void SetValueToListView(List <HistoryItem> list) { listviewURL.Items.Clear(); int Count = 1; listviewURL.SmallImageList = imageList1; foreach (HistoryItem item in list) { HttpsToHttp cv = new HttpsToHttp(item.URL); item.URL = cv.Convert(); GetContentFromURL getc = new GetContentFromURL(item); String content = getc.ExtractContentFromUrl(); ListViewItem lvi; if (content == "") { lvi = new ListViewItem("", 1); } else { lvi = new ListViewItem("", 0); } lvi.SubItems.Add(item.URL); lvi.SubItems.Add(item.Title); lvi.SubItems.Add(item.VisitedTime.ToString()); lvi.SubItems.Add(getc.ExtractContentFromUrl()); lvi.SubItems.Add("BT"); listviewURL.Items.Add(lvi); Count++; } }
private void btnQuet_Click(object sender, EventArgs e) { if (txtDiaChi.Text == "") { XtraMessageBox.Show("Lỗi: Chưa nhập địa chỉ URL", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (!CheckValidURL(txtDiaChi.Text)) { XtraMessageBox.Show("URL không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { LoadingInForm loading = new LoadingInForm(splashScreenManager1); loading.ShowWaitForm(); RemovePreviousSeries(); String url = txtDiaChi.Text; HttpsToHttp cv = new HttpsToHttp(url); url = cv.Convert(); GetContentFromURL get = new GetContentFromURL(new HistoryItem(url, "", DateTime.Now)); String content = get.ExtractContentFromUrl(); if (content != "") { XayDungBieuDo(content); loading.CloseWaitForm(); } else { loading.CloseWaitForm(); XtraMessageBox.Show("Không thể tải nội dung từ URL", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void btnLoad_Click(object sender, EventArgs e) { LoadingInForm loading = new LoadingInForm(splashScreenManager1); loading.ShowWaitForm(); String path = txtPath.Text; String[] lines = System.IO.File.ReadAllLines(path); listviewURL.SmallImageList = imageList1; foreach (string URL in lines) { HistoryItem item = new HistoryItem(); item.URL = URL; GetContentFromURL get = new GetContentFromURL(item); string content = get.ExtractContentFromUrl(); ListViewItem lvi; if (content == "") { lvi = new ListViewItem("", 1); } else { lvi = new ListViewItem("", 0); } string mainContent = Scan(content); lvi.SubItems.Add(URL); lvi.SubItems.Add(content); lvi.SubItems.Add(mainContent); listviewURL.Items.Add(lvi); } loading.CloseWaitForm(); }