예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pRecordList"></param>
        public void updateRecordList(List <SystemRecord> pRecordList)
        {
            bool lIsLastLine    = false;
            int  lLastPosition  = -1;
            int  lLastRowIndex  = -1;
            int  lSelectedIndex = -1;

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

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

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


                cSystems.Clear();
                if (pRecordList != null)
                {
                    foreach (SystemRecord lTmp in pRecordList)
                    {
                        cSystems.Add(new SystemRecord(lTmp.SrcMAC, lTmp.SrcIP, lTmp.UserAgent, lTmp.HWVendor, lTmp.OperatingSystem, lTmp.LastSeen));
                    }
                }

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


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

                DGV_Systems.Refresh();
            }
        }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DGV_Systems_MouseUp_1(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         try
         {
             DataGridView.HitTestInfo hti = DGV_Systems.HitTest(e.X, e.Y);
             if (hti.RowIndex >= 0)
             {
                 CMS_Systems.Show(DGV_Systems, e.Location);
             }
         }
         catch (Exception lEx) { }
     }
 }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DGV_Systems_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         try
         {
             DataGridView.HitTestInfo hti = DGV_Systems.HitTest(e.X, e.Y);
             if (hti.RowIndex >= 0)
             {
                 DGV_Systems.ClearSelection();
                 DGV_Systems.Rows[hti.RowIndex].Selected = true;
                 CMS_ManageSystems.Show(DGV_Systems, e.Location);
             }
         }
         catch (Exception) { }
     }
 }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DGV_Systems_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                DataGridView.HitTestInfo hti = DGV_Systems.HitTest(e.X, e.Y);

                if (hti.RowIndex >= 0)
                {
                    DGV_Systems.ClearSelection();
                    DGV_Systems.Rows[hti.RowIndex].Selected = true;
                    DGV_Systems.CurrentCell = DGV_Systems.Rows[hti.RowIndex].Cells[0];
                }
            }
            catch (Exception)
            {
                DGV_Systems.ClearSelection();
            }
        }