public void update(List <AccountingItem> pRecordList)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new updateDelegate(update), new object[] { pRecordList });
                return;
            }

            int lLastPosition  = -1;
            int lLastRowIndex  = -1;
            int lSelectedIndex = -1;

            /*
             * Remember last position
             */
            lLastPosition = DGV_TrafficData.FirstDisplayedScrollingRowIndex;
            lLastRowIndex = DGV_TrafficData.Rows.Count - 1;

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

            try
            {
                DGV_TrafficData.SuspendLayout();
                cAccountingRecords.Clear();
                foreach (AccountingItem lTmp in pRecordList)
                {
                    cAccountingRecords.Add(lTmp);
                }
            }
            catch (Exception) {}

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

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

            DGV_TrafficData.ResumeLayout();
            DGV_TrafficData.Refresh();
        }
        /// <summary>
        ///
        /// </summary>
        public PluginIPAccountingUC(PluginParameters pPluginParams)
        {
            InitializeComponent();


            /*
             * Set DGV double buffer on
             */
            Type         dgvType = DGV_TrafficData.GetType();
            PropertyInfo pi      = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);

            pi.SetValue(DGV_TrafficData, true, null);


            /*
             * Plugin configuration
             */
            cPluginParams = pPluginParams;
            String lBaseDir    = String.Format(@"{0}\", (pPluginParams != null) ? pPluginParams.PluginDirectoryFullPath : Directory.GetCurrentDirectory());
            String lSessionDir = (pPluginParams != null) ? pPluginParams.SessionDirectoryFullPath : String.Format("{0}sessions", lBaseDir);

            Config = new PluginProperties()
            {
                BaseDir           = lBaseDir,
                SessionDir        = lSessionDir,
                PluginName        = "IP accounting",
                PluginDescription = "Listing data traffic statistics.",
                PluginVersion     = "0.8",
                Ports             = "",
                IsActive          = true
            };


            /*
             * Initialisation
             */
            RB_Service_Click(null, null);

            cAccountingRecords         = new BindingList <AccountingItem>();
            DGV_TrafficData.DataSource = cAccountingRecords;

            IPAccountingConfig lConfig = new IPAccountingConfig()
            {
                BasisDirectory     = Config.BaseDir,
                isDebuggingOn      = false,                //cPluginParams.HostApplication.IsDebuggingOn(),
                Interface          = null,                 //cPluginParams.HostApplication.GetInterface(),
                onUpdateList       = update,
                onIPAccountingExit = null
            };

            cTask = TaskFacade.getInstance(lConfig, this);
            DomainFacade.getInstance(lConfig, this).addObserver(this);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DGV_TrafficData_MouseUp(object sender, MouseEventArgs e)
        {
            DataGridView.HitTestInfo hitTestInfo;
            if (e.Button == MouseButtons.Right)
            {
                hitTestInfo = DGV_TrafficData.HitTest(e.X, e.Y);

                // If cell selection is valid
                if (hitTestInfo.ColumnIndex >= 0 && hitTestInfo.RowIndex >= 0)
                {
                    //DGV_TrafficData.Rows[hitTestInfo.RowIndex].Selected = true;
                    CMS_DataGrid_RightMouseButton.Show(DGV_TrafficData, new Point(e.X, e.Y));
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PluginIPAccountingUC_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                DataGridView.HitTestInfo hti = DGV_TrafficData.HitTest(e.X, e.Y);

                if (hti.RowIndex >= 0)
                {
                    DGV_TrafficData.ClearSelection();
                    DGV_TrafficData.Rows[hti.RowIndex].Selected = true;
                    DGV_TrafficData.CurrentCell = DGV_TrafficData.Rows[hti.RowIndex].Cells[0];
                }
            }
            catch (Exception lEx)
            {
                cPluginParams.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message));
                DGV_TrafficData.ClearSelection();
            }
        }