diff --git a/Source/ApplicationServices/LibraryCommands.cs b/Source/ApplicationServices/LibraryCommands.cs index 027ae536..8c181354 100644 --- a/Source/ApplicationServices/LibraryCommands.cs +++ b/Source/ApplicationServices/LibraryCommands.cs @@ -259,12 +259,11 @@ namespace ApplicationServices LibrarySizeChanged?.Invoke(null, null); } - /// Occurs when books are added or removed from library + /// Occurs when the size of the library changes. ie: books are added or removed public static event EventHandler LibrarySizeChanged; /// - /// Occurs when , , or - /// changed values are successfully persisted. + /// Occurs when the size of the library does not change but book(s) details do. Especially when , , or changed values are successfully persisted. /// public static event EventHandler BookUserDefinedItemCommitted; diff --git a/Source/LibationWinForms/Form1.Designer.cs b/Source/LibationWinForms/Form1.Designer.cs index 1d49c0a9..a9c77e74 100644 --- a/Source/LibationWinForms/Form1.Designer.cs +++ b/Source/LibationWinForms/Form1.Designer.cs @@ -35,8 +35,8 @@ this.filterSearchTb = new System.Windows.Forms.TextBox(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.noAccountsYetAddAccountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoScanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.noAccountsYetAddAccountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanLibraryOfAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanLibraryOfSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -65,6 +65,11 @@ this.backupsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel(); this.pdfsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel(); this.addFilterBtn = new System.Windows.Forms.Button(); + this.visibleBooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.liberateToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.replaceTagsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.setDownloadedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -74,18 +79,18 @@ this.gridPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.gridPanel.Location = new System.Drawing.Point(14, 65); - this.gridPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.gridPanel.Location = new System.Drawing.Point(34, 178); + this.gridPanel.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); this.gridPanel.Name = "gridPanel"; - this.gridPanel.Size = new System.Drawing.Size(979, 445); + this.gridPanel.Size = new System.Drawing.Size(2378, 1216); this.gridPanel.TabIndex = 5; // // filterHelpBtn // - this.filterHelpBtn.Location = new System.Drawing.Point(14, 31); - this.filterHelpBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.filterHelpBtn.Location = new System.Drawing.Point(34, 85); + this.filterHelpBtn.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); this.filterHelpBtn.Name = "filterHelpBtn"; - this.filterHelpBtn.Size = new System.Drawing.Size(26, 27); + this.filterHelpBtn.Size = new System.Drawing.Size(63, 74); this.filterHelpBtn.TabIndex = 3; this.filterHelpBtn.Text = "?"; this.filterHelpBtn.UseVisualStyleBackColor = true; @@ -94,10 +99,10 @@ // 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(905, 31); - this.filterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.filterBtn.Location = new System.Drawing.Point(2198, 85); + this.filterBtn.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); this.filterBtn.Name = "filterBtn"; - this.filterBtn.Size = new System.Drawing.Size(88, 27); + this.filterBtn.Size = new System.Drawing.Size(214, 74); this.filterBtn.TabIndex = 2; this.filterBtn.Text = "Filter"; this.filterBtn.UseVisualStyleBackColor = true; @@ -107,26 +112,28 @@ // 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(217, 33); - this.filterSearchTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.filterSearchTb.Location = new System.Drawing.Point(527, 90); + this.filterSearchTb.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); this.filterSearchTb.Name = "filterSearchTb"; - this.filterSearchTb.Size = new System.Drawing.Size(681, 23); + this.filterSearchTb.Size = new System.Drawing.Size(1648, 47); this.filterSearchTb.TabIndex = 1; this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress); // // menuStrip1 // + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.importToolStripMenuItem, this.liberateToolStripMenuItem, this.exportToolStripMenuItem, this.quickFiltersToolStripMenuItem, - this.settingsToolStripMenuItem, - this.scanningToolStripMenuItem}); + this.scanningToolStripMenuItem, + this.visibleBooksToolStripMenuItem, + this.settingsToolStripMenuItem}); 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(1007, 24); + this.menuStrip1.Padding = new System.Windows.Forms.Padding(17, 5, 0, 5); + this.menuStrip1.Size = new System.Drawing.Size(2446, 58); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -140,41 +147,41 @@ this.scanLibraryOfSomeAccountsToolStripMenuItem, this.removeLibraryBooksToolStripMenuItem}); this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20); + this.importToolStripMenuItem.Size = new System.Drawing.Size(132, 48); this.importToolStripMenuItem.Text = "&Import"; // - // noAccountsYetAddAccountToolStripMenuItem - // - this.noAccountsYetAddAccountToolStripMenuItem.Name = "noAccountsYetAddAccountToolStripMenuItem"; - this.noAccountsYetAddAccountToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.noAccountsYetAddAccountToolStripMenuItem.Text = "No accounts yet. A&dd Account..."; - this.noAccountsYetAddAccountToolStripMenuItem.Click += new System.EventHandler(this.noAccountsYetAddAccountToolStripMenuItem_Click); - // // autoScanLibraryToolStripMenuItem // this.autoScanLibraryToolStripMenuItem.Name = "autoScanLibraryToolStripMenuItem"; - this.autoScanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.autoScanLibraryToolStripMenuItem.Size = new System.Drawing.Size(613, 54); this.autoScanLibraryToolStripMenuItem.Text = "A&uto Scan Library"; this.autoScanLibraryToolStripMenuItem.Click += new System.EventHandler(this.autoScanLibraryToolStripMenuItem_Click); // + // noAccountsYetAddAccountToolStripMenuItem + // + this.noAccountsYetAddAccountToolStripMenuItem.Name = "noAccountsYetAddAccountToolStripMenuItem"; + this.noAccountsYetAddAccountToolStripMenuItem.Size = new System.Drawing.Size(613, 54); + this.noAccountsYetAddAccountToolStripMenuItem.Text = "No accounts yet. A&dd Account..."; + this.noAccountsYetAddAccountToolStripMenuItem.Click += new System.EventHandler(this.noAccountsYetAddAccountToolStripMenuItem_Click); + // // scanLibraryToolStripMenuItem // this.scanLibraryToolStripMenuItem.Name = "scanLibraryToolStripMenuItem"; - this.scanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.scanLibraryToolStripMenuItem.Size = new System.Drawing.Size(613, 54); this.scanLibraryToolStripMenuItem.Text = "Scan &Library"; this.scanLibraryToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryToolStripMenuItem_Click); // // scanLibraryOfAllAccountsToolStripMenuItem // this.scanLibraryOfAllAccountsToolStripMenuItem.Name = "scanLibraryOfAllAccountsToolStripMenuItem"; - this.scanLibraryOfAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.scanLibraryOfAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(613, 54); this.scanLibraryOfAllAccountsToolStripMenuItem.Text = "Scan Library of &All Accounts"; this.scanLibraryOfAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfAllAccountsToolStripMenuItem_Click); // // scanLibraryOfSomeAccountsToolStripMenuItem // this.scanLibraryOfSomeAccountsToolStripMenuItem.Name = "scanLibraryOfSomeAccountsToolStripMenuItem"; - this.scanLibraryOfSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.scanLibraryOfSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(613, 54); this.scanLibraryOfSomeAccountsToolStripMenuItem.Text = "Scan Library of &Some Accounts..."; this.scanLibraryOfSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfSomeAccountsToolStripMenuItem_Click); // @@ -184,21 +191,21 @@ this.removeAllAccountsToolStripMenuItem, this.removeSomeAccountsToolStripMenuItem}); this.removeLibraryBooksToolStripMenuItem.Name = "removeLibraryBooksToolStripMenuItem"; - this.removeLibraryBooksToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.removeLibraryBooksToolStripMenuItem.Size = new System.Drawing.Size(613, 54); this.removeLibraryBooksToolStripMenuItem.Text = "Remove Library Books"; this.removeLibraryBooksToolStripMenuItem.Click += new System.EventHandler(this.removeLibraryBooksToolStripMenuItem_Click); // // removeAllAccountsToolStripMenuItem // this.removeAllAccountsToolStripMenuItem.Name = "removeAllAccountsToolStripMenuItem"; - this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(448, 54); this.removeAllAccountsToolStripMenuItem.Text = "All Accounts"; this.removeAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeAllAccountsToolStripMenuItem_Click); // // removeSomeAccountsToolStripMenuItem // this.removeSomeAccountsToolStripMenuItem.Name = "removeSomeAccountsToolStripMenuItem"; - this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(448, 54); this.removeSomeAccountsToolStripMenuItem.Text = "Some Accounts"; this.removeSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeSomeAccountsToolStripMenuItem_Click); // @@ -209,28 +216,28 @@ this.beginPdfBackupsToolStripMenuItem, this.convertAllM4bToMp3ToolStripMenuItem}); this.liberateToolStripMenuItem.Name = "liberateToolStripMenuItem"; - this.liberateToolStripMenuItem.Size = new System.Drawing.Size(61, 20); + this.liberateToolStripMenuItem.Size = new System.Drawing.Size(148, 48); this.liberateToolStripMenuItem.Text = "&Liberate"; // // beginBookBackupsToolStripMenuItem // this.beginBookBackupsToolStripMenuItem.Name = "beginBookBackupsToolStripMenuItem"; - this.beginBookBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.beginBookBackupsToolStripMenuItem.Size = new System.Drawing.Size(728, 54); this.beginBookBackupsToolStripMenuItem.Text = "Begin &Book and PDF Backups: {0}"; this.beginBookBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginBookBackupsToolStripMenuItem_Click); // // beginPdfBackupsToolStripMenuItem // this.beginPdfBackupsToolStripMenuItem.Name = "beginPdfBackupsToolStripMenuItem"; - this.beginPdfBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); + this.beginPdfBackupsToolStripMenuItem.Size = new System.Drawing.Size(728, 54); this.beginPdfBackupsToolStripMenuItem.Text = "Begin &PDF Only Backups: {0}"; this.beginPdfBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginPdfBackupsToolStripMenuItem_Click); // // convertAllM4bToMp3ToolStripMenuItem // this.convertAllM4bToMp3ToolStripMenuItem.Name = "convertAllM4bToMp3ToolStripMenuItem"; - this.convertAllM4bToMp3ToolStripMenuItem.Size = new System.Drawing.Size(293, 22); - this.convertAllM4bToMp3ToolStripMenuItem.Text = "Convert all M4b to Mp3 [Long-running]..."; + this.convertAllM4bToMp3ToolStripMenuItem.Size = new System.Drawing.Size(728, 54); + this.convertAllM4bToMp3ToolStripMenuItem.Text = "Convert all &M4b to Mp3 [Long-running]..."; this.convertAllM4bToMp3ToolStripMenuItem.Click += new System.EventHandler(this.convertAllM4bToMp3ToolStripMenuItem_Click); // // exportToolStripMenuItem @@ -238,13 +245,13 @@ this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exportLibraryToolStripMenuItem}); this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; - this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20); + this.exportToolStripMenuItem.Size = new System.Drawing.Size(127, 48); this.exportToolStripMenuItem.Text = "E&xport"; // // exportLibraryToolStripMenuItem // this.exportLibraryToolStripMenuItem.Name = "exportLibraryToolStripMenuItem"; - this.exportLibraryToolStripMenuItem.Size = new System.Drawing.Size(156, 22); + this.exportLibraryToolStripMenuItem.Size = new System.Drawing.Size(448, 54); this.exportLibraryToolStripMenuItem.Text = "E&xport Library..."; this.exportLibraryToolStripMenuItem.Click += new System.EventHandler(this.exportLibraryToolStripMenuItem_Click); // @@ -255,27 +262,27 @@ this.editQuickFiltersToolStripMenuItem, this.toolStripSeparator1}); this.quickFiltersToolStripMenuItem.Name = "quickFiltersToolStripMenuItem"; - this.quickFiltersToolStripMenuItem.Size = new System.Drawing.Size(84, 20); + this.quickFiltersToolStripMenuItem.Size = new System.Drawing.Size(204, 48); this.quickFiltersToolStripMenuItem.Text = "Quick &Filters"; // // firstFilterIsDefaultToolStripMenuItem // this.firstFilterIsDefaultToolStripMenuItem.Name = "firstFilterIsDefaultToolStripMenuItem"; - this.firstFilterIsDefaultToolStripMenuItem.Size = new System.Drawing.Size(256, 22); + this.firstFilterIsDefaultToolStripMenuItem.Size = new System.Drawing.Size(639, 54); this.firstFilterIsDefaultToolStripMenuItem.Text = "Start Libation with 1st filter &Default"; this.firstFilterIsDefaultToolStripMenuItem.Click += new System.EventHandler(this.FirstFilterIsDefaultToolStripMenuItem_Click); // // editQuickFiltersToolStripMenuItem // this.editQuickFiltersToolStripMenuItem.Name = "editQuickFiltersToolStripMenuItem"; - this.editQuickFiltersToolStripMenuItem.Size = new System.Drawing.Size(256, 22); + this.editQuickFiltersToolStripMenuItem.Size = new System.Drawing.Size(639, 54); this.editQuickFiltersToolStripMenuItem.Text = "&Edit quick filters..."; this.editQuickFiltersToolStripMenuItem.Click += new System.EventHandler(this.EditQuickFiltersToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(253, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(636, 6); // // settingsToolStripMenuItem // @@ -285,32 +292,32 @@ this.toolStripSeparator2, this.aboutToolStripMenuItem}); this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; - this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); + this.settingsToolStripMenuItem.Size = new System.Drawing.Size(149, 48); this.settingsToolStripMenuItem.Text = "&Settings"; // // accountsToolStripMenuItem // this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem"; - this.accountsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.accountsToolStripMenuItem.Size = new System.Drawing.Size(448, 54); this.accountsToolStripMenuItem.Text = "&Accounts..."; this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click); // // basicSettingsToolStripMenuItem // this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem"; - this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(448, 54); this.basicSettingsToolStripMenuItem.Text = "&Settings..."; this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(130, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(445, 6); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(448, 54); this.aboutToolStripMenuItem.Text = "A&bout..."; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // @@ -320,64 +327,104 @@ this.scanningToolStripMenuItem.Enabled = false; this.scanningToolStripMenuItem.Image = global::LibationWinForms.Properties.Resources.import_16x16; this.scanningToolStripMenuItem.Name = "scanningToolStripMenuItem"; - this.scanningToolStripMenuItem.Size = new System.Drawing.Size(93, 20); + this.scanningToolStripMenuItem.Size = new System.Drawing.Size(224, 48); this.scanningToolStripMenuItem.Text = "Scanning..."; this.scanningToolStripMenuItem.Visible = false; // // statusStrip1 // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.visibleCountLbl, this.springLbl, this.backupsCountsLbl, this.pdfsCountsLbl}); - this.statusStrip1.Location = new System.Drawing.Point(0, 517); + this.statusStrip1.Location = new System.Drawing.Point(0, 1419); this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0); - this.statusStrip1.Size = new System.Drawing.Size(1007, 22); + this.statusStrip1.Padding = new System.Windows.Forms.Padding(2, 0, 39, 0); + this.statusStrip1.Size = new System.Drawing.Size(2446, 54); this.statusStrip1.TabIndex = 6; this.statusStrip1.Text = "statusStrip1"; // // visibleCountLbl // this.visibleCountLbl.Name = "visibleCountLbl"; - this.visibleCountLbl.Size = new System.Drawing.Size(53, 17); + this.visibleCountLbl.Size = new System.Drawing.Size(136, 41); this.visibleCountLbl.Text = "Visible: 0"; // // springLbl // this.springLbl.Name = "springLbl"; - this.springLbl.Size = new System.Drawing.Size(548, 17); + this.springLbl.Size = new System.Drawing.Size(1299, 41); this.springLbl.Spring = true; // // backupsCountsLbl // this.backupsCountsLbl.Name = "backupsCountsLbl"; - this.backupsCountsLbl.Size = new System.Drawing.Size(218, 17); + this.backupsCountsLbl.Size = new System.Drawing.Size(544, 41); this.backupsCountsLbl.Text = "[Calculating backed up book quantities]"; // // pdfsCountsLbl // this.pdfsCountsLbl.Name = "pdfsCountsLbl"; - this.pdfsCountsLbl.Size = new System.Drawing.Size(171, 17); + this.pdfsCountsLbl.Size = new System.Drawing.Size(426, 41); this.pdfsCountsLbl.Text = "| [Calculating backed up PDFs]"; // // addFilterBtn // - this.addFilterBtn.Location = new System.Drawing.Point(47, 31); - this.addFilterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.addFilterBtn.Location = new System.Drawing.Point(114, 85); + this.addFilterBtn.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); this.addFilterBtn.Name = "addFilterBtn"; - this.addFilterBtn.Size = new System.Drawing.Size(163, 27); + this.addFilterBtn.Size = new System.Drawing.Size(396, 74); this.addFilterBtn.TabIndex = 4; this.addFilterBtn.Text = "Add To Quick Filters"; this.addFilterBtn.UseVisualStyleBackColor = true; this.addFilterBtn.Click += new System.EventHandler(this.AddFilterBtn_Click); // + // visibleBooksToolStripMenuItem + // + this.visibleBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.liberateToolStripMenuItem1, + this.replaceTagsToolStripMenuItem, + this.setDownloadedToolStripMenuItem, + this.removeToolStripMenuItem}); + this.visibleBooksToolStripMenuItem.Name = "visibleBooksToolStripMenuItem"; + this.visibleBooksToolStripMenuItem.Size = new System.Drawing.Size(218, 48); + this.visibleBooksToolStripMenuItem.Text = "&Visible Books"; + // + // liberateToolStripMenuItem1 + // + this.liberateToolStripMenuItem1.Name = "liberateToolStripMenuItem1"; + this.liberateToolStripMenuItem1.Size = new System.Drawing.Size(525, 54); + this.liberateToolStripMenuItem1.Text = "&Liberate"; + this.liberateToolStripMenuItem1.Click += new System.EventHandler(this.liberateToolStripMenuItem1_Click); + // + // replaceTagsToolStripMenuItem + // + this.replaceTagsToolStripMenuItem.Name = "replaceTagsToolStripMenuItem"; + this.replaceTagsToolStripMenuItem.Size = new System.Drawing.Size(525, 54); + this.replaceTagsToolStripMenuItem.Text = "Replace &Tags..."; + this.replaceTagsToolStripMenuItem.Click += new System.EventHandler(this.replaceTagsToolStripMenuItem_Click); + // + // setDownloadedToolStripMenuItem + // + this.setDownloadedToolStripMenuItem.Name = "setDownloadedToolStripMenuItem"; + this.setDownloadedToolStripMenuItem.Size = new System.Drawing.Size(525, 54); + this.setDownloadedToolStripMenuItem.Text = "Set \'&Downloaded\' status..."; + this.setDownloadedToolStripMenuItem.Click += new System.EventHandler(this.setDownloadedToolStripMenuItem_Click); + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(525, 54); + this.removeToolStripMenuItem.Text = "&Remove from library..."; + this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); + // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleDimensions = new System.Drawing.SizeF(17F, 41F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1007, 539); + this.ClientSize = new System.Drawing.Size(2446, 1473); this.Controls.Add(this.filterBtn); this.Controls.Add(this.addFilterBtn); this.Controls.Add(this.filterSearchTb); @@ -387,7 +434,7 @@ this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; - this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); this.Name = "Form1"; this.Text = "Libation: Liberate your Library"; this.Load += new System.EventHandler(this.Form1_Load); @@ -438,5 +485,10 @@ private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem scanningToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem autoScanLibraryToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem visibleBooksToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem liberateToolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem replaceTagsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem setDownloadedToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; } } diff --git a/Source/LibationWinForms/Form1.cs b/Source/LibationWinForms/Form1.cs index b0d26cf1..6eb59a75 100644 --- a/Source/LibationWinForms/Form1.cs +++ b/Source/LibationWinForms/Form1.cs @@ -18,10 +18,16 @@ namespace LibationWinForms private string beginBookBackupsToolStripMenuItem_format { get; } private string beginPdfBackupsToolStripMenuItem_format { get; } + private ProductsGrid productsGrid { get; } + public Form1() { InitializeComponent(); + productsGrid = new ProductsGrid { Dock = DockStyle.Fill }; + gridPanel.Controls.Add(productsGrid); + productsGrid.VisibleCountChanged += setVisibleCount; + // back up string formats beginBookBackupsToolStripMenuItem_format = beginBookBackupsToolStripMenuItem.Text; beginPdfBackupsToolStripMenuItem_format = beginPdfBackupsToolStripMenuItem.Text; @@ -44,6 +50,8 @@ namespace LibationWinForms configAndInitAutoScan(); + configVisibleBooksMenu(); + // init default/placeholder cover art var format = System.Drawing.Imaging.ImageFormat.Jpeg; PictureStorage.SetDefaultImage(PictureSize._80x80, Properties.Resources.default_cover_80x80.ToBytes(format)); @@ -69,42 +77,14 @@ namespace LibationWinForms // suppressed filter while init'ing UI var prev_isProcessingGridSelect = isProcessingGridSelect; isProcessingGridSelect = true; - this.UIThreadSync(setGrid); + this.UIThreadSync(() => productsGrid.Display()); isProcessingGridSelect = prev_isProcessingGridSelect; // UI init complete. now we can apply filter this.UIThreadAsync(() => doFilter(lastGoodFilter)); - setBackupCounts(null, null); - } - - #region reload grid - private ProductsGrid productsGrid; - private void setGrid() - { - SuspendLayout(); - { - // previous non-null grid with zero-count removes columns. remove/re-add grid to get columns back - if (productsGrid?.Count == 0) - { - gridPanel.Controls.Remove(productsGrid); - productsGrid.VisibleCountChanged -= setVisibleCount; - productsGrid.Dispose(); - productsGrid = null; - } - - if (productsGrid is null) - { - productsGrid = new ProductsGrid { Dock = DockStyle.Fill }; - productsGrid.VisibleCountChanged += setVisibleCount; - gridPanel.UIThreadSync(() => gridPanel.Controls.Add(productsGrid)); - } - - productsGrid.Display(); - } - ResumeLayout(); - } - #endregion + setBackupCounts(); + } #region bottom: qty books visible private void setVisibleCount(object _, int qty) => visibleCountLbl.Text = string.Format("Visible: {0}", qty); @@ -114,7 +94,7 @@ namespace LibationWinForms private System.ComponentModel.BackgroundWorker updateCountsBw; private bool runBackupCountsAgain; - private void setBackupCounts(object _, object __) + private void setBackupCounts(object _ = null, object __ = null) { runBackupCountsAgain = true; @@ -537,6 +517,41 @@ namespace LibationWinForms private void EditQuickFiltersToolStripMenuItem_Click(object sender, EventArgs e) => new EditQuickFilters(this).ShowDialog(); #endregion + #region Visible Books menu + private void configVisibleBooksMenu() + { + + } + + private async void liberateToolStripMenuItem1_Click(object sender, EventArgs e) + { + var visibleBooks = productsGrid.GetVisible().ToList(); + await BookLiberation.ProcessorAutomationController.BackupAllBooksAsync(visibleBooks); + } + + private void replaceTagsToolStripMenuItem_Click(object sender, EventArgs e) + { + var visibleLibraryBooks = productsGrid.GetVisible().ToList(); + foreach (var libraryBook in visibleLibraryBooks) + libraryBook.Book.UserDefinedItem.Tags = "ggggg"; + LibraryCommands.UpdateUserDefinedItem(visibleLibraryBooks.Select(lb => lb.Book)); + } + + private void setDownloadedToolStripMenuItem_Click(object sender, EventArgs e) + { + var visibleLibraryBooks = productsGrid.GetVisible().ToList(); + foreach (var libraryBook in visibleLibraryBooks) + libraryBook.Book.UserDefinedItem.BookStatus = DataLayer.LiberatedStatus.NotLiberated; + LibraryCommands.UpdateUserDefinedItem(visibleLibraryBooks.Select(lb => lb.Book)); + } + + private async void removeToolStripMenuItem_Click(object sender, EventArgs e) + { + var visibleIds = productsGrid.GetVisible().Select(lb => lb.Book.AudibleProductId).ToList(); + await LibraryCommands.RemoveBooksAsync(visibleIds); + } + #endregion + #region Settings menu private void accountsToolStripMenuItem_Click(object sender, EventArgs e) => new AccountsDialog(this).ShowDialog(); diff --git a/Source/LibationWinForms/grid/ProductsGrid.cs b/Source/LibationWinForms/grid/ProductsGrid.cs index 71938d70..36a9e7b5 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.cs +++ b/Source/LibationWinForms/grid/ProductsGrid.cs @@ -14,6 +14,7 @@ using LibationWinForms.Dialogs; namespace LibationWinForms { + #region // legacy instructions to update data_grid_view // INSTRUCTIONS TO UPDATE DATA_GRID_VIEW // - delete current DataGridView // - view > other windows > data sources @@ -27,7 +28,10 @@ namespace LibationWinForms // - go to Design view // - click on Data Sources > ProductItem. dropdown: DataGridView // - drag/drop ProductItem on design surface - // AS OF AUGUST 2021 THIS DOES NOT WORK IN VS2019 WITH .NET-5 PROJECTS + // + // as of august 2021 this does not work in vs2019 with .net5 projects + // VS has improved since then with .net6+ but I haven't checked again + #endregion public partial class ProductsGrid : UserControl { @@ -44,10 +48,12 @@ namespace LibationWinForms _dataGridView.Sorted += Filter; _dataGridView.CellContentClick += DataGridView_CellContentClick; + this.Load += ProductsGrid_Load; + EnableDoubleBuffering(); } - private void EnableDoubleBuffering() + private void EnableDoubleBuffering() { var propertyInfo = _dataGridView.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); @@ -122,24 +128,13 @@ namespace LibationWinForms #region UI display functions - public int Count { get; private set; } - private SortableBindingList bindingList; public void Display() { + // don't return early if lib size == 0. this will not update correctly if all books are removed var lib = DbContexts.GetLibrary_Flat_NoTracking(); - Count = lib.Count; - - // if no data. hide all columns. return - if (!lib.Any()) - { - for (var i = _dataGridView.ColumnCount - 1; i >= 0; i--) - _dataGridView.Columns.RemoveAt(i); - return; - } - var orderedBooks = lib // default load order .OrderByDescending(lb => lb.DateAdded) @@ -150,10 +145,10 @@ namespace LibationWinForms .ToList(); // BIND - if (bindingList is null) - bindToGrid(orderedBooks); - else + if (bindingList?.Count > 0) updateGrid(orderedBooks); + else + bindToGrid(orderedBooks); // FILTER Filter(); @@ -245,7 +240,8 @@ namespace LibationWinForms #region Column Customizations - protected override void OnVisibleChanged(EventArgs e) + // to ensure this is only ever called once: Load instead of 'override OnVisibleChanged' + private void ProductsGrid_Load(object sender, EventArgs e) { contextMenuStrip1.Items.Add(new ToolStripLabel("Show / Hide Columns")); contextMenuStrip1.Items.Add(new ToolStripSeparator());