private void btnAdd_Click(object sender, EventArgs e) { var newAccount = new XCommasAccount(); var settings = new AddAccountDialog("Add 3Commas Account", "Add", "Permissions Needed: BotsRead, BotsWrite, AccountsRead", newAccount); var dr = settings.ShowDialog(); if (dr == DialogResult.OK) { Accounts.Add(newAccount); } }
private void btnEdit_Click(object sender, EventArgs e) { if (listBox.SelectedItem == null) { ObjectContainer.MessageBoxService.ShowError("No Account selected."); return; } var account = listBox.SelectedItem as XCommasAccount; var settings = new AddAccountDialog("Edit 3Commas Account", "Apply", "Permissions Needed: BotsRead, BotsWrite, AccountsRead", account); var dr = settings.ShowDialog(); if (dr == DialogResult.OK) { listBox.DataSource = null; listBox.DataSource = Accounts; listBox.DisplayMember = nameof(XCommasAccount.Name); listBox.ValueMember = nameof(XCommasAccount.Id); } }