private void _triggersGrid_SelectionChanged(object sender, EventArgs e) { var selected = _triggersGrid.SelectedRows.Count > 0; _triggerParametersGrid.DataSource = _triggersGrid.SelectedRows.Count == 1 ? SelectedTriggers.First().Parameters : null; _triggerParametersGrid.AutoResizeColumns(); _refreshTriggerButton.Enabled = selected; _pauseTriggerButton.Enabled = selected; _resumeTriggerButton.Enabled = selected; _updateTriggerButton.Enabled = _triggersGrid.SelectedRows.Count == 1; _deleteTriggerButton.Enabled = selected; }
private void _refreshTriggerButton_Click(object sender, EventArgs e) { foreach (var trigger in SelectedTriggers) { try { var updated = _client.Get <Trigger>(trigger.Key); CopyObjectValues(updated, trigger); } catch (SDataException ex) { MessageBox.Show(string.Format("Error refreshing trigger '{0}'\r\n{1}", trigger.Key, ex.Message)); if (ex.StatusCode == HttpStatusCode.Gone) { ((ICollection <Trigger>)_triggersGrid.DataSource).Remove(trigger); } } } _triggersGrid.Refresh(); _triggersGrid.AutoResizeColumns(); _triggerParametersGrid.DataSource = _triggersGrid.SelectedRows.Count == 1 ? SelectedTriggers.First().Parameters : null; _triggerParametersGrid.AutoResizeColumns(); }