Accounts are editable from ScanAccountsDialog via new edit button

This commit is contained in:
Robert McRackan 2020-08-27 11:36:38 -04:00
parent 0025825d5c
commit 99cc6a6425
9 changed files with 67 additions and 20 deletions

View file

@ -12,8 +12,12 @@ namespace LibationWinForms.Dialogs
{
public List<Account> CheckedAccounts { get; } = new List<Account>();
public ScanAccountsDialog()
Form1 _parent { get; }
public ScanAccountsDialog(Form1 parent)
{
_parent = parent;
InitializeComponent();
}
@ -25,6 +29,8 @@ namespace LibationWinForms.Dialogs
}
private void ScanAccountsDialog_Load(object sender, EventArgs e)
{
// DO NOT dispose of this connection.
// Here we (clumsily) connect to the persistent file. Accounts returned from here are used throughout library scan INCLUDING updates. eg: identity tokens
var accounts = AudibleApiStorage.GetPersistentAccountsSettings().Accounts;
foreach (var account in accounts)
@ -34,6 +40,18 @@ namespace LibationWinForms.Dialogs
}
}
private void editBtn_Click(object sender, EventArgs e)
{
if (new AccountsDialog(_parent).ShowDialog()== DialogResult.OK)
{
// clear grid
this.accountsClb.Items.Clear();
// reload grid and default checkboxes
ScanAccountsDialog_Load(sender, e);
}
}
private void importBtn_Click(object sender, EventArgs e)
{
foreach (listItem item in accountsClb.CheckedItems)