Remove Books button now on Main button row

This commit is contained in:
Michael Bucari-Tovo 2022-06-12 17:03:29 -06:00
parent b7b49a60cf
commit 58c52196f1
4 changed files with 108 additions and 57 deletions

View File

@ -42,7 +42,6 @@
this.removeLibraryBooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.closeRemoveBooksColumnToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.liberateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.beginBookBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem();
this.beginPdfBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem();
@ -75,6 +74,8 @@
this.panel1 = new System.Windows.Forms.Panel();
this.productsDisplay = new LibationWinForms.GridView.ProductsDisplay();
this.toggleQueueHideBtn = new System.Windows.Forms.Button();
this.doneRemovingBtn = new System.Windows.Forms.Button();
this.removeBooksBtn = new System.Windows.Forms.Button();
this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
@ -99,7 +100,7 @@
// filterBtn
//
this.filterBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.filterBtn.Location = new System.Drawing.Point(916, 3);
this.filterBtn.Location = new System.Drawing.Point(892, 3);
this.filterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.filterBtn.Name = "filterBtn";
this.filterBtn.Size = new System.Drawing.Size(88, 27);
@ -112,10 +113,11 @@
//
this.filterSearchTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.filterSearchTb.Location = new System.Drawing.Point(196, 7);
this.filterSearchTb.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.filterSearchTb.Location = new System.Drawing.Point(195, 5);
this.filterSearchTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.filterSearchTb.Name = "filterSearchTb";
this.filterSearchTb.Size = new System.Drawing.Size(712, 23);
this.filterSearchTb.Size = new System.Drawing.Size(689, 25);
this.filterSearchTb.TabIndex = 1;
this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress);
//
@ -133,7 +135,7 @@
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(1061, 24);
this.menuStrip1.Size = new System.Drawing.Size(1037, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@ -145,8 +147,7 @@
this.scanLibraryToolStripMenuItem,
this.scanLibraryOfAllAccountsToolStripMenuItem,
this.scanLibraryOfSomeAccountsToolStripMenuItem,
this.removeLibraryBooksToolStripMenuItem,
this.closeRemoveBooksColumnToolStripMenuItem});
this.removeLibraryBooksToolStripMenuItem});
this.importToolStripMenuItem.Name = "importToolStripMenuItem";
this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.importToolStripMenuItem.Text = "&Import";
@ -211,14 +212,6 @@
this.removeSomeAccountsToolStripMenuItem.Text = "Some Accounts";
this.removeSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeSomeAccountsToolStripMenuItem_Click);
//
// closeRemoveBooksColumnToolStripMenuItem
//
this.closeRemoveBooksColumnToolStripMenuItem.Name = "closeRemoveBooksColumnToolStripMenuItem";
this.closeRemoveBooksColumnToolStripMenuItem.Size = new System.Drawing.Size(247, 22);
this.closeRemoveBooksColumnToolStripMenuItem.Text = "&Done Removing Books";
this.closeRemoveBooksColumnToolStripMenuItem.Visible = false;
this.closeRemoveBooksColumnToolStripMenuItem.Click += new System.EventHandler(this.closeRemoveBooksColumnToolStripMenuItem_Click);
//
// liberateToolStripMenuItem
//
this.liberateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -407,7 +400,7 @@
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0);
this.statusStrip1.ShowItemToolTips = true;
this.statusStrip1.Size = new System.Drawing.Size(1061, 22);
this.statusStrip1.Size = new System.Drawing.Size(1037, 22);
this.statusStrip1.TabIndex = 6;
this.statusStrip1.Text = "statusStrip1";
//
@ -421,7 +414,7 @@
// springLbl
//
this.springLbl.Name = "springLbl";
this.springLbl.Size = new System.Drawing.Size(547, 17);
this.springLbl.Size = new System.Drawing.Size(523, 17);
this.springLbl.Spring = true;
//
// backupsCountsLbl
@ -465,7 +458,7 @@
//
this.splitContainer1.Panel2.Controls.Add(this.processBookQueue1);
this.splitContainer1.Size = new System.Drawing.Size(1463, 640);
this.splitContainer1.SplitterDistance = 1061;
this.splitContainer1.SplitterDistance = 1037;
this.splitContainer1.SplitterWidth = 8;
this.splitContainer1.TabIndex = 7;
//
@ -474,6 +467,8 @@
this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel1.Controls.Add(this.productsDisplay);
this.panel1.Controls.Add(this.toggleQueueHideBtn);
this.panel1.Controls.Add(this.doneRemovingBtn);
this.panel1.Controls.Add(this.removeBooksBtn);
this.panel1.Controls.Add(this.addQuickFilterBtn);
this.panel1.Controls.Add(this.filterHelpBtn);
this.panel1.Controls.Add(this.filterSearchTb);
@ -482,7 +477,7 @@
this.panel1.Location = new System.Drawing.Point(0, 24);
this.panel1.Margin = new System.Windows.Forms.Padding(0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1061, 594);
this.panel1.Size = new System.Drawing.Size(1037, 594);
this.panel1.TabIndex = 7;
//
// productsDisplay
@ -494,7 +489,7 @@
this.productsDisplay.Location = new System.Drawing.Point(15, 36);
this.productsDisplay.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.productsDisplay.Name = "productsDisplay";
this.productsDisplay.Size = new System.Drawing.Size(1031, 555);
this.productsDisplay.Size = new System.Drawing.Size(1007, 555);
this.productsDisplay.TabIndex = 9;
this.productsDisplay.VisibleCountChanged += new System.EventHandler<int>(this.productsDisplay_VisibleCountChanged);
this.productsDisplay.RemovableCountChanged += new System.EventHandler<int>(this.productsDisplay_RemovableCountChanged);
@ -504,7 +499,7 @@
// toggleQueueHideBtn
//
this.toggleQueueHideBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.toggleQueueHideBtn.Location = new System.Drawing.Point(1013, 3);
this.toggleQueueHideBtn.Location = new System.Drawing.Point(989, 3);
this.toggleQueueHideBtn.Margin = new System.Windows.Forms.Padding(4, 3, 15, 3);
this.toggleQueueHideBtn.Name = "toggleQueueHideBtn";
this.toggleQueueHideBtn.Size = new System.Drawing.Size(33, 27);
@ -513,6 +508,31 @@
this.toggleQueueHideBtn.UseVisualStyleBackColor = true;
this.toggleQueueHideBtn.Click += new System.EventHandler(this.ToggleQueueHideBtn_Click);
//
// doneRemovingBtn
//
this.doneRemovingBtn.Location = new System.Drawing.Point(406, 3);
this.doneRemovingBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.doneRemovingBtn.Name = "doneRemovingBtn";
this.doneRemovingBtn.Size = new System.Drawing.Size(145, 27);
this.doneRemovingBtn.TabIndex = 4;
this.doneRemovingBtn.Text = "Done Removing Books";
this.doneRemovingBtn.UseVisualStyleBackColor = true;
this.doneRemovingBtn.Visible = false;
this.doneRemovingBtn.Click += new System.EventHandler(this.doneRemovingBtn_Click);
//
// removeBooksBtn
//
this.removeBooksBtn.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.removeBooksBtn.Location = new System.Drawing.Point(206, 3);
this.removeBooksBtn.Margin = new System.Windows.Forms.Padding(15, 3, 4, 3);
this.removeBooksBtn.Name = "removeBooksBtn";
this.removeBooksBtn.Size = new System.Drawing.Size(192, 27);
this.removeBooksBtn.TabIndex = 4;
this.removeBooksBtn.Text = "Remove # Books from Libation";
this.removeBooksBtn.UseVisualStyleBackColor = true;
this.removeBooksBtn.Visible = false;
this.removeBooksBtn.Click += new System.EventHandler(this.removeBooksBtn_Click);
//
// processBookQueue1
//
this.processBookQueue1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@ -520,7 +540,7 @@
this.processBookQueue1.Location = new System.Drawing.Point(0, 0);
this.processBookQueue1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.processBookQueue1.Name = "processBookQueue1";
this.processBookQueue1.Size = new System.Drawing.Size(394, 640);
this.processBookQueue1.Size = new System.Drawing.Size(418, 640);
this.processBookQueue1.TabIndex = 0;
//
// Form1
@ -597,6 +617,7 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button toggleQueueHideBtn;
private LibationWinForms.GridView.ProductsDisplay productsDisplay;
private System.Windows.Forms.ToolStripMenuItem closeRemoveBooksColumnToolStripMenuItem;
private System.Windows.Forms.Button removeBooksBtn;
private System.Windows.Forms.Button doneRemovingBtn;
}
}

