Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        private void DGVFilter()
        {
            try
            {
                // Filter by IP
                if (Regex.Match(mFilterNode.Text, @"^\d+\.\d+\.\d+\.\d+$").Success)
                {
                    FilterByIP(mFilterNode.Text);
                }
                // Remove all filters -> "Sessions" was clicked
                else if (Regex.Match(mFilterNode.Text, "sessions", RegexOptions.IgnoreCase).Success)
                {
                    DisableFilter();
                }
                // Filter by group
                else if (mFilterNode.Text.Length > 0)
                {
                    FilterByGroup(mFilterNode.Text);
                }
                else
                {
                    DisableFilter();
                }
            }
            catch (Exception) { }

            DGV_Sessions.Refresh();
        }
Exemple #2
0
        public void update(List <Session.Config.Session> pRecordList)
        {
            bool lIsLastLine    = false;
            int  lLastPosition  = -1;
            int  lLastRowIndex  = -1;
            int  lSelectedIndex = -1;

            lock (this)
            {
                /*
                 * Remember DGV positions
                 */
                if (DGV_Sessions.CurrentRow != null && DGV_Sessions.CurrentRow == DGV_Sessions.Rows[DGV_Sessions.Rows.Count - 1])
                {
                    lIsLastLine = true;
                }

                lLastPosition = DGV_Sessions.FirstDisplayedScrollingRowIndex;
                lLastRowIndex = DGV_Sessions.Rows.Count - 1;

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


                cSessions.Clear();
                foreach (Session.Config.Session lTmp in pRecordList)
                {
                    cSessions.Add(lTmp);
                }

                DGVFilter();

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


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

                DGV_Sessions.Refresh();
            } // lock (th...
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TSMI_Clear_Click(object sender, EventArgs e)
        {
            /*
             * Clear DataGridView
             */
            if (cSessions != null)
            {
                cSessions.Clear();
            }

            DGV_Sessions.DataSource = cSessions;
            DGV_Sessions.Refresh();

            /*
             * Clear TreeView
             */
            try
            {
                if (TV_Sessions != null && TV_Sessions.Nodes.Count > 0)
                {
                    foreach (TreeNode lNode in TV_Sessions.Nodes)
                    {
                        foreach (TreeNode lSubNode in lNode.Nodes)
                        {
                            if (lSubNode != null && lSubNode.Nodes.Count > 0)
                            {
                                lSubNode.Nodes.Clear();
                            }
                        }
                    }
                }
            }
            catch (Exception lEx)
            {
                cPluginParams.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
            }

            /*
             * Select Main TV-Node.
             */
            mFilterNode = TV_Sessions.Nodes[0];
            TV_Sessions.SelectedNode = TV_Sessions.Nodes[0];
            TV_Sessions.Select();
            //myTreeView.SelectedNode = myTreeNode
        }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DGV_Sessions_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         try
         {
             DataGridView.HitTestInfo hti = DGV_Sessions.HitTest(e.X, e.Y);
             if (hti.RowIndex >= 0)
             {
                 CMS_Sessions.Show(DGV_Sessions, e.Location);
             }
         }
         catch (Exception lEx)
         {
             cPluginParams.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
         }
     }
 }
Exemple #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DGV_Sessions_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                DataGridView.HitTestInfo hti = DGV_Sessions.HitTest(e.X, e.Y);

                if (hti.RowIndex >= 0)
                {
                    DGV_Sessions.ClearSelection();
                    DGV_Sessions.Rows[hti.RowIndex].Selected = true;
                    DGV_Sessions.CurrentCell = DGV_Sessions.Rows[hti.RowIndex].Cells[0];
                }
            }
            catch (Exception lEx)
            {
                cPluginParams.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
                DGV_Sessions.ClearSelection();
            }
        }
Exemple #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteEntryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                BindingList <Session.Config.Session> lTmpHosts = new BindingList <Session.Config.Session>();
                int    lCurIndex = DGV_Sessions.CurrentCell.RowIndex;
                String lHostName = DGV_Sessions.Rows[lCurIndex].Cells[1].Value.ToString();


                cSessions.RemoveAt(lCurIndex);

                DGV_Sessions.DataSource = cSessions;
                DGV_Sessions.Refresh();
            }
            catch (Exception lEx)
            {
                cPluginParams.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
            }
        }
Exemple #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DGV_Session_MouseUp(object sender, MouseEventArgs e)
        {
            DataGridView.HitTestInfo hti;

            if (e.Button == MouseButtons.Right)
            {
                try
                {
                    hti = DGV_Sessions.HitTest(e.X, e.Y);

                    // If cell selection is valid
                    if (hti.ColumnIndex >= 0 && hti.RowIndex >= 0)
                    {
                        DGV_Sessions.CurrentRow.Selected         = false;
                        DGV_Sessions.CurrentCell                 = DGV_Sessions.Rows[hti.RowIndex].Cells[hti.ColumnIndex];
                        DGV_Sessions.Rows[hti.RowIndex].Selected = true;
                        CMS_SessionMgmt.Show(DGV_Sessions, new Point(e.X, e.Y));
                    }
                }
                catch (Exception) { }
            }
        }