Account to be included on each import item, not just on the aggr group
This commit is contained in:
parent
56732a5365
commit
755a7338e9
15 changed files with 150 additions and 71 deletions
|
|
@ -111,6 +111,7 @@ namespace LibationWinForms.Dialogs
|
|||
|
||||
persister.CommitTransation();
|
||||
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ namespace LibationWinForms.Dialogs
|
|||
this.Shown += IndexLibraryDialog_Shown;
|
||||
}
|
||||
|
||||
private async void IndexLibraryDialog_Shown(object sender, System.EventArgs e)
|
||||
private async void IndexLibraryDialog_Shown(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
(TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.ImportLibraryAsync(new WinformResponder());
|
||||
(TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.ImportAccountAsync(InternalUtilities.AudibleApiStorage.TEST_GetFirstAccount(), new WinformResponder());
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@
|
|||
this.accountsClb.FormattingEnabled = true;
|
||||
this.accountsClb.Location = new System.Drawing.Point(12, 25);
|
||||
this.accountsClb.Name = "accountsClb";
|
||||
this.accountsClb.Size = new System.Drawing.Size(265, 94);
|
||||
this.accountsClb.Size = new System.Drawing.Size(560, 94);
|
||||
this.accountsClb.TabIndex = 1;
|
||||
//
|
||||
// importBtn
|
||||
//
|
||||
this.importBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.importBtn.Location = new System.Drawing.Point(101, 125);
|
||||
this.importBtn.Location = new System.Drawing.Point(396, 125);
|
||||
this.importBtn.Name = "importBtn";
|
||||
this.importBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.importBtn.TabIndex = 2;
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
//
|
||||
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelBtn.Location = new System.Drawing.Point(202, 125);
|
||||
this.cancelBtn.Location = new System.Drawing.Point(497, 125);
|
||||
this.cancelBtn.Name = "cancelBtn";
|
||||
this.cancelBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.cancelBtn.TabIndex = 3;
|
||||
|
|
@ -83,13 +83,14 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelBtn;
|
||||
this.ClientSize = new System.Drawing.Size(289, 160);
|
||||
this.ClientSize = new System.Drawing.Size(584, 160);
|
||||
this.Controls.Add(this.cancelBtn);
|
||||
this.Controls.Add(this.importBtn);
|
||||
this.Controls.Add(this.accountsClb);
|
||||
this.Controls.Add(this.accountsLbl);
|
||||
this.Name = "ScanAccountsDialog";
|
||||
this.Text = "Which accounts?";
|
||||
this.Load += new System.EventHandler(this.ScanAccountsDialog_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using InternalUtilities;
|
||||
|
||||
namespace LibationWinForms.Dialogs
|
||||
{
|
||||
public partial class ScanAccountsDialog : Form
|
||||
{
|
||||
public List<Account> CheckedAccounts { get; } = new List<Account>();
|
||||
|
||||
public ScanAccountsDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
class listItem
|
||||
{
|
||||
public Account Account { get; set; }
|
||||
public string Text { get; set; }
|
||||
public override string ToString() => Text;
|
||||
}
|
||||
private void ScanAccountsDialog_Load(object sender, EventArgs e)
|
||||
{
|
||||
var accounts = AudibleApiStorage.GetPersistentAccountsSettings().Accounts;
|
||||
|
||||
foreach (var account in accounts)
|
||||
{
|
||||
var item = new listItem { Account=account,Text = $"{account.AccountName} ({account.AccountId} - {account.Locale.Name})" };
|
||||
this.accountsClb.Items.Add(item, account.LibraryScan);
|
||||
}
|
||||
}
|
||||
|
||||
private void importBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (listItem item in accountsClb.CheckedItems)
|
||||
CheckedAccounts.Add(item.Account);
|
||||
|
||||
|
||||
|
||||
// this.Close();
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void cancelBtn_Click(object sender, EventArgs e) => this.Close();
|
||||
|
|
|
|||
|
|
@ -258,6 +258,17 @@ private void scanLibraryOfAllAccountsToolStripMenuItem_Click(object sender, Even
|
|||
|
||||
private void scanLibraryOfSomeAccountsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var scanAccountsDialog = new ScanAccountsDialog();
|
||||
|
||||
if (scanAccountsDialog.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (!scanAccountsDialog.CheckedAccounts.Any())
|
||||
return;
|
||||
|
||||
var checkedAccounts = scanAccountsDialog.CheckedAccounts;
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue