public void onLoadSessionDataFromString(String pSessionData) { if (InvokeRequired) { BeginInvoke(new onLoadSessionDataFromStringDelegate(onLoadSessionDataFromString), new object[] { pSessionData }); return; } // if (InvokeRequired) try { // Update DataGridView DGV_FWRules.SuspendLayout(); BindingList <FWRule> lRecords = cDomain.loadSessionDataFromString(pSessionData); if (lRecords != null && lRecords.Count > 0) { cFWRules.Clear(); foreach (FWRule lReq in lRecords) { cFWRules.Add(lReq); } } // if (lRecords ... DGV_FWRules.ResumeLayout(); } catch (Exception lEx) { PluginParameters.HostApplication.LogMessage(String.Format("{0}: {1}", Config.PluginName, lEx.Message)); } }
/// <summary> /// DGV right mouse button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DGV_FWRules_MouseUp(object sender, MouseEventArgs e) { DataGridView.HitTestInfo hitTestInfo; if (e.Button == MouseButtons.Right) { hitTestInfo = DGV_FWRules.HitTest(e.X, e.Y); // If cell selection is valid if (hitTestInfo.ColumnIndex >= 0 && hitTestInfo.RowIndex >= 0) { DGV_FWRules.Rows[hitTestInfo.RowIndex].Selected = true; CMS_DataGrid_RightMouseButton.Show(DGV_FWRules, new Point(e.X, e.Y)); } } }