public void onLoadSessionDataFromString(String pSessionData) { if (InvokeRequired) { BeginInvoke(new onLoadSessionDataFromStringDelegate(onLoadSessionDataFromString), new object[] { pSessionData }); return; } // if (InvokeRequired) try { BindingList <HTTPRequests> lRecords = cDomain.loadSessionDataFromString(pSessionData); DGV_HTTPRequests.SuspendLayout(); lock (this) { cHTTPRequests.Clear(); if (lRecords != null && lRecords.Count > 0) { foreach (HTTPRequests lTmp in lRecords) { cHTTPRequests.Insert(0, lTmp); } } } // lock(thi... DGV_HTTPRequests.ResumeLayout(); } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DGV_HTTPRequests_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { try { DataGridView.HitTestInfo hti = DGV_HTTPRequests.HitTest(e.X, e.Y); if (hti.RowIndex >= 0) { CMS_HTTPRequests.Show(DGV_HTTPRequests, e.Location); } } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } } }
public void onLoadSessionDataFromFile(String pSessionName) { if (InvokeRequired) { BeginInvoke(new onLoadSessionDataFromFileDelegate(onLoadSessionDataFromFile), new object[] { pSessionName }); return; } // if (InvokeRequired) try { onResetPlugin(); } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } try { // Update DataGridView BindingList <HTTPRequests> lSessionData = cDomain.loadSessionData(pSessionName); DGV_HTTPRequests.SuspendLayout(); lock (this) { cHTTPRequests.Clear(); if (lSessionData != null && lSessionData.Count > 0) { foreach (HTTPRequests lTmp in lSessionData) { cHTTPRequests.Insert(0, lTmp); } } } // lock(thi... DGV_HTTPRequests.ResumeLayout(); } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DGV_HTTPRequests_MouseDown(object sender, MouseEventArgs e) { try { DataGridView.HitTestInfo hti = DGV_HTTPRequests.HitTest(e.X, e.Y); if (hti.RowIndex >= 0) { DGV_HTTPRequests.ClearSelection(); DGV_HTTPRequests.Rows[hti.RowIndex].Selected = true; DGV_HTTPRequests.CurrentCell = DGV_HTTPRequests.Rows[hti.RowIndex].Cells[0]; } } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); DGV_HTTPRequests.ClearSelection(); } }
/// <summary> /// /// </summary> private void UseFilter() { // without this line we will get an exception :/ da fuq! DGV_HTTPRequests.CurrentCell = null; for (int lCounter = 0; lCounter < DGV_HTTPRequests.RowCount; lCounter++) { try { // this.dataGridView1.Columns["CustomerID"].Visible = false; if (TB_Filter.Text.Length <= 0) { DGV_HTTPRequests.Rows[lCounter].Visible = true; } else { try { String lData = DGV_HTTPRequests.Rows[lCounter].Cells["URL"].Value.ToString(); if (!Regex.Match(lData, Regex.Escape(TB_Filter.Text), RegexOptions.IgnoreCase).Success) { DGV_HTTPRequests.Rows[lCounter].Visible = false; } else { DGV_HTTPRequests.Rows[lCounter].Visible = true; } } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } } } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } } DGV_HTTPRequests.Refresh(); }
public void update(List <HTTPRequests> pHTTPReqList) { lock (this) { bool lIsLastLine = false; int lLastPosition = -1; int lLastRowIndex = -1; int lSelectedIndex = -1; /* * Remember DGV positions */ if (DGV_HTTPRequests.CurrentRow != null && DGV_HTTPRequests.CurrentRow == DGV_HTTPRequests.Rows[DGV_HTTPRequests.Rows.Count - 1]) { lIsLastLine = true; } lLastPosition = DGV_HTTPRequests.FirstDisplayedScrollingRowIndex; lLastRowIndex = DGV_HTTPRequests.Rows.Count - 1; if (DGV_HTTPRequests.CurrentCell != null) { lSelectedIndex = DGV_HTTPRequests.CurrentCell.RowIndex; } cHTTPRequests.Clear(); foreach (HTTPRequests lTmp in pHTTPReqList) { cHTTPRequests.Add(lTmp); // Filter try { if (!CompareToFilter(DGV_HTTPRequests.Rows[DGV_HTTPRequests.Rows.Count - 1].Cells["URL"].Value.ToString())) { DGV_HTTPRequests.Rows[DGV_HTTPRequests.Rows.Count - 1].Visible = false; } } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } } // foreach (HT... // Selected cell/row try { if (lSelectedIndex >= 0) { DGV_HTTPRequests.CurrentCell = DGV_HTTPRequests.Rows[lSelectedIndex].Cells[0]; } } catch { } // Reset position try { if (lIsLastLine) { DGV_HTTPRequests.Rows[DGV_HTTPRequests.Rows.Count - 1].Selected = true; DGV_HTTPRequests.FirstDisplayedScrollingRowIndex = lLastPosition + 1; } else { DGV_HTTPRequests.FirstDisplayedScrollingRowIndex = lLastPosition; } } catch { } DGV_HTTPRequests.Refresh(); } }