Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        private void UseFilter()
        {
            // without this line we will get an exception :/ da fuq!
            DGV_DNSRequests.CurrentCell = null;
            for (int lCounter = 0; lCounter < DGV_DNSRequests.Rows.Count; lCounter++)
            {
                if (TB_Filter.Text.Length <= 0)
                {
                    DGV_DNSRequests.Rows[lCounter].Visible = true;
                }
                else
                {
                    try
                    {
                        String lData = DGV_DNSRequests.Rows[lCounter].Cells["DNSHostname"].Value.ToString();
                        if (!Regex.Match(lData, Regex.Escape(TB_Filter.Text), RegexOptions.IgnoreCase).Success)
                        {
                            DGV_DNSRequests.Rows[lCounter].Visible = false;
                        }
                        else
                        {
                            DGV_DNSRequests.Rows[lCounter].Visible = true;
                        }
                    }
                    catch (Exception lEx)
                    {
                        PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
                    }
                }
            }

            DGV_DNSRequests.Refresh();
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DGV_DNSRequests_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         try
         {
             DataGridView.HitTestInfo hti = DGV_DNSRequests.HitTest(e.X, e.Y);
             if (hti.RowIndex >= 0)
             {
                 CMS_DNSRequests.Show(DGV_DNSRequests, e.Location);
             }
         }
         catch (Exception lEx)
         {
             PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DGV_DNSRequests_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                DataGridView.HitTestInfo hti = DGV_DNSRequests.HitTest(e.X, e.Y);

                if (hti.RowIndex >= 0)
                {
                    DGV_DNSRequests.ClearSelection();
                    DGV_DNSRequests.Rows[hti.RowIndex].Selected = true;
                    DGV_DNSRequests.CurrentCell = DGV_DNSRequests.Rows[hti.RowIndex].Cells[0];
                }
            }
            catch (Exception lEx)
            {
                PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
                DGV_DNSRequests.ClearSelection();
            }
        }
Esempio n. 4
0
        public void update(BindingList <DNSRequestRecord> pDNSReqList)
        {
            int  lLastPosition  = -1;
            int  lLastRowIndex  = -1;
            int  lSelectedIndex = -1;
            bool lIsLastLine    = false;


            if (pDNSReqList != null)
            {
                if (DGV_DNSRequests.CurrentRow != null && DGV_DNSRequests.CurrentRow == DGV_DNSRequests.Rows[DGV_DNSRequests.Rows.Count - 1])
                {
                    lIsLastLine = true;
                }

                lock (this)
                {
                    /*
                     * Remember last position
                     */
                    lLastPosition = DGV_DNSRequests.FirstDisplayedScrollingRowIndex;
                    lLastRowIndex = DGV_DNSRequests.Rows.Count - 1;

                    if (DGV_DNSRequests.CurrentCell != null)
                    {
                        lSelectedIndex = DGV_DNSRequests.CurrentCell.RowIndex;
                    }

                    DGV_DNSRequests.SuspendLayout();
                    cDNSRequests.Clear();


                    foreach (DNSRequestRecord lTmp in pDNSReqList)
                    {
                        cDNSRequests.Add(lTmp);

                        // Filter
                        try
                        {
                            if (!CompareToFilter(DGV_DNSRequests.Rows[DGV_DNSRequests.Rows.Count - 1].Cells["DNSHostname"].Value.ToString()))
                            {
                                DGV_DNSRequests.Rows[DGV_DNSRequests.Rows.Count - 1].Visible = false;
                            }
                        }
                        catch (Exception lEx)
                        {
                            PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
                        }
                    } // foreach (DNS...


                    // Selected cell/row
                    try
                    {
                        if (lSelectedIndex >= 0)
                        {
                            DGV_DNSRequests.CurrentCell = DGV_DNSRequests.Rows[lSelectedIndex].Cells[0];
                        }
                    }
                    catch (Exception) { }


                    // Reset position
                    try
                    {
                        if (lLastPosition >= 0)
                        {
                            DGV_DNSRequests.FirstDisplayedScrollingRowIndex = lLastPosition;
                        }
                    }
                    catch (Exception) { }
                }

                DGV_DNSRequests.ResumeLayout();

                DGV_DNSRequests.Refresh();
            } // if (pDNSReqL...
        }