View File

@ -11,24 +11,22 @@ namespace LibationWinForms
{
public partial class Form1
{
private ToolStripButton removeCheckedBtn = new();
public void Configure_RemoveBooks()
{
public void Configure_RemoveBooks() { }
#region Create and Add Tool Strip Button
removeCheckedBtn.DisplayStyle = ToolStripItemDisplayStyle.Text;
removeCheckedBtn.Name = "removeSelectedBtn";
removeCheckedBtn.Text = "Remove 0 Books";
removeCheckedBtn.AutoToolTip = false;
removeCheckedBtn.ToolTipText = "Remove checked books and series\r\nfrom Libation's database.\r\n\r\nThey will remain in your Audible account.";
removeCheckedBtn.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
removeCheckedBtn.Alignment = ToolStripItemAlignment.Left;
removeCheckedBtn.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
removeCheckedBtn.Font = new System.Drawing.Font(removeCheckedBtn.Font, System.Drawing.FontStyle.Bold);
removeCheckedBtn.Click += (_, _) => productsDisplay.RemoveCheckedBooksAsync();
removeCheckedBtn.Visible = false;
statusStrip1.Items.Insert(1, removeCheckedBtn);
#endregion
private async void removeBooksBtn_Click(object sender, EventArgs e)
=> await productsDisplay.RemoveCheckedBooksAsync();
private void doneRemovingBtn_Click(object sender, EventArgs e)
{
removeBooksBtn.Visible = false;
doneRemovingBtn.Visible = false;
productsDisplay.CloseRemoveBooksColumn();
//Restore the filter
filterSearchTb.Enabled = true;
filterSearchTb.Visible = true;
performFilter(filterSearchTb.Text);
}
private void removeLibraryBooksToolStripMenuItem_Click(object sender, EventArgs e)
@ -74,30 +72,20 @@ namespace LibationWinForms
//For removing books within a filter set, use
//Visible Books > Remove from library
filterSearchTb.Enabled = false;
filterSearchTb.Visible = false;
productsDisplay.Filter(null);
removeCheckedBtn.Visible = true;
closeRemoveBooksColumnToolStripMenuItem.Visible = true;
removeBooksBtn.Visible = true;
doneRemovingBtn.Visible = true;
await productsDisplay.ScanAndRemoveBooksAsync(accounts);
}
private void closeRemoveBooksColumnToolStripMenuItem_Click(object sender, EventArgs e)
{
removeCheckedBtn.Visible = false;
closeRemoveBooksColumnToolStripMenuItem.Visible = false;
productsDisplay.CloseRemoveBooksColumn();
//Restore the filter
filterSearchTb.Enabled = true;
performFilter(filterSearchTb.Text);
}
private void productsDisplay_RemovableCountChanged(object sender, int removeCount)
{
removeCheckedBtn.Text = removeCount switch
removeBooksBtn.Text = removeCount switch
{
1 => "Remove 1 Book",
_ => $"Remove {removeCount} Books"
1 => "Remove 1 Book from Libation",
_ => $"Remove {removeCount} Books from Libation"
};
}
}

View File

@ -57,12 +57,54 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="filterHelpBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="filterBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="filterSearchTb.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="statusStrip1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="addQuickFilterBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="splitContainer1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="panel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="productsDisplay.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toggleQueueHideBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="doneRemovingBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="removeBooksBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="processBookQueue1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@ -87,7 +87,7 @@ namespace LibationWinForms.GridView
public void CloseRemoveBooksColumn()
=> productsGrid.RemoveColumnVisible = false;
public async void RemoveCheckedBooksAsync()
public async Task RemoveCheckedBooksAsync()
{
var selectedBooks = productsGrid.GetAllBookEntries().Where(lbe => lbe.Remove is RemoveStatus.Removed).ToList();