private void BuildList() { try { dataGridViewActions.SuspendLayout(); dataGridViewActions.Rows.Clear(); var actions = ConnectionsManager.History.FindAll(CanAddRowAction); SortActions(actions); var rows = new List <DataGridViewActionRow>(); foreach (var action in actions) { var row = new DataGridViewActionRow(action); rows.Add(row); } dataGridViewActions.Rows.AddRange(rows.ToArray()); foreach (DataGridViewActionRow row in dataGridViewActions.Rows) { RegisterActionEvents(row.Action); } } finally { dataGridViewActions.ResumeLayout(); } }
private void row_DismissalRequested(DataGridViewActionRow row) { if (ConnectionsManager.History.Count > 0) { if (!Program.RunInAutomatedTestMode && !Properties.Settings.Default.DoNotConfirmDismissEvents) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOG_DELETE), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo) { ShowCheckbox = true, CheckboxCaption = Messages.DO_NOT_SHOW_THIS_MESSAGE }) { var result = dlg.ShowDialog(this); Properties.Settings.Default.DoNotConfirmDismissEvents = dlg.IsCheckBoxChecked; Settings.TrySaveSettings(); if (result != DialogResult.Yes) { return; } } } ConnectionsManager.History.Remove(row.Action); } }
private void History_CollectionChanged(object sender, CollectionChangeEventArgs e) { Program.BeginInvoke(this, () => { ActionBase action = (ActionBase)e.Element; switch (e.Action) { case CollectionChangeAction.Add: var actions = ConnectionsManager.History.FindAll(CanAddRowAction); SortActions(actions); var index = actions.IndexOf(action); if (index > -1) { var row = new DataGridViewActionRow(action); dataGridViewActions.Rows.Insert(0, row); RegisterActionEvents(action); } break; case CollectionChangeAction.Remove: RemoveActionRow(action); break; case CollectionChangeAction.Refresh: BuildList(); break; } }); }
private DataGridViewActionRow CreateActionRow(ActionBase action) { var row = new DataGridViewActionRow(action); row.DismissalRequested += row_DismissalRequested; row.GoToXenObjectRequested += row_GoToXenObjectRequested; return(row); }
private void row_DismissalRequested(DataGridViewActionRow row) { if (ConnectionsManager.History.Count > 0 && (Program.RunInAutomatedTestMode || new ThreeButtonDialog( new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOG_DELETE, Messages.MESSAGEBOX_LOG_DELETE_TITLE), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo).ShowDialog(this) == DialogResult.Yes)) { ConnectionsManager.History.Remove(row.Action); } }
private void row_DismissalRequested(DataGridViewActionRow row) { if (ConnectionsManager.History.Count > 0) { DialogResult dialogResult = DialogResult.Yes; if (!Program.RunInAutomatedTestMode) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOG_DELETE), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)) { dialogResult = dlg.ShowDialog(this); } } if (dialogResult == DialogResult.Yes) { ConnectionsManager.History.Remove(row.Action); } } }
private DataGridViewActionRow CreateActionRow(ActionBase action) { var row = new DataGridViewActionRow(action); row.DismissalRequested += row_DismissalRequested; row.GoToXenObjectRequested += row_GoToXenObjectRequested; return row; }
private void row_DismissalRequested(DataGridViewActionRow row) { if (ConnectionsManager.History.Count > 0) { if (!Program.RunInAutomatedTestMode && !Properties.Settings.Default.DoNotConfirmDismissEvents) { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(null, Messages.MESSAGEBOX_LOG_DELETE), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo) { ShowCheckbox = true, CheckboxCaption = Messages.DO_NOT_SHOW_THIS_MESSAGE }) { var result = dlg.ShowDialog(this); Properties.Settings.Default.DoNotConfirmDismissEvents = dlg.IsCheckBoxChecked; Settings.TrySaveSettings(); if (result != DialogResult.Yes) return; } } ConnectionsManager.History.Remove(row.Action); } }
private void BuildList() { try { dataGridViewActions.SuspendLayout(); dataGridViewActions.Rows.Clear(); var actions = ConnectionsManager.History.FindAll(CanAddRowAction); SortActions(actions); var rows = new List<DataGridViewActionRow>(); foreach (var action in actions) { var row = new DataGridViewActionRow(action); rows.Add(row); } dataGridViewActions.Rows.AddRange(rows.ToArray()); foreach (DataGridViewActionRow row in dataGridViewActions.Rows) RegisterActionEvents(row.Action); } finally { dataGridViewActions.ResumeLayout(); } }