/// <summary> /// On bank services combobox selected index change /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event args</param> private void bankServicesCb_SelectedIndexChanged(object sender, EventArgs e) { try { // Selected filter item var item = (BankServices)bankServicesCb.SelectedItem; // If selected item is as same as previous, skip if (item == CurrentServiceFilter) { return; } // Save filter states var current = ServicesDictionary.FirstOrDefault(k => k.Key == item); var past = ServicesDictionary.FirstOrDefault(k => k.Key == CurrentServiceFilter); this.CurrentServiceFilter = item; // Hide/show based on filter current.Value.Visible = true; past.Value.Visible = false; } catch (Exception eas) { } }
/// <summary> /// On bank services combo box selected index change /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">Event args</param> private void bankServicesCb_SelectedIndexChanged(object sender, EventArgs e) { try { // Retrieve selected bank service from combo box var item = (BankServices)bankServicesCb.SelectedItem; if (item == CurrentServiceFilter) { return; } // Remember filter for future use var current = ServicesDictionary.FirstOrDefault(k => k.Key == item); var past = ServicesDictionary.FirstOrDefault(k => k.Key == CurrentServiceFilter); this.CurrentServiceFilter = item; // Hide based on filter current.Value.Button.Visible = true; current.Value.DataGridView.Visible = true; past.Value.DataGridView.Visible = false; past.Value.Button.Visible = false; } catch (Exception eas) { } }
public void UpdateRun(PeriodicServiceOptions options, long iteration, long runDuration, string error) { if (options == null) { throw new ArgumentException(nameof(options)); } if (string.IsNullOrWhiteSpace(options.ServiceName)) { throw new Exception("options.ServiceName is empty"); } ServicesDictionary.AddOrUpdate(options.ServiceName, s => AddService(s, options, iteration), (s, entity) => UpdateRunService(s, entity, options, iteration, runDuration, error)); }