Refactor ProductsGrid

This commit is contained in:
Michael Bucari-Tovo 2022-05-23 15:29:26 -06:00
parent e8a320dac9
commit 593fe57ea1
19 changed files with 768 additions and 837 deletions

View File

@ -28,111 +28,100 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.gridPanel = new System.Windows.Forms.Panel(); this.filterHelpBtn = new System.Windows.Forms.Button();
this.filterHelpBtn = new System.Windows.Forms.Button(); this.filterBtn = new System.Windows.Forms.Button();
this.filterBtn = new System.Windows.Forms.Button(); this.filterSearchTb = new System.Windows.Forms.TextBox();
this.filterSearchTb = new System.Windows.Forms.TextBox(); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoScanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoScanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.noAccountsYetAddAccountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.noAccountsYetAddAccountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.scanLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanLibraryOfAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.scanLibraryOfAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanLibraryOfSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.scanLibraryOfSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeLibraryBooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeLibraryBooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeAllAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeSomeAccountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.liberateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.liberateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.beginBookBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem();
this.beginBookBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); this.beginPdfBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem();
this.beginPdfBackupsToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); this.convertAllM4bToMp3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.convertAllM4bToMp3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.liberateVisible2ToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem();
this.liberateVisible2ToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportLibraryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.quickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.quickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.firstFilterIsDefaultToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.firstFilterIsDefaultToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editQuickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editQuickFiltersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.scanningToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.scanningToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.visibleBooksToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem();
this.visibleBooksToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); this.liberateVisibleToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem();
this.liberateVisibleToolStripMenuItem = new LibationWinForms.FormattableToolStripMenuItem(); this.replaceTagsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.replaceTagsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setDownloadedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.setDownloadedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.accountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.accountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.basicSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.basicSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.visibleCountLbl = new LibationWinForms.FormattableToolStripStatusLabel();
this.visibleCountLbl = new LibationWinForms.FormattableToolStripStatusLabel(); this.springLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.springLbl = new System.Windows.Forms.ToolStripStatusLabel(); this.backupsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.backupsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel(); this.pdfsCountsLbl = new LibationWinForms.FormattableToolStripStatusLabel();
this.pdfsCountsLbl = new LibationWinForms.FormattableToolStripStatusLabel(); this.addQuickFilterBtn = new System.Windows.Forms.Button();
this.addQuickFilterBtn = new System.Windows.Forms.Button(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.panel1 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel(); this.productsDisplay = new LibationWinForms.ProductsDisplay();
this.toggleQueueHideBtn = new System.Windows.Forms.Button(); this.toggleQueueHideBtn = new System.Windows.Forms.Button();
this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl(); this.processBookQueue1 = new LibationWinForms.ProcessQueue.ProcessQueueControl();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// gridPanel // filterHelpBtn
// //
this.gridPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.filterHelpBtn.Location = new System.Drawing.Point(15, 3);
| System.Windows.Forms.AnchorStyles.Left) this.filterHelpBtn.Margin = new System.Windows.Forms.Padding(15, 3, 4, 3);
this.filterHelpBtn.Name = "filterHelpBtn";
this.filterHelpBtn.Size = new System.Drawing.Size(26, 27);
this.filterHelpBtn.TabIndex = 3;
this.filterHelpBtn.Text = "?";
this.filterHelpBtn.UseVisualStyleBackColor = true;
this.filterHelpBtn.Click += new System.EventHandler(this.filterHelpBtn_Click);
//
// 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(748, 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);
this.filterBtn.TabIndex = 2;
this.filterBtn.Text = "Filter";
this.filterBtn.UseVisualStyleBackColor = true;
this.filterBtn.Click += new System.EventHandler(this.filterBtn_Click);
//
// filterSearchTb
//
this.filterSearchTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.gridPanel.Location = new System.Drawing.Point(15, 33); this.filterSearchTb.Location = new System.Drawing.Point(196, 7);
this.gridPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.filterSearchTb.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gridPanel.Name = "gridPanel"; this.filterSearchTb.Name = "filterSearchTb";
this.gridPanel.Size = new System.Drawing.Size(864, 558); this.filterSearchTb.Size = new System.Drawing.Size(544, 23);
this.gridPanel.TabIndex = 5; this.filterSearchTb.TabIndex = 1;
// this.filterSearchTb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.filterSearchTb_KeyPress);
// filterHelpBtn //
// // menuStrip1
this.filterHelpBtn.Location = new System.Drawing.Point(15, 3); //
this.filterHelpBtn.Margin = new System.Windows.Forms.Padding(15, 3, 4, 3); this.menuStrip1.ImageScalingSize = new System.Drawing.Size(40, 40);
this.filterHelpBtn.Name = "filterHelpBtn"; this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.filterHelpBtn.Size = new System.Drawing.Size(26, 27);
this.filterHelpBtn.TabIndex = 3;
this.filterHelpBtn.Text = "?";
this.filterHelpBtn.UseVisualStyleBackColor = true;
this.filterHelpBtn.Click += new System.EventHandler(this.filterHelpBtn_Click);
//
// 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(748, 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);
this.filterBtn.TabIndex = 2;
this.filterBtn.Text = "Filter";
this.filterBtn.UseVisualStyleBackColor = true;
this.filterBtn.Click += new System.EventHandler(this.filterBtn_Click);
//
// filterSearchTb
//
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.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.filterSearchTb.Name = "filterSearchTb";
this.filterSearchTb.Size = new System.Drawing.Size(544, 23);
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.importToolStripMenuItem,
this.liberateToolStripMenuItem, this.liberateToolStripMenuItem,
this.exportToolStripMenuItem, this.exportToolStripMenuItem,
@ -140,402 +129,415 @@
this.scanningToolStripMenuItem, this.scanningToolStripMenuItem,
this.visibleBooksToolStripMenuItem, this.visibleBooksToolStripMenuItem,
this.settingsToolStripMenuItem}); this.settingsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
this.menuStrip1.Size = new System.Drawing.Size(893, 24); this.menuStrip1.Size = new System.Drawing.Size(893, 24);
this.menuStrip1.TabIndex = 0; this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
// //
// importToolStripMenuItem // importToolStripMenuItem
// //
this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.autoScanLibraryToolStripMenuItem, this.autoScanLibraryToolStripMenuItem,
this.noAccountsYetAddAccountToolStripMenuItem, this.noAccountsYetAddAccountToolStripMenuItem,
this.scanLibraryToolStripMenuItem, this.scanLibraryToolStripMenuItem,
this.scanLibraryOfAllAccountsToolStripMenuItem, this.scanLibraryOfAllAccountsToolStripMenuItem,
this.scanLibraryOfSomeAccountsToolStripMenuItem, this.scanLibraryOfSomeAccountsToolStripMenuItem,
this.removeLibraryBooksToolStripMenuItem}); this.removeLibraryBooksToolStripMenuItem});
this.importToolStripMenuItem.Name = "importToolStripMenuItem"; this.importToolStripMenuItem.Name = "importToolStripMenuItem";
this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20); this.importToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.importToolStripMenuItem.Text = "&Import"; this.importToolStripMenuItem.Text = "&Import";
// //
// autoScanLibraryToolStripMenuItem // autoScanLibraryToolStripMenuItem
// //
this.autoScanLibraryToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.autoScanLibraryToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.autoScanLibraryToolStripMenuItem.Name = "autoScanLibraryToolStripMenuItem"; this.autoScanLibraryToolStripMenuItem.Name = "autoScanLibraryToolStripMenuItem";
this.autoScanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.autoScanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22);
this.autoScanLibraryToolStripMenuItem.Text = "A&uto Scan Library"; this.autoScanLibraryToolStripMenuItem.Text = "A&uto Scan Library";
this.autoScanLibraryToolStripMenuItem.Click += new System.EventHandler(this.autoScanLibraryToolStripMenuItem_Click); this.autoScanLibraryToolStripMenuItem.Click += new System.EventHandler(this.autoScanLibraryToolStripMenuItem_Click);
// //
// noAccountsYetAddAccountToolStripMenuItem // noAccountsYetAddAccountToolStripMenuItem
// //
this.noAccountsYetAddAccountToolStripMenuItem.Name = "noAccountsYetAddAccountToolStripMenuItem"; this.noAccountsYetAddAccountToolStripMenuItem.Name = "noAccountsYetAddAccountToolStripMenuItem";
this.noAccountsYetAddAccountToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.noAccountsYetAddAccountToolStripMenuItem.Size = new System.Drawing.Size(247, 22);
this.noAccountsYetAddAccountToolStripMenuItem.Text = "No accounts yet. A&dd Account..."; this.noAccountsYetAddAccountToolStripMenuItem.Text = "No accounts yet. A&dd Account...";
this.noAccountsYetAddAccountToolStripMenuItem.Click += new System.EventHandler(this.noAccountsYetAddAccountToolStripMenuItem_Click); this.noAccountsYetAddAccountToolStripMenuItem.Click += new System.EventHandler(this.noAccountsYetAddAccountToolStripMenuItem_Click);
// //
// scanLibraryToolStripMenuItem // scanLibraryToolStripMenuItem
// //
this.scanLibraryToolStripMenuItem.Name = "scanLibraryToolStripMenuItem"; this.scanLibraryToolStripMenuItem.Name = "scanLibraryToolStripMenuItem";
this.scanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.scanLibraryToolStripMenuItem.Size = new System.Drawing.Size(247, 22);
this.scanLibraryToolStripMenuItem.Text = "Scan &Library"; this.scanLibraryToolStripMenuItem.Text = "Scan &Library";
this.scanLibraryToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryToolStripMenuItem_Click); this.scanLibraryToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryToolStripMenuItem_Click);
// //
// scanLibraryOfAllAccountsToolStripMenuItem // scanLibraryOfAllAccountsToolStripMenuItem
// //
this.scanLibraryOfAllAccountsToolStripMenuItem.Name = "scanLibraryOfAllAccountsToolStripMenuItem"; this.scanLibraryOfAllAccountsToolStripMenuItem.Name = "scanLibraryOfAllAccountsToolStripMenuItem";
this.scanLibraryOfAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.scanLibraryOfAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22);
this.scanLibraryOfAllAccountsToolStripMenuItem.Text = "Scan Library of &All Accounts"; this.scanLibraryOfAllAccountsToolStripMenuItem.Text = "Scan Library of &All Accounts";
this.scanLibraryOfAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfAllAccountsToolStripMenuItem_Click); this.scanLibraryOfAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfAllAccountsToolStripMenuItem_Click);
// //
// scanLibraryOfSomeAccountsToolStripMenuItem // scanLibraryOfSomeAccountsToolStripMenuItem
// //
this.scanLibraryOfSomeAccountsToolStripMenuItem.Name = "scanLibraryOfSomeAccountsToolStripMenuItem"; this.scanLibraryOfSomeAccountsToolStripMenuItem.Name = "scanLibraryOfSomeAccountsToolStripMenuItem";
this.scanLibraryOfSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.scanLibraryOfSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(247, 22);
this.scanLibraryOfSomeAccountsToolStripMenuItem.Text = "Scan Library of &Some Accounts..."; this.scanLibraryOfSomeAccountsToolStripMenuItem.Text = "Scan Library of &Some Accounts...";
this.scanLibraryOfSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfSomeAccountsToolStripMenuItem_Click); this.scanLibraryOfSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.scanLibraryOfSomeAccountsToolStripMenuItem_Click);
// //
// removeLibraryBooksToolStripMenuItem // removeLibraryBooksToolStripMenuItem
// //
this.removeLibraryBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.removeLibraryBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.removeAllAccountsToolStripMenuItem, this.removeAllAccountsToolStripMenuItem,
this.removeSomeAccountsToolStripMenuItem}); this.removeSomeAccountsToolStripMenuItem});
this.removeLibraryBooksToolStripMenuItem.Name = "removeLibraryBooksToolStripMenuItem"; this.removeLibraryBooksToolStripMenuItem.Name = "removeLibraryBooksToolStripMenuItem";
this.removeLibraryBooksToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.removeLibraryBooksToolStripMenuItem.Size = new System.Drawing.Size(247, 22);
this.removeLibraryBooksToolStripMenuItem.Text = "Remove Library Books"; this.removeLibraryBooksToolStripMenuItem.Text = "Remove Library Books";
this.removeLibraryBooksToolStripMenuItem.Click += new System.EventHandler(this.removeLibraryBooksToolStripMenuItem_Click); this.removeLibraryBooksToolStripMenuItem.Click += new System.EventHandler(this.removeLibraryBooksToolStripMenuItem_Click);
// //
// removeAllAccountsToolStripMenuItem // removeAllAccountsToolStripMenuItem
// //
this.removeAllAccountsToolStripMenuItem.Name = "removeAllAccountsToolStripMenuItem"; this.removeAllAccountsToolStripMenuItem.Name = "removeAllAccountsToolStripMenuItem";
this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.removeAllAccountsToolStripMenuItem.Text = "All Accounts"; this.removeAllAccountsToolStripMenuItem.Text = "All Accounts";
this.removeAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeAllAccountsToolStripMenuItem_Click); this.removeAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeAllAccountsToolStripMenuItem_Click);
// //
// removeSomeAccountsToolStripMenuItem // removeSomeAccountsToolStripMenuItem
// //
this.removeSomeAccountsToolStripMenuItem.Name = "removeSomeAccountsToolStripMenuItem"; this.removeSomeAccountsToolStripMenuItem.Name = "removeSomeAccountsToolStripMenuItem";
this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.removeSomeAccountsToolStripMenuItem.Text = "Some Accounts"; this.removeSomeAccountsToolStripMenuItem.Text = "Some Accounts";
this.removeSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeSomeAccountsToolStripMenuItem_Click); this.removeSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeSomeAccountsToolStripMenuItem_Click);
// //
// liberateToolStripMenuItem // liberateToolStripMenuItem
// //
this.liberateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.liberateToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.beginBookBackupsToolStripMenuItem, this.beginBookBackupsToolStripMenuItem,
this.beginPdfBackupsToolStripMenuItem, this.beginPdfBackupsToolStripMenuItem,
this.convertAllM4bToMp3ToolStripMenuItem, this.convertAllM4bToMp3ToolStripMenuItem,
this.liberateVisible2ToolStripMenuItem}); this.liberateVisible2ToolStripMenuItem});
this.liberateToolStripMenuItem.Name = "liberateToolStripMenuItem"; this.liberateToolStripMenuItem.Name = "liberateToolStripMenuItem";
this.liberateToolStripMenuItem.Size = new System.Drawing.Size(61, 20); this.liberateToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.liberateToolStripMenuItem.Text = "&Liberate"; this.liberateToolStripMenuItem.Text = "&Liberate";
// //
// beginBookBackupsToolStripMenuItem // beginBookBackupsToolStripMenuItem
// //
this.beginBookBackupsToolStripMenuItem.FormatText = "Begin &Book and PDF Backups: {0}"; this.beginBookBackupsToolStripMenuItem.FormatText = "Begin &Book and PDF Backups: {0}";
this.beginBookBackupsToolStripMenuItem.Name = "beginBookBackupsToolStripMenuItem"; this.beginBookBackupsToolStripMenuItem.Name = "beginBookBackupsToolStripMenuItem";
this.beginBookBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); this.beginBookBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22);
this.beginBookBackupsToolStripMenuItem.Text = "Begin &Book and PDF Backups: {0}"; this.beginBookBackupsToolStripMenuItem.Text = "Begin &Book and PDF Backups: {0}";
this.beginBookBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginBookBackupsToolStripMenuItem_Click); this.beginBookBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginBookBackupsToolStripMenuItem_Click);
// //
// beginPdfBackupsToolStripMenuItem // beginPdfBackupsToolStripMenuItem
// //
this.beginPdfBackupsToolStripMenuItem.FormatText = "Begin &PDF Only Backups: {0}"; this.beginPdfBackupsToolStripMenuItem.FormatText = "Begin &PDF Only Backups: {0}";
this.beginPdfBackupsToolStripMenuItem.Name = "beginPdfBackupsToolStripMenuItem"; this.beginPdfBackupsToolStripMenuItem.Name = "beginPdfBackupsToolStripMenuItem";
this.beginPdfBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22); this.beginPdfBackupsToolStripMenuItem.Size = new System.Drawing.Size(293, 22);
this.beginPdfBackupsToolStripMenuItem.Text = "Begin &PDF Only Backups: {0}"; this.beginPdfBackupsToolStripMenuItem.Text = "Begin &PDF Only Backups: {0}";
this.beginPdfBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginPdfBackupsToolStripMenuItem_Click); this.beginPdfBackupsToolStripMenuItem.Click += new System.EventHandler(this.beginPdfBackupsToolStripMenuItem_Click);
// //
// convertAllM4bToMp3ToolStripMenuItem // convertAllM4bToMp3ToolStripMenuItem
// //
this.convertAllM4bToMp3ToolStripMenuItem.Name = "convertAllM4bToMp3ToolStripMenuItem"; this.convertAllM4bToMp3ToolStripMenuItem.Name = "convertAllM4bToMp3ToolStripMenuItem";
this.convertAllM4bToMp3ToolStripMenuItem.Size = new System.Drawing.Size(293, 22); this.convertAllM4bToMp3ToolStripMenuItem.Size = new System.Drawing.Size(293, 22);
this.convertAllM4bToMp3ToolStripMenuItem.Text = "Convert all &M4b to Mp3 [Long-running]..."; this.convertAllM4bToMp3ToolStripMenuItem.Text = "Convert all &M4b to Mp3 [Long-running]...";
this.convertAllM4bToMp3ToolStripMenuItem.Click += new System.EventHandler(this.convertAllM4bToMp3ToolStripMenuItem_Click); this.convertAllM4bToMp3ToolStripMenuItem.Click += new System.EventHandler(this.convertAllM4bToMp3ToolStripMenuItem_Click);
// //
// liberateVisible2ToolStripMenuItem // liberateVisible2ToolStripMenuItem
// //
this.liberateVisible2ToolStripMenuItem.FormatText = "Liberate &Visible Books: {0}"; this.liberateVisible2ToolStripMenuItem.FormatText = "Liberate &Visible Books: {0}";
this.liberateVisible2ToolStripMenuItem.Name = "liberateVisible2ToolStripMenuItem"; this.liberateVisible2ToolStripMenuItem.Name = "liberateVisible2ToolStripMenuItem";
this.liberateVisible2ToolStripMenuItem.Size = new System.Drawing.Size(293, 22); this.liberateVisible2ToolStripMenuItem.Size = new System.Drawing.Size(293, 22);
this.liberateVisible2ToolStripMenuItem.Text = "Liberate &Visible Books: {0}"; this.liberateVisible2ToolStripMenuItem.Text = "Liberate &Visible Books: {0}";
this.liberateVisible2ToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible); this.liberateVisible2ToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible);
// //
// exportToolStripMenuItem // exportToolStripMenuItem
// //
this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exportLibraryToolStripMenuItem}); this.exportLibraryToolStripMenuItem});
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20); this.exportToolStripMenuItem.Size = new System.Drawing.Size(53, 20);
this.exportToolStripMenuItem.Text = "E&xport"; this.exportToolStripMenuItem.Text = "E&xport";
// //
// exportLibraryToolStripMenuItem // exportLibraryToolStripMenuItem
// //
this.exportLibraryToolStripMenuItem.Name = "exportLibraryToolStripMenuItem"; this.exportLibraryToolStripMenuItem.Name = "exportLibraryToolStripMenuItem";
this.exportLibraryToolStripMenuItem.Size = new System.Drawing.Size(156, 22); this.exportLibraryToolStripMenuItem.Size = new System.Drawing.Size(156, 22);
this.exportLibraryToolStripMenuItem.Text = "E&xport Library..."; this.exportLibraryToolStripMenuItem.Text = "E&xport Library...";
this.exportLibraryToolStripMenuItem.Click += new System.EventHandler(this.exportLibraryToolStripMenuItem_Click); this.exportLibraryToolStripMenuItem.Click += new System.EventHandler(this.exportLibraryToolStripMenuItem_Click);
// //
// quickFiltersToolStripMenuItem // quickFiltersToolStripMenuItem
// //
this.quickFiltersToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.quickFiltersToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.firstFilterIsDefaultToolStripMenuItem, this.firstFilterIsDefaultToolStripMenuItem,
this.editQuickFiltersToolStripMenuItem, this.editQuickFiltersToolStripMenuItem,
this.toolStripSeparator1}); this.toolStripSeparator1});
this.quickFiltersToolStripMenuItem.Name = "quickFiltersToolStripMenuItem"; this.quickFiltersToolStripMenuItem.Name = "quickFiltersToolStripMenuItem";
this.quickFiltersToolStripMenuItem.Size = new System.Drawing.Size(84, 20); this.quickFiltersToolStripMenuItem.Size = new System.Drawing.Size(84, 20);
this.quickFiltersToolStripMenuItem.Text = "Quick &Filters"; this.quickFiltersToolStripMenuItem.Text = "Quick &Filters";
// //
// firstFilterIsDefaultToolStripMenuItem // firstFilterIsDefaultToolStripMenuItem
// //
this.firstFilterIsDefaultToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.firstFilterIsDefaultToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.firstFilterIsDefaultToolStripMenuItem.Name = "firstFilterIsDefaultToolStripMenuItem"; this.firstFilterIsDefaultToolStripMenuItem.Name = "firstFilterIsDefaultToolStripMenuItem";
this.firstFilterIsDefaultToolStripMenuItem.Size = new System.Drawing.Size(256, 22); this.firstFilterIsDefaultToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
this.firstFilterIsDefaultToolStripMenuItem.Text = "Start Libation with 1st filter &Default"; this.firstFilterIsDefaultToolStripMenuItem.Text = "Start Libation with 1st filter &Default";
this.firstFilterIsDefaultToolStripMenuItem.Click += new System.EventHandler(this.firstFilterIsDefaultToolStripMenuItem_Click); this.firstFilterIsDefaultToolStripMenuItem.Click += new System.EventHandler(this.firstFilterIsDefaultToolStripMenuItem_Click);
// //
// editQuickFiltersToolStripMenuItem // editQuickFiltersToolStripMenuItem
// //
this.editQuickFiltersToolStripMenuItem.Name = "editQuickFiltersToolStripMenuItem"; this.editQuickFiltersToolStripMenuItem.Name = "editQuickFiltersToolStripMenuItem";
this.editQuickFiltersToolStripMenuItem.Size = new System.Drawing.Size(256, 22); this.editQuickFiltersToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
this.editQuickFiltersToolStripMenuItem.Text = "&Edit quick filters..."; this.editQuickFiltersToolStripMenuItem.Text = "&Edit quick filters...";
this.editQuickFiltersToolStripMenuItem.Click += new System.EventHandler(this.editQuickFiltersToolStripMenuItem_Click); this.editQuickFiltersToolStripMenuItem.Click += new System.EventHandler(this.editQuickFiltersToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(253, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(253, 6);
// //
// scanningToolStripMenuItem // scanningToolStripMenuItem
// //
this.scanningToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.scanningToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.scanningToolStripMenuItem.Enabled = false; this.scanningToolStripMenuItem.Enabled = false;
this.scanningToolStripMenuItem.Image = global::LibationWinForms.Properties.Resources.import_16x16; this.scanningToolStripMenuItem.Image = global::LibationWinForms.Properties.Resources.import_16x16;
this.scanningToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.scanningToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
this.scanningToolStripMenuItem.Name = "scanningToolStripMenuItem"; this.scanningToolStripMenuItem.Name = "scanningToolStripMenuItem";
this.scanningToolStripMenuItem.Size = new System.Drawing.Size(93, 20); this.scanningToolStripMenuItem.Size = new System.Drawing.Size(93, 20);
this.scanningToolStripMenuItem.Text = "Scanning..."; this.scanningToolStripMenuItem.Text = "Scanning...";
this.scanningToolStripMenuItem.Visible = false; this.scanningToolStripMenuItem.Visible = false;
// //
// visibleBooksToolStripMenuItem // visibleBooksToolStripMenuItem
// //
this.visibleBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.visibleBooksToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.liberateVisibleToolStripMenuItem, this.liberateVisibleToolStripMenuItem,
this.replaceTagsToolStripMenuItem, this.replaceTagsToolStripMenuItem,
this.setDownloadedToolStripMenuItem, this.setDownloadedToolStripMenuItem,
this.removeToolStripMenuItem}); this.removeToolStripMenuItem});
this.visibleBooksToolStripMenuItem.FormatText = "&Visible Books: {0}"; this.visibleBooksToolStripMenuItem.FormatText = "&Visible Books: {0}";
this.visibleBooksToolStripMenuItem.Name = "visibleBooksToolStripMenuItem"; this.visibleBooksToolStripMenuItem.Name = "visibleBooksToolStripMenuItem";
this.visibleBooksToolStripMenuItem.Size = new System.Drawing.Size(108, 20); this.visibleBooksToolStripMenuItem.Size = new System.Drawing.Size(108, 20);
this.visibleBooksToolStripMenuItem.Text = "&Visible Books: {0}"; this.visibleBooksToolStripMenuItem.Text = "&Visible Books: {0}";
// //
// liberateVisibleToolStripMenuItem // liberateVisibleToolStripMenuItem
// //
this.liberateVisibleToolStripMenuItem.FormatText = "&Liberate: {0}"; this.liberateVisibleToolStripMenuItem.FormatText = "&Liberate: {0}";
this.liberateVisibleToolStripMenuItem.Name = "liberateVisibleToolStripMenuItem"; this.liberateVisibleToolStripMenuItem.Name = "liberateVisibleToolStripMenuItem";
this.liberateVisibleToolStripMenuItem.Size = new System.Drawing.Size(209, 22); this.liberateVisibleToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.liberateVisibleToolStripMenuItem.Text = "&Liberate: {0}"; this.liberateVisibleToolStripMenuItem.Text = "&Liberate: {0}";
this.liberateVisibleToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible); this.liberateVisibleToolStripMenuItem.Click += new System.EventHandler(this.liberateVisible);
// //
// replaceTagsToolStripMenuItem // replaceTagsToolStripMenuItem
// //
this.replaceTagsToolStripMenuItem.Name = "replaceTagsToolStripMenuItem"; this.replaceTagsToolStripMenuItem.Name = "replaceTagsToolStripMenuItem";
this.replaceTagsToolStripMenuItem.Size = new System.Drawing.Size(209, 22); this.replaceTagsToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.replaceTagsToolStripMenuItem.Text = "Replace &Tags..."; this.replaceTagsToolStripMenuItem.Text = "Replace &Tags...";
this.replaceTagsToolStripMenuItem.Click += new System.EventHandler(this.replaceTagsToolStripMenuItem_Click); this.replaceTagsToolStripMenuItem.Click += new System.EventHandler(this.replaceTagsToolStripMenuItem_Click);
// //
// setDownloadedToolStripMenuItem // setDownloadedToolStripMenuItem
// //
this.setDownloadedToolStripMenuItem.Name = "setDownloadedToolStripMenuItem"; this.setDownloadedToolStripMenuItem.Name = "setDownloadedToolStripMenuItem";
this.setDownloadedToolStripMenuItem.Size = new System.Drawing.Size(209, 22); this.setDownloadedToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.setDownloadedToolStripMenuItem.Text = "Set \'&Downloaded\' status..."; this.setDownloadedToolStripMenuItem.Text = "Set \'&Downloaded\' status...";
this.setDownloadedToolStripMenuItem.Click += new System.EventHandler(this.setDownloadedToolStripMenuItem_Click); this.setDownloadedToolStripMenuItem.Click += new System.EventHandler(this.setDownloadedToolStripMenuItem_Click);
// //
// removeToolStripMenuItem // removeToolStripMenuItem
// //
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
this.removeToolStripMenuItem.Size = new System.Drawing.Size(209, 22); this.removeToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.removeToolStripMenuItem.Text = "&Remove from library..."; this.removeToolStripMenuItem.Text = "&Remove from library...";
this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
// //
// settingsToolStripMenuItem // settingsToolStripMenuItem
// //
this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.accountsToolStripMenuItem, this.accountsToolStripMenuItem,
this.basicSettingsToolStripMenuItem, this.basicSettingsToolStripMenuItem,
this.toolStripSeparator2, this.toolStripSeparator2,
this.aboutToolStripMenuItem}); this.aboutToolStripMenuItem});
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.settingsToolStripMenuItem.Text = "&Settings"; this.settingsToolStripMenuItem.Text = "&Settings";
// //
// accountsToolStripMenuItem // accountsToolStripMenuItem
// //
this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem"; this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem";
this.accountsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); this.accountsToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
this.accountsToolStripMenuItem.Text = "&Accounts..."; this.accountsToolStripMenuItem.Text = "&Accounts...";
this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click); this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click);
// //
// basicSettingsToolStripMenuItem // basicSettingsToolStripMenuItem
// //
this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem"; this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem";
this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
this.basicSettingsToolStripMenuItem.Text = "&Settings..."; this.basicSettingsToolStripMenuItem.Text = "&Settings...";
this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click); this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(130, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(130, 6);
// //
// aboutToolStripMenuItem // aboutToolStripMenuItem
// //
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(133, 22); this.aboutToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
this.aboutToolStripMenuItem.Text = "A&bout..."; this.aboutToolStripMenuItem.Text = "A&bout...";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
// //
// statusStrip1 // statusStrip1
// //
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(40, 40); this.statusStrip1.ImageScalingSize = new System.Drawing.Size(40, 40);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.visibleCountLbl, this.visibleCountLbl,
this.springLbl, this.springLbl,
this.backupsCountsLbl, this.backupsCountsLbl,
this.pdfsCountsLbl}); this.pdfsCountsLbl});
this.statusStrip1.Location = new System.Drawing.Point(0, 618); this.statusStrip1.Location = new System.Drawing.Point(0, 618);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0); this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0);
this.statusStrip1.Size = new System.Drawing.Size(893, 22); this.statusStrip1.Size = new System.Drawing.Size(893, 22);
this.statusStrip1.TabIndex = 6; this.statusStrip1.TabIndex = 6;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
// visibleCountLbl // visibleCountLbl
// //
this.visibleCountLbl.FormatText = "Visible: {0}"; this.visibleCountLbl.FormatText = "Visible: {0}";
this.visibleCountLbl.Name = "visibleCountLbl"; this.visibleCountLbl.Name = "visibleCountLbl";
this.visibleCountLbl.Size = new System.Drawing.Size(61, 17); this.visibleCountLbl.Size = new System.Drawing.Size(61, 17);
this.visibleCountLbl.Text = "Visible: {0}"; this.visibleCountLbl.Text = "Visible: {0}";
// //
// springLbl // springLbl
// //
this.springLbl.Name = "springLbl"; this.springLbl.Name = "springLbl";
this.springLbl.Size = new System.Drawing.Size(379, 17); this.springLbl.Size = new System.Drawing.Size(379, 17);
this.springLbl.Spring = true; this.springLbl.Spring = true;
// //
// backupsCountsLbl // backupsCountsLbl
// //
this.backupsCountsLbl.Name = "backupsCountsLbl"; this.backupsCountsLbl.Name = "backupsCountsLbl";
this.backupsCountsLbl.Size = new System.Drawing.Size(218, 17); this.backupsCountsLbl.Size = new System.Drawing.Size(218, 17);
this.backupsCountsLbl.Text = "[Calculating backed up book quantities]"; this.backupsCountsLbl.Text = "[Calculating backed up book quantities]";
// //
// pdfsCountsLbl // pdfsCountsLbl
// //
this.pdfsCountsLbl.FormatText = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}"; this.pdfsCountsLbl.FormatText = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}";
this.pdfsCountsLbl.Name = "pdfsCountsLbl"; this.pdfsCountsLbl.Name = "pdfsCountsLbl";
this.pdfsCountsLbl.Size = new System.Drawing.Size(218, 17); this.pdfsCountsLbl.Size = new System.Drawing.Size(218, 17);
this.pdfsCountsLbl.Text = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}"; this.pdfsCountsLbl.Text = "| PDFs: NOT d/l\'ed: {0} Downloaded: {1}";
// //
// addQuickFilterBtn // addQuickFilterBtn
// //
this.addQuickFilterBtn.Location = new System.Drawing.Point(50, 3); this.addQuickFilterBtn.Location = new System.Drawing.Point(50, 3);
this.addQuickFilterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.addQuickFilterBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.addQuickFilterBtn.Name = "addQuickFilterBtn"; this.addQuickFilterBtn.Name = "addQuickFilterBtn";
this.addQuickFilterBtn.Size = new System.Drawing.Size(137, 27); this.addQuickFilterBtn.Size = new System.Drawing.Size(137, 27);
this.addQuickFilterBtn.TabIndex = 4; this.addQuickFilterBtn.TabIndex = 4;
this.addQuickFilterBtn.Text = "Add To Quick Filters"; this.addQuickFilterBtn.Text = "Add To Quick Filters";
this.addQuickFilterBtn.UseVisualStyleBackColor = true; this.addQuickFilterBtn.UseVisualStyleBackColor = true;
this.addQuickFilterBtn.Click += new System.EventHandler(this.addQuickFilterBtn_Click); this.addQuickFilterBtn.Click += new System.EventHandler(this.addQuickFilterBtn_Click);
// //
// splitContainer1 // splitContainer1
// //
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Name = "splitContainer1";
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.panel1); this.splitContainer1.Panel1.Controls.Add(this.panel1);
this.splitContainer1.Panel1.Controls.Add(this.menuStrip1); this.splitContainer1.Panel1.Controls.Add(this.menuStrip1);
this.splitContainer1.Panel1.Controls.Add(this.statusStrip1); this.splitContainer1.Panel1.Controls.Add(this.statusStrip1);
// //
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.processBookQueue1); this.splitContainer1.Panel2.Controls.Add(this.processBookQueue1);
this.splitContainer1.Size = new System.Drawing.Size(1231, 640); this.splitContainer1.Size = new System.Drawing.Size(1231, 640);
this.splitContainer1.SplitterDistance = 893; this.splitContainer1.SplitterDistance = 893;
this.splitContainer1.SplitterWidth = 8; this.splitContainer1.SplitterWidth = 8;
this.splitContainer1.TabIndex = 7; this.splitContainer1.TabIndex = 7;
// //
// panel1 // panel1
// //
this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel1.Controls.Add(this.toggleQueueHideBtn); this.panel1.Controls.Add(this.productsDisplay);
this.panel1.Controls.Add(this.gridPanel); this.panel1.Controls.Add(this.toggleQueueHideBtn);
this.panel1.Controls.Add(this.addQuickFilterBtn); this.panel1.Controls.Add(this.addQuickFilterBtn);
this.panel1.Controls.Add(this.filterHelpBtn); this.panel1.Controls.Add(this.filterHelpBtn);
this.panel1.Controls.Add(this.filterSearchTb); this.panel1.Controls.Add(this.filterSearchTb);
this.panel1.Controls.Add(this.filterBtn); this.panel1.Controls.Add(this.filterBtn);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 24); this.panel1.Location = new System.Drawing.Point(0, 24);
this.panel1.Margin = new System.Windows.Forms.Padding(0); this.panel1.Margin = new System.Windows.Forms.Padding(0);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(893, 594); this.panel1.Size = new System.Drawing.Size(893, 594);
this.panel1.TabIndex = 7; this.panel1.TabIndex = 7;
// //
// toggleQueueHideBtn // productsDisplay
// //
this.toggleQueueHideBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.productsDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.toggleQueueHideBtn.Location = new System.Drawing.Point(845, 3); | System.Windows.Forms.AnchorStyles.Left)
this.toggleQueueHideBtn.Margin = new System.Windows.Forms.Padding(4, 3, 15, 3); | System.Windows.Forms.AnchorStyles.Right)));
this.toggleQueueHideBtn.Name = "toggleQueueHideBtn"; this.productsDisplay.AutoScroll = true;
this.toggleQueueHideBtn.Size = new System.Drawing.Size(33, 27); this.productsDisplay.Location = new System.Drawing.Point(15, 36);
this.toggleQueueHideBtn.TabIndex = 8; this.productsDisplay.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.toggleQueueHideBtn.Text = "❱❱❱"; this.productsDisplay.Name = "productsDisplay";
this.toggleQueueHideBtn.UseVisualStyleBackColor = true; this.productsDisplay.Size = new System.Drawing.Size(863, 555);
this.toggleQueueHideBtn.Click += new System.EventHandler(this.ToggleQueueHideBtn_Click); this.productsDisplay.TabIndex = 9;
// this.productsDisplay.LiberateClicked += new System.EventHandler<DataLayer.LibraryBook>(this.ProductsDisplay_LiberateClicked);
// processBookQueue1 this.productsDisplay.VisibleCountChanged += new System.EventHandler<int>(this.productsDisplay_VisibleCountChanged);
// this.productsDisplay.InitialLoaded += new System.EventHandler(this.productsDisplay_InitialLoaded);
this.processBookQueue1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; //
this.processBookQueue1.Dock = System.Windows.Forms.DockStyle.Fill; // toggleQueueHideBtn
this.processBookQueue1.Location = new System.Drawing.Point(0, 0); //
this.processBookQueue1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.toggleQueueHideBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.processBookQueue1.Name = "processBookQueue1"; this.toggleQueueHideBtn.Location = new System.Drawing.Point(845, 3);
this.processBookQueue1.Size = new System.Drawing.Size(330, 640); this.toggleQueueHideBtn.Margin = new System.Windows.Forms.Padding(4, 3, 15, 3);
this.processBookQueue1.TabIndex = 0; this.toggleQueueHideBtn.Name = "toggleQueueHideBtn";
// this.toggleQueueHideBtn.Size = new System.Drawing.Size(33, 27);
// Form1 this.toggleQueueHideBtn.TabIndex = 8;
// this.toggleQueueHideBtn.Text = "❱❱❱";
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.toggleQueueHideBtn.UseVisualStyleBackColor = true;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.toggleQueueHideBtn.Click += new System.EventHandler(this.ToggleQueueHideBtn_Click);
this.ClientSize = new System.Drawing.Size(1231, 640); //
this.Controls.Add(this.splitContainer1); // processBookQueue1
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); //
this.MainMenuStrip = this.menuStrip1; this.processBookQueue1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.processBookQueue1.Dock = System.Windows.Forms.DockStyle.Fill;
this.Name = "Form1"; this.processBookQueue1.Location = new System.Drawing.Point(0, 0);
this.Text = "Libation: Liberate your Library"; this.processBookQueue1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Load += new System.EventHandler(this.Form1_Load); this.processBookQueue1.Name = "processBookQueue1";
this.menuStrip1.ResumeLayout(false); this.processBookQueue1.Size = new System.Drawing.Size(330, 640);
this.menuStrip1.PerformLayout(); this.processBookQueue1.TabIndex = 0;
this.statusStrip1.ResumeLayout(false); //
this.statusStrip1.PerformLayout(); // Form1
this.splitContainer1.Panel1.ResumeLayout(false); //
this.splitContainer1.Panel1.PerformLayout(); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.splitContainer1.Panel2.ResumeLayout(false); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.ClientSize = new System.Drawing.Size(1231, 640);
this.splitContainer1.ResumeLayout(false); this.Controls.Add(this.splitContainer1);
this.panel1.ResumeLayout(false); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.panel1.PerformLayout(); this.MainMenuStrip = this.menuStrip1;
this.ResumeLayout(false); this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "Form1";
this.Text = "Libation: Liberate your Library";
this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Panel gridPanel;
private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem;
private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.StatusStrip statusStrip1;
@ -581,5 +583,6 @@
private LibationWinForms.ProcessQueue.ProcessQueueControl processBookQueue1; private LibationWinForms.ProcessQueue.ProcessQueueControl processBookQueue1;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button toggleQueueHideBtn; private System.Windows.Forms.Button toggleQueueHideBtn;
private ProductsDisplay productsDisplay;
} }
} }

View File

@ -30,7 +30,7 @@ namespace LibationWinForms
try try
{ {
productsGrid.Filter(filterString); productsDisplay.Filter(filterString);
lastGoodFilter = filterString; lastGoodFilter = filterString;
} }
catch (Exception ex) catch (Exception ex)

View File

@ -14,14 +14,13 @@ namespace LibationWinForms
int WidthChange = 0; int WidthChange = 0;
private void Configure_ProcessQueue() private void Configure_ProcessQueue()
{ {
productsGrid.LiberateClicked += ProductsGrid_LiberateClicked;
processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut; processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut;
var coppalseState = Configuration.Instance.GetNonString<bool>(nameof(splitContainer1.Panel2Collapsed)); var coppalseState = Configuration.Instance.GetNonString<bool>(nameof(splitContainer1.Panel2Collapsed));
WidthChange = splitContainer1.Panel2.Width + splitContainer1.SplitterWidth; WidthChange = splitContainer1.Panel2.Width + splitContainer1.SplitterWidth;
SetQueueCollapseState(coppalseState); SetQueueCollapseState(coppalseState);
} }
private void ProductsGrid_LiberateClicked(object sender, LibraryBook e) private void ProductsDisplay_LiberateClicked(object sender, LibraryBook e)
{ {
if (e.Book.UserDefinedItem.BookStatus != LiberatedStatus.Liberated) if (e.Book.UserDefinedItem.BookStatus != LiberatedStatus.Liberated)
{ {

View File

@ -14,12 +14,6 @@ namespace LibationWinForms
Load += updateFiltersMenu; Load += updateFiltersMenu;
QuickFilters.UseDefaultChanged += updateFirstFilterIsDefaultToolStripMenuItem; QuickFilters.UseDefaultChanged += updateFirstFilterIsDefaultToolStripMenuItem;
QuickFilters.Updated += updateFiltersMenu; QuickFilters.Updated += updateFiltersMenu;
productsGrid.InitialLoaded += (_, __) =>
{
if (QuickFilters.UseDefault)
performFilter(QuickFilters.Filters.FirstOrDefault());
};
} }
private object quickFilterTag { get; } = new(); private object quickFilterTag { get; } = new();
@ -56,5 +50,11 @@ namespace LibationWinForms
private void addQuickFilterBtn_Click(object sender, EventArgs e) => QuickFilters.Add(this.filterSearchTb.Text); private void addQuickFilterBtn_Click(object sender, EventArgs e) => QuickFilters.Add(this.filterSearchTb.Text);
private void editQuickFiltersToolStripMenuItem_Click(object sender, EventArgs e) => new EditQuickFilters().ShowDialog(); private void editQuickFiltersToolStripMenuItem_Click(object sender, EventArgs e) => new EditQuickFilters().ShowDialog();
private void productsDisplay_InitialLoaded(object sender, EventArgs e)
{
if (QuickFilters.UseDefault)
performFilter(QuickFilters.Filters.FirstOrDefault());
}
} }
} }

View File

@ -17,28 +17,16 @@ namespace LibationWinForms
liberateVisibleToolStripMenuItem.Format(0); liberateVisibleToolStripMenuItem.Format(0);
liberateVisible2ToolStripMenuItem.Format(0); liberateVisible2ToolStripMenuItem.Format(0);
// bottom-left visible count
productsGrid.VisibleCountChanged += (_, qty) => visibleCountLbl.Format(qty);
// top menu strip // top menu strip
visibleBooksToolStripMenuItem.Format(0); visibleBooksToolStripMenuItem.Format(0);
productsGrid.VisibleCountChanged += (_, qty) => {
visibleBooksToolStripMenuItem.Format(qty);
visibleBooksToolStripMenuItem.Enabled = qty > 0;
var notLiberatedCount = productsGrid.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated);
};
productsGrid.VisibleCountChanged += setLiberatedVisibleMenuItemAsync;
LibraryCommands.BookUserDefinedItemCommitted += setLiberatedVisibleMenuItemAsync; LibraryCommands.BookUserDefinedItemCommitted += setLiberatedVisibleMenuItemAsync;
} }
private async void setLiberatedVisibleMenuItemAsync(object _, int __)
=> await Task.Run(setLiberatedVisibleMenuItem);
private async void setLiberatedVisibleMenuItemAsync(object _, EventArgs __) private async void setLiberatedVisibleMenuItemAsync(object _, EventArgs __)
=> await Task.Run(setLiberatedVisibleMenuItem); => await Task.Run(setLiberatedVisibleMenuItem);
void setLiberatedVisibleMenuItem() void setLiberatedVisibleMenuItem()
{ {
var notLiberated = productsGrid.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated); var notLiberated = productsDisplay.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated);
this.UIThreadSync(() => this.UIThreadSync(() =>
{ {
if (notLiberated > 0) if (notLiberated > 0)
@ -63,7 +51,7 @@ namespace LibationWinForms
private async void liberateVisible(object sender, EventArgs e) private async void liberateVisible(object sender, EventArgs e)
{ {
SetQueueCollapseState(false); SetQueueCollapseState(false);
await Task.Run(() => processBookQueue1.AddDownloadDecrypt(productsGrid.GetVisible())); await Task.Run(() => processBookQueue1.AddDownloadDecrypt(productsDisplay.GetVisible()));
} }
private void replaceTagsToolStripMenuItem_Click(object sender, EventArgs e) private void replaceTagsToolStripMenuItem_Click(object sender, EventArgs e)
@ -73,7 +61,7 @@ namespace LibationWinForms
if (result != DialogResult.OK) if (result != DialogResult.OK)
return; return;
var visibleLibraryBooks = productsGrid.GetVisible(); var visibleLibraryBooks = productsDisplay.GetVisible();
var confirmationResult = MessageBoxLib.ShowConfirmationDialog( var confirmationResult = MessageBoxLib.ShowConfirmationDialog(
visibleLibraryBooks, visibleLibraryBooks,
@ -95,7 +83,7 @@ namespace LibationWinForms
if (result != DialogResult.OK) if (result != DialogResult.OK)
return; return;
var visibleLibraryBooks = productsGrid.GetVisible(); var visibleLibraryBooks = productsDisplay.GetVisible();
var confirmationResult = MessageBoxLib.ShowConfirmationDialog( var confirmationResult = MessageBoxLib.ShowConfirmationDialog(
visibleLibraryBooks, visibleLibraryBooks,
@ -112,7 +100,7 @@ namespace LibationWinForms
private async void removeToolStripMenuItem_Click(object sender, EventArgs e) private async void removeToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var visibleLibraryBooks = productsGrid.GetVisible(); var visibleLibraryBooks = productsDisplay.GetVisible();
var confirmationResult = MessageBoxLib.ShowConfirmationDialog( var confirmationResult = MessageBoxLib.ShowConfirmationDialog(
visibleLibraryBooks, visibleLibraryBooks,
@ -125,5 +113,20 @@ namespace LibationWinForms
var visibleIds = visibleLibraryBooks.Select(lb => lb.Book.AudibleProductId).ToList(); var visibleIds = visibleLibraryBooks.Select(lb => lb.Book.AudibleProductId).ToList();
await LibraryCommands.RemoveBooksAsync(visibleIds); await LibraryCommands.RemoveBooksAsync(visibleIds);
} }
private async void productsDisplay_VisibleCountChanged(object sender, int qty)
{
// bottom-left visible count
visibleCountLbl.Format(qty);
// top menu strip
visibleBooksToolStripMenuItem.Format(qty);
visibleBooksToolStripMenuItem.Enabled = qty > 0;
//Not used for anything?
var notLiberatedCount = productsDisplay.GetVisible().Count(lb => lb.Book.UserDefinedItem.BookStatus == DataLayer.LiberatedStatus.NotLiberated);
await Task.Run(setLiberatedVisibleMenuItem);
}
} }
} }

View File

@ -12,24 +12,10 @@ namespace LibationWinForms
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
private ProductsDisplay productsGrid { get; }
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
if (this.DesignMode)
return;
{
// I'd actually like these lines to be handled in the designer, but I'm currently getting this error when I try:
// Failed to create component 'ProductsGrid'. The error message follows:
// 'Microsoft.DotNet.DesignTools.Client.DesignToolsServerException: Object reference not set to an instance of an object.
// Since the designer's choking on it, I'm keeping it below the DesignMode check to be safe
productsGrid = new ProductsDisplay { Dock = DockStyle.Fill };
gridPanel.Controls.Add(productsGrid);
}
// Pre-requisite: // Pre-requisite:
// Before calling anything else, including subscribing to events, ensure database exists. If we wait and let it happen lazily, race conditions and errors are likely during new installs // Before calling anything else, including subscribing to events, ensure database exists. If we wait and let it happen lazily, race conditions and errors are likely during new installs
using var _ = DbContexts.GetContext(); using var _ = DbContexts.GetContext();
@ -67,8 +53,8 @@ namespace LibationWinForms
// Configure_Grid(); // since it's just this, can keep here. If it needs more, then give grid it's own 'partial class Form1' // Configure_Grid(); // since it's just this, can keep here. If it needs more, then give grid it's own 'partial class Form1'
{ {
this.Load += (_, __) => productsGrid.Display(); this.Load += (_, __) => productsDisplay.Display();
LibraryCommands.LibrarySizeChanged += (_, __) => this.UIThreadAsync(() => productsGrid.Display()); LibraryCommands.LibrarySizeChanged += (_, __) => this.UIThreadAsync(() => productsDisplay.Display());
} }
} }

View File

@ -45,9 +45,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="grid\ProductsGrid.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
@ -56,9 +53,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="grid\ProductsGrid.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx"> <EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@ -1,4 +1,5 @@
using System.Drawing; using Dinah.Core.Windows.Forms;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace LibationWinForms namespace LibationWinForms
@ -18,6 +19,12 @@ namespace LibationWinForms
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{ {
if (rowIndex >= 0 && DataGridView.GetBoundItem<GridEntry>(rowIndex) is SeriesEntry)
{
base.Paint(graphics, clipBounds, cellBounds, rowIndex, DataGridViewElementStates.None, null, null, null, cellStyle, advancedBorderStyle, DataGridViewPaintParts.Background | DataGridViewPaintParts.Border);
return;
}
var tagsString = (string)value; var tagsString = (string)value;
var foreColor = tagsString?.Contains("hidden") == true ? HiddenForeColor : DataGridView.DefaultCellStyle.ForeColor; var foreColor = tagsString?.Contains("hidden") == true ? HiddenForeColor : DataGridView.DefaultCellStyle.ForeColor;

View File

@ -8,17 +8,17 @@ using System.Linq;
namespace LibationWinForms namespace LibationWinForms
{ {
/* /*
* Allows filtering of the underlying SortableBindingList<GridEntry> * Allows filtering of the underlying SortableBindingList<GridEntry>
* by implementing IBindingListView and using SearchEngineCommands * by implementing IBindingListView and using SearchEngineCommands
* *
* When filtering is applied, the filtered-out items are removed * When filtering is applied, the filtered-out items are removed
* from the base list and added to the private FilterRemoved list. * from the base list and added to the private FilterRemoved list.
* When filtering is removed, items in the FilterRemoved list are * When filtering is removed, items in the FilterRemoved list are
* added back to the base list. * added back to the base list.
* *
* Remove is overridden to ensure that removed items are removed from * Remove is overridden to ensure that removed items are removed from
* the base list (visible items) as well as the FilterRemoved list. * the base list (visible items) as well as the FilterRemoved list.
*/ */
internal class FilterableSortableBindingList : SortableBindingList1<GridEntry>, IBindingListView internal class FilterableSortableBindingList : SortableBindingList1<GridEntry>, IBindingListView
{ {
/// <summary> /// <summary>
@ -50,14 +50,7 @@ namespace LibationWinForms
} }
/// <returns>All items in the list, including those filtered out.</returns> /// <returns>All items in the list, including those filtered out.</returns>
public List<GridEntry> AllItems() public List<GridEntry> AllItems() => Items.Concat(FilterRemoved).ToList();
{
var allItems = Items.Concat(FilterRemoved);
var series = allItems.Where(i => i is SeriesEntry).Cast<SeriesEntry>().SelectMany(s => s.Children);
return series.Concat(allItems).ToList();
}
private void ApplyFilter(string filterString) private void ApplyFilter(string filterString)
{ {
@ -65,32 +58,41 @@ namespace LibationWinForms
RemoveFilter(); RemoveFilter();
FilterString = filterString; FilterString = filterString;
SearchResults = SearchEngineCommands.Search(filterString); SearchResults = SearchEngineCommands.Search(filterString);
var filteredOut = Items.Where(i => i is LibraryBookEntry).Cast<LibraryBookEntry>().ExceptBy(SearchResults.Docs.Select(d => d.ProductId), ge => ge.AudibleProductId).Cast<GridEntry>().ToList();
var parents = Items.Where(i => i is SeriesEntry).Cast<SeriesEntry>(); var booksFilteredIn = Items.LibraryBooks().Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => (GridEntry)lbe);
foreach (var p in parents) //Find all series containing children that match the search criteria
var seriesFilteredIn = Items.Series().Where(s => s.Children.Join(SearchResults.Docs, lbe => lbe.AudibleProductId, d => d.ProductId, (lbe, d) => lbe).Any());
var filteredOut = Items.Except(booksFilteredIn.Concat(seriesFilteredIn)).ToList();
foreach (var item in filteredOut)
{ {
if (p.Children.Cast<LibraryBookEntry>().ExceptBy(SearchResults.Docs.Select(d => d.ProductId), ge => ge.AudibleProductId).Count() == p.Children.Count) FilterRemoved.Add(item);
{ base.Remove(item);
//Don't show series whose episodes have all been filtered out
filteredOut.Add(p);
}
} }
}
for (int i = 0; i < filteredOut.Count; i++) public void CollapseAll()
{ {
FilterRemoved.Add(filteredOut[i]); foreach (var series in Items.Series().ToList())
base.Remove(filteredOut[i]); CollapseItem(series);
} }
public void ExpandAll()
{
foreach (var series in Items.Series().ToList())
ExpandItem(series);
} }
public void CollapseItem(SeriesEntry sEntry) public void CollapseItem(SeriesEntry sEntry)
{ {
foreach (var item in Items.Where(b => b is LibraryBookEntry).Cast<LibraryBookEntry>().Where(b => b.Parent == sEntry).ToList()) foreach (var episode in Items.Where(b => b.Parent == sEntry).Cast<LibraryBookEntry>().ToList())
base.Remove(item); {
FilterRemoved.Add(episode);
base.Remove(episode);
}
sEntry.Liberate.Expanded = false; sEntry.Liberate.Expanded = false;
} }
@ -98,16 +100,17 @@ namespace LibationWinForms
public void ExpandItem(SeriesEntry sEntry) public void ExpandItem(SeriesEntry sEntry)
{ {
var sindex = Items.IndexOf(sEntry); var sindex = Items.IndexOf(sEntry);
var children = sEntry.Children.Cast<LibraryBookEntry>().ToList();
for (int i = 0; i < children.Count; i++) foreach (var episode in FilterRemoved.Where(b => b.Parent == sEntry).Cast<LibraryBookEntry>().ToList())
{ {
if (SearchResults is null || SearchResults.Docs.Any(d=> d.ProductId == children[i].AudibleProductId)) if (SearchResults is null || SearchResults.Docs.Any(d => d.ProductId == episode.AudibleProductId))
Insert(++sindex, children[i]);
else
{ {
FilterRemoved.Add(children[i]); FilterRemoved.Remove(episode);
Items.Insert(++sindex, episode);
} }
} }
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
sEntry.Liberate.Expanded = true; sEntry.Liberate.Expanded = true;
} }
@ -116,13 +119,15 @@ namespace LibationWinForms
if (FilterString is null) return; if (FilterString is null) return;
int visibleCount = Items.Count; int visibleCount = Items.Count;
for (int i = 0; i < FilterRemoved.Count; i++)
{
if (FilterRemoved[i].Parent is null || FilterRemoved[i].Parent.Liberate.Expanded)
base.InsertItem(i + visibleCount, FilterRemoved[i]);
}
FilterRemoved.Clear(); foreach (var item in FilterRemoved.ToList())
{
if (item.Parent is null || item.Parent.Liberate.Expanded)
{
FilterRemoved.Remove(item);
base.InsertItem(visibleCount++, item);
}
}
if (IsSortedCore) if (IsSortedCore)
Sort(); Sort();

View File

@ -5,25 +5,37 @@ using LibationFileManager;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;using System.Drawing;
using System.Drawing; using System.Linq;
namespace LibationWinForms namespace LibationWinForms
{ {
public interface IHierarchical<T> where T : class public interface IHierarchical<T> where T : class
{ {
T Parent { get; } T Parent { get; }
List<T> Children { get; }
} }
internal class LiberateStatus
public class LiberateStatus : IComparable
{ {
public LiberatedStatus BookStatus; public LiberatedStatus BookStatus;
public LiberatedStatus? PdfStatus; public LiberatedStatus? PdfStatus;
public bool IsSeries; public bool IsSeries;
public bool Expanded; public bool Expanded;
public int CompareTo(object obj)
{
if (obj is not LiberateStatus second) return -1;
if (IsSeries && !second.IsSeries) return -1;
else if (!IsSeries && second.IsSeries) return 1;
else if (IsSeries && second.IsSeries) return 0;
else if (BookStatus == LiberatedStatus.Liberated && second.BookStatus != LiberatedStatus.Liberated) return -1;
else if (BookStatus != LiberatedStatus.Liberated && second.BookStatus == LiberatedStatus.Liberated) return 1;
else return BookStatus.CompareTo(second.BookStatus);
}
} }
internal abstract class GridEntry : AsyncNotifyPropertyChanged, IMemberComparable, IHierarchical<GridEntry> public abstract class GridEntry : AsyncNotifyPropertyChanged, IMemberComparable, IHierarchical<GridEntry>
{ {
protected abstract Book Book { get; } protected abstract Book Book { get; }
@ -38,11 +50,15 @@ namespace LibationWinForms
NotifyPropertyChanged(); NotifyPropertyChanged();
} }
} }
[Browsable(false)]
public new bool InvokeRequired => base.InvokeRequired;
[Browsable(false)]
public GridEntry Parent { get; set; } public GridEntry Parent { get; set; }
public List<GridEntry> Children { get; set; } [Browsable(false)]
public abstract DateTime DateAdded { get; }
public abstract string ProductRating { get; protected set; } public abstract string ProductRating { get; protected set; }
public abstract string PurchaseDate { get; protected set; } public abstract string PurchaseDate { get; protected set; }
public abstract DateTime DateAdded { get; }
public abstract string MyRating { get; protected set; } public abstract string MyRating { get; protected set; }
public abstract string Series { get; protected set; } public abstract string Series { get; protected set; }
public abstract string Title { get; protected set; } public abstract string Title { get; protected set; }
@ -89,12 +105,20 @@ namespace LibationWinForms
{ typeof(float), new ObjectComparer<float>() }, { typeof(float), new ObjectComparer<float>() },
{ typeof(bool), new ObjectComparer<bool>() }, { typeof(bool), new ObjectComparer<bool>() },
{ typeof(DateTime), new ObjectComparer<DateTime>() }, { typeof(DateTime), new ObjectComparer<DateTime>() },
{ typeof(LiberatedStatus), new ObjectComparer<LiberatedStatus>() }, { typeof(LiberateStatus), new ObjectComparer<LiberateStatus>() },
}; };
~GridEntry() ~GridEntry()
{ {
PictureStorage.PictureCached -= PictureStorage_PictureCached; PictureStorage.PictureCached -= PictureStorage_PictureCached;
} }
}
internal static class GridEntryExtensions
{
public static IEnumerable<SeriesEntry> Series(this IEnumerable<GridEntry> gridEntries)
=> gridEntries.Where(i => i is SeriesEntry).Cast<SeriesEntry>();
public static IEnumerable<LibraryBookEntry> LibraryBooks(this IEnumerable<GridEntry> gridEntries)
=> gridEntries.Where(i => i is LibraryBookEntry).Cast<LibraryBookEntry>();
} }
} }

View File

@ -17,7 +17,7 @@ namespace LibationWinForms
/// <summary> /// <summary>
/// The View Model for a LibraryBook /// The View Model for a LibraryBook
/// </summary> /// </summary>
internal class LibraryBookEntry : GridEntry public class LibraryBookEntry : GridEntry
{ {
#region implementation properties NOT exposed to the view #region implementation properties NOT exposed to the view
// hide from public fields from Data Source GUI with [Browsable(false)] // hide from public fields from Data Source GUI with [Browsable(false)]
@ -187,7 +187,7 @@ namespace LibationWinForms
{ nameof(Category), () => Category }, { nameof(Category), () => Category },
{ nameof(Misc), () => Misc }, { nameof(Misc), () => Misc },
{ nameof(DisplayTags), () => DisplayTags }, { nameof(DisplayTags), () => DisplayTags },
{ nameof(Liberate), () => Liberate.BookStatus }, { nameof(Liberate), () => Liberate },
{ nameof(DateAdded), () => DateAdded }, { nameof(DateAdded), () => DateAdded },
}; };

View File

@ -1,26 +0,0 @@
using Dinah.Core.Windows.Forms;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LibationWinForms
{
internal class MasterDataGridView : DataGridView
{
internal delegate void LibraryBookEntryClickedEventHandler(DataGridViewCellEventArgs e, LibraryBookEntry entry);
public event LibraryBookEntryClickedEventHandler LibraryBookEntryClicked;
public MasterDataGridView()
{
}
public GridEntry getGridEntry(int rowIndex) => this.GetBoundItem<GridEntry>(rowIndex);
}
}

View File

@ -28,19 +28,38 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.productsGrid = new LibationWinForms.grid.ProductsGrid();
this.SuspendLayout(); this.SuspendLayout();
// //
// productsGrid
//
this.productsGrid.AutoScroll = true;
this.productsGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.productsGrid.Location = new System.Drawing.Point(0, 0);
this.productsGrid.Name = "productsGrid";
this.productsGrid.Size = new System.Drawing.Size(1510, 380);
this.productsGrid.TabIndex = 0;
this.productsGrid.LiberateClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryClickedEventHandler(this.productsGrid_LiberateClicked);
this.productsGrid.CoverClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryClickedEventHandler(this.productsGrid_CoverClicked);
this.productsGrid.DetailsClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryClickedEventHandler(this.productsGrid_DetailsClicked);
this.productsGrid.DescriptionClicked += new LibationWinForms.grid.ProductsGrid.LibraryBookEntryRectangleClickedEventHandler(this.productsGrid_DescriptionClicked);
this.productsGrid.VisibleCountChanged += new System.EventHandler<int>(this.productsGrid_VisibleCountChanged);
//
// ProductsDisplay // ProductsDisplay
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.productsGrid);
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "ProductsDisplay"; this.Name = "ProductsDisplay";
this.Size = new System.Drawing.Size(1510, 380); this.Size = new System.Drawing.Size(1510, 380);
this.Load += new System.EventHandler(this.ProductsDisplay_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private grid.ProductsGrid productsGrid;
} }
} }

View File

@ -6,65 +6,35 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using ApplicationServices; using ApplicationServices;
using DataLayer; using DataLayer;
using Dinah.Core.Windows.Forms;
using FileLiberator; using FileLiberator;
using LibationFileManager; using LibationFileManager;
using LibationWinForms.Dialogs; using LibationWinForms.Dialogs;
namespace LibationWinForms namespace LibationWinForms
{ {
#region // legacy instructions to update data_grid_view
// INSTRUCTIONS TO UPDATE DATA_GRID_VIEW
// - delete current DataGridView
// - view > other windows > data sources
// - refresh
// OR
// - Add New Data Source
// Object. Next
// LibationWinForms
// AudibleDTO
// GridEntry
// - 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 .net5 projects
// VS has improved since then with .net6+ but I haven't checked again
#endregion
public partial class ProductsDisplay : UserControl public partial class ProductsDisplay : UserControl
{ {
public event EventHandler<LibraryBook> LiberateClicked; public event EventHandler<LibraryBook> LiberateClicked;
/// <summary>Number of visible rows has changed</summary> /// <summary>Number of visible rows has changed</summary>
public event EventHandler<int> VisibleCountChanged; public event EventHandler<int> VisibleCountChanged;
// alias
private ProductsGrid grid;
public ProductsDisplay() public ProductsDisplay()
{ {
InitializeComponent(); InitializeComponent();
}
grid = new ProductsGrid(); private void ProductsDisplay_Load(object sender, EventArgs e)
grid.Dock = DockStyle.Fill; {
Controls.Add(grid); if (DesignMode)
if (this.DesignMode)
return; return;
grid.LiberateClicked += (_, book) => LiberateClicked?.Invoke(this, book.LibraryBook);
grid.DetailsClicked += Grid_DetailsClicked;
grid.CoverClicked += Grid_CoverClicked;
grid.DescriptionClicked += Grid_DescriptionClicked1;
} }
#region Button controls #region Button controls
private ImageDisplay imageDisplay; private ImageDisplay imageDisplay;
private async void Grid_CoverClicked(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry) private async void productsGrid_CoverClicked(LibraryBookEntry liveGridEntry)
{ {
var picDefinition = new PictureDefinition(liveGridEntry.LibraryBook.Book.PictureLarge ?? liveGridEntry.LibraryBook.Book.PictureId, PictureSize.Native); var picDefinition = new PictureDefinition(liveGridEntry.LibraryBook.Book.PictureLarge ?? liveGridEntry.LibraryBook.Book.PictureId, PictureSize.Native);
var picDlTask = Task.Run(() => PictureStorage.GetPictureSynchronously(picDefinition)); var picDlTask = Task.Run(() => PictureStorage.GetPictureSynchronously(picDefinition));
@ -87,7 +57,7 @@ namespace LibationWinForms
imageDisplay.CoverPicture = await picDlTask; imageDisplay.CoverPicture = await picDlTask;
} }
private void Grid_DescriptionClicked1(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry, Rectangle cellRectangle) private void productsGrid_DescriptionClicked(LibraryBookEntry liveGridEntry, Rectangle cellRectangle)
{ {
var displayWindow = new DescriptionDisplay var displayWindow = new DescriptionDisplay
{ {
@ -101,13 +71,13 @@ namespace LibationWinForms
displayWindow.Close(); displayWindow.Close();
} }
grid.Scroll += CloseWindow; productsGrid.Scroll += CloseWindow;
displayWindow.FormClosed += (_, _) => grid.Scroll -= CloseWindow; displayWindow.FormClosed += (_, _) => productsGrid.Scroll -= CloseWindow;
displayWindow.Show(this); displayWindow.Show(this);
} }
private void Grid_DetailsClicked(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry) private void productsGrid_DetailsClicked(LibraryBookEntry liveGridEntry)
{ {
var bookDetailsForm = new BookDetailsDialog(liveGridEntry.LibraryBook); var bookDetailsForm = new BookDetailsDialog(liveGridEntry.LibraryBook);
if (bookDetailsForm.ShowDialog() == DialogResult.OK) if (bookDetailsForm.ShowDialog() == DialogResult.OK)
@ -128,13 +98,12 @@ namespace LibationWinForms
if (!hasBeenDisplayed) if (!hasBeenDisplayed)
{ {
// bind // bind
grid.bindToGrid(lib); productsGrid.BindToGrid(lib);
hasBeenDisplayed = true; hasBeenDisplayed = true;
InitialLoaded?.Invoke(this, new()); InitialLoaded?.Invoke(this, new());
VisibleCountChanged?.Invoke(this, grid.GetVisible().Count());
} }
else else
grid.updateGrid(lib); productsGrid.UpdateGrid(lib);
} }
@ -143,10 +112,20 @@ namespace LibationWinForms
#region Filter #region Filter
public void Filter(string searchString) public void Filter(string searchString)
=> grid.Filter(searchString); => productsGrid.Filter(searchString);
#endregion #endregion
internal List<LibraryBook> GetVisible() => grid.GetVisible().ToList(); internal List<LibraryBook> GetVisible() => productsGrid.GetVisible().Select(v => v.LibraryBook).ToList();
private void productsGrid_VisibleCountChanged(object sender, int count)
{
VisibleCountChanged?.Invoke(this, count);
}
private void productsGrid_LiberateClicked(LibraryBookEntry liveGridEntry)
{
LiberateClicked?.Invoke(this, liveGridEntry.LibraryBook);
}
} }
} }

View File

@ -1,4 +1,4 @@
namespace LibationWinForms namespace LibationWinForms.grid
{ {
partial class ProductsGrid partial class ProductsGrid
{ {
@ -30,7 +30,6 @@
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.gridEntryBindingSource = new LibationWinForms.SyncBindingSource(this.components);
this.gridEntryDataGridView = new System.Windows.Forms.DataGridView(); this.gridEntryDataGridView = new System.Windows.Forms.DataGridView();
this.liberateGVColumn = new LibationWinForms.LiberateDataGridViewImageButtonColumn(); this.liberateGVColumn = new LibationWinForms.LiberateDataGridViewImageButtonColumn();
this.coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn(); this.coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn();
@ -47,39 +46,32 @@
this.miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tagAndDetailsGVColumn = new LibationWinForms.EditTagsDataGridViewImageButtonColumn(); this.tagAndDetailsGVColumn = new LibationWinForms.EditTagsDataGridViewImageButtonColumn();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
((System.ComponentModel.ISupportInitialize)(this.gridEntryBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// gridEntryBindingSource
//
this.gridEntryBindingSource.DataSource = typeof(LibationWinForms.GridEntry);
//
// gridEntryDataGridView // gridEntryDataGridView
// //
this.gridEntryDataGridView.AllowUserToAddRows = false; this.gridEntryDataGridView.AllowUserToAddRows = false;
this.gridEntryDataGridView.AllowUserToDeleteRows = false; this.gridEntryDataGridView.AllowUserToDeleteRows = false;
this.gridEntryDataGridView.AllowUserToOrderColumns = true; this.gridEntryDataGridView.AllowUserToOrderColumns = true;
this.gridEntryDataGridView.AllowUserToResizeRows = false; this.gridEntryDataGridView.AllowUserToResizeRows = false;
this.gridEntryDataGridView.AutoGenerateColumns = false;
this.gridEntryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.gridEntryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.liberateGVColumn, this.liberateGVColumn,
this.coverGVColumn, this.coverGVColumn,
this.titleGVColumn, this.titleGVColumn,
this.authorsGVColumn, this.authorsGVColumn,
this.narratorsGVColumn, this.narratorsGVColumn,
this.lengthGVColumn, this.lengthGVColumn,
this.seriesGVColumn, this.seriesGVColumn,
this.descriptionGVColumn, this.descriptionGVColumn,
this.categoryGVColumn, this.categoryGVColumn,
this.productRatingGVColumn, this.productRatingGVColumn,
this.purchaseDateGVColumn, this.purchaseDateGVColumn,
this.myRatingGVColumn, this.myRatingGVColumn,
this.miscGVColumn, this.miscGVColumn,
this.tagAndDetailsGVColumn}); this.tagAndDetailsGVColumn});
this.gridEntryDataGridView.ContextMenuStrip = this.contextMenuStrip1; this.gridEntryDataGridView.ContextMenuStrip = this.contextMenuStrip1;
this.gridEntryDataGridView.DataSource = this.gridEntryBindingSource;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
@ -90,16 +82,15 @@
this.gridEntryDataGridView.DefaultCellStyle = dataGridViewCellStyle1; this.gridEntryDataGridView.DefaultCellStyle = dataGridViewCellStyle1;
this.gridEntryDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; this.gridEntryDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridEntryDataGridView.Location = new System.Drawing.Point(0, 0); this.gridEntryDataGridView.Location = new System.Drawing.Point(0, 0);
this.gridEntryDataGridView.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gridEntryDataGridView.Name = "gridEntryDataGridView"; this.gridEntryDataGridView.Name = "gridEntryDataGridView";
this.gridEntryDataGridView.ReadOnly = true; this.gridEntryDataGridView.ReadOnly = true;
this.gridEntryDataGridView.RowHeadersVisible = false; this.gridEntryDataGridView.RowHeadersVisible = false;
this.gridEntryDataGridView.RowTemplate.Height = 82; this.gridEntryDataGridView.RowTemplate.Height = 82;
this.gridEntryDataGridView.Size = new System.Drawing.Size(1510, 380); this.gridEntryDataGridView.Size = new System.Drawing.Size(1510, 380);
this.gridEntryDataGridView.TabIndex = 0; this.gridEntryDataGridView.TabIndex = 0;
this.gridEntryDataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView_CellContentClick);
this.gridEntryDataGridView.CellToolTipTextNeeded += new System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler(this.gridEntryDataGridView_CellToolTipTextNeeded); this.gridEntryDataGridView.CellToolTipTextNeeded += new System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler(this.gridEntryDataGridView_CellToolTipTextNeeded);
this.gridEntryDataGridView.ColumnDisplayIndexChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridEntryDataGridView_ColumnDisplayIndexChanged); this.gridEntryDataGridView.ColumnDisplayIndexChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridEntryDataGridView_ColumnDisplayIndexChanged);
this.gridEntryDataGridView.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridEntryDataGridView_ColumnWidthChanged);
// //
// liberateGVColumn // liberateGVColumn
// //
@ -222,19 +213,18 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.Controls.Add(this.gridEntryDataGridView); this.Controls.Add(this.gridEntryDataGridView);
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "ProductsGrid"; this.Name = "ProductsGrid";
this.Size = new System.Drawing.Size(1510, 380); this.Size = new System.Drawing.Size(1510, 380);
((System.ComponentModel.ISupportInitialize)(this.gridEntryBindingSource)).EndInit(); this.Load += new System.EventHandler(this.ProductsGrid_Load);
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion
private LibationWinForms.SyncBindingSource gridEntryBindingSource; #endregion
private System.Windows.Forms.DataGridView gridEntryDataGridView; private System.Windows.Forms.DataGridView gridEntryDataGridView;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private LiberateDataGridViewImageButtonColumn liberateGVColumn; private LiberateDataGridViewImageButtonColumn liberateGVColumn;

View File

@ -1,103 +1,70 @@
using System; using DataLayer;
using Dinah.Core.Windows.Forms;
using LibationFileManager;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using ApplicationServices;
using DataLayer;
using Dinah.Core.Windows.Forms;
using LibationFileManager;
namespace LibationWinForms namespace LibationWinForms.grid
{ {
#region // legacy instructions to update data_grid_view
// INSTRUCTIONS TO UPDATE DATA_GRID_VIEW
// - delete current DataGridView
// - view > other windows > data sources
// - refresh
// OR
// - Add New Data Source
// Object. Next
// LibationWinForms
// AudibleDTO
// GridEntry
// - 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 .net5 projects
// VS has improved since then with .net6+ but I haven't checked again
#endregion
public partial class ProductsGrid : UserControl public partial class ProductsGrid : UserControl
{ {
public delegate void LibraryBookEntryClickedEventHandler(LibraryBookEntry liveGridEntry);
internal delegate void LibraryBookEntryClickedEventHandler(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry); public delegate void LibraryBookEntryRectangleClickedEventHandler(LibraryBookEntry liveGridEntry, Rectangle cellRectangle);
internal delegate void LibraryBookEntryRectangleClickedEventHandler(DataGridViewCellEventArgs e, LibraryBookEntry liveGridEntry, Rectangle cellRectangle);
internal event LibraryBookEntryClickedEventHandler LiberateClicked;
internal event LibraryBookEntryClickedEventHandler CoverClicked;
internal event LibraryBookEntryClickedEventHandler DetailsClicked;
internal event LibraryBookEntryRectangleClickedEventHandler DescriptionClicked;
public new event EventHandler<ScrollEventArgs> Scroll;
private FilterableSortableBindingList bindingList;
/// <summary>Number of visible rows has changed</summary> /// <summary>Number of visible rows has changed</summary>
public event EventHandler<int> VisibleCountChanged; public event EventHandler<int> VisibleCountChanged;
public event LibraryBookEntryClickedEventHandler LiberateClicked;
public event LibraryBookEntryClickedEventHandler CoverClicked;
public event LibraryBookEntryClickedEventHandler DetailsClicked;
public event LibraryBookEntryRectangleClickedEventHandler DescriptionClicked;
public new event EventHandler<ScrollEventArgs> Scroll;
// alias private FilterableSortableBindingList bindingList;
private DataGridView _dataGridView => gridEntryDataGridView; private SyncBindingSource gridEntryBindingSource;
public ProductsGrid() public ProductsGrid()
{ {
InitializeComponent(); InitializeComponent();
if (this.DesignMode)
return;
EnableDoubleBuffering(); EnableDoubleBuffering();
//There a bug in designer that causes errors if you add BindingSource to the DataGridView at design time.
_dataGridView.CellContentClick += DataGridView_CellContentClick; gridEntryBindingSource = new SyncBindingSource();
_dataGridView.Scroll += (_, s) => Scroll?.Invoke(this, s); gridEntryDataGridView.DataSource = gridEntryBindingSource;
gridEntryDataGridView.Scroll += (_, s) => Scroll?.Invoke(this, s);
Load += ProductsGrid_Load;
}
private void ProductsGrid_Scroll(object sender, ScrollEventArgs e)
{
throw new NotImplementedException();
} }
private void EnableDoubleBuffering() private void EnableDoubleBuffering()
{ {
var propertyInfo = _dataGridView.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); var propertyInfo = gridEntryDataGridView.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
propertyInfo.SetValue(_dataGridView, true, null); propertyInfo.SetValue(gridEntryDataGridView, true, null);
} }
#region Button controls #region Button controls
private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{ {
// handle grid button click: https://stackoverflow.com/a/13687844 // handle grid button click: https://stackoverflow.com/a/13687844
if (e.RowIndex < 0) if ( e.RowIndex < 0)
return; return;
var column = gridEntryDataGridView.Columns[e.ColumnIndex];
var entry = getGridEntry(e.RowIndex); var entry = getGridEntry(e.RowIndex);
if (entry is LibraryBookEntry lbEntry) if (entry is LibraryBookEntry lbEntry)
{ {
if (e.ColumnIndex == liberateGVColumn.Index) if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == liberateGVColumn.DataPropertyName)
LiberateClicked?.Invoke(e, lbEntry); LiberateClicked?.Invoke(lbEntry);
else if (e.ColumnIndex == tagAndDetailsGVColumn.Index && entry is LibraryBookEntry) else if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == tagAndDetailsGVColumn.DataPropertyName && entry is LibraryBookEntry)
DetailsClicked?.Invoke(e, lbEntry); DetailsClicked?.Invoke(lbEntry);
else if (e.ColumnIndex == descriptionGVColumn.Index) else if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == descriptionGVColumn.DataPropertyName)
DescriptionClicked?.Invoke(e, lbEntry, _dataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false)); DescriptionClicked?.Invoke(lbEntry, gridEntryDataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false));
else if (e.ColumnIndex == coverGVColumn.Index) else if (gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == coverGVColumn.DataPropertyName)
CoverClicked?.Invoke(e, lbEntry); CoverClicked?.Invoke(lbEntry);
} }
else if (entry is SeriesEntry sEntry && e.ColumnIndex == liberateGVColumn.Index) else if (entry is SeriesEntry sEntry && gridEntryDataGridView.Columns[e.ColumnIndex].DataPropertyName == liberateGVColumn.DataPropertyName)
{ {
if (sEntry.Liberate.Expanded) if (sEntry.Liberate.Expanded)
bindingList.CollapseItem(sEntry); bindingList.CollapseItem(sEntry);
@ -105,16 +72,19 @@ namespace LibationWinForms
bindingList.ExpandItem(sEntry); bindingList.ExpandItem(sEntry);
sEntry.NotifyPropertyChanged(nameof(sEntry.Liberate)); sEntry.NotifyPropertyChanged(nameof(sEntry.Liberate));
VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count());
} }
} }
private GridEntry getGridEntry(int rowIndex) => _dataGridView.GetBoundItem<GridEntry>(rowIndex); private GridEntry getGridEntry(int rowIndex) => gridEntryDataGridView.GetBoundItem<GridEntry>(rowIndex);
#endregion #endregion
#region UI display functions #region UI display functions
internal void bindToGrid(List<LibraryBook> dbBooks) internal void BindToGrid(List<LibraryBook> dbBooks)
{ {
var geList = dbBooks.Where(b => b.Book.ContentType is not ContentType.Episode).Select(b => new LibraryBookEntry(b)).Cast<GridEntry>().ToList(); var geList = dbBooks.Where(b => b.Book.ContentType is not ContentType.Episode).Select(b => new LibraryBookEntry(b)).Cast<GridEntry>().ToList();
@ -125,24 +95,28 @@ namespace LibationWinForms
foreach (var s in series) foreach (var s in series)
{ {
var seriesEntry = new SeriesEntry(); var seriesEntry = new SeriesEntry();
seriesEntry.Children = episodes.Where(lb => lb.Book.SeriesLink.First().Series == s.Book.SeriesLink.First().Series).Select(lb => new LibraryBookEntry(lb) { Parent = seriesEntry }).Cast<GridEntry>().ToList(); seriesEntry.Children = episodes.Where(lb => lb.Book.SeriesLink.First().Series == s.Book.SeriesLink.First().Series).Select(lb => new LibraryBookEntry(lb) { Parent = seriesEntry }).ToList();
seriesEntry.setSeriesBook(s); seriesEntry.setSeriesBook(s);
geList.Add(seriesEntry); geList.Add(seriesEntry);
geList.AddRange(seriesEntry.Children);
} }
bindingList = new FilterableSortableBindingList(geList.OrderByDescending(ge => ge.DateAdded)); bindingList = new FilterableSortableBindingList(geList.OrderByDescending(e => e.DateAdded));
bindingList.CollapseAll();
gridEntryBindingSource.DataSource = bindingList; gridEntryBindingSource.DataSource = bindingList;
VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count());
} }
internal void updateGrid(List<LibraryBook> dbBooks) internal void UpdateGrid(List<LibraryBook> dbBooks)
{ {
int visibleCount = bindingList.Count; int visibleCount = bindingList.Count;
string existingFilter = gridEntryBindingSource.Filter; string existingFilter = gridEntryBindingSource.Filter;
//Add absent books to grid, or update current books //Add absent books to grid, or update current books
var allItmes = bindingList.AllItems().Where(i => i is LibraryBookEntry).Cast<LibraryBookEntry>(); var allItmes = bindingList.AllItems().LibraryBooks();
for (var i = dbBooks.Count - 1; i >= 0; i--) for (var i = dbBooks.Count - 1; i >= 0; i--)
{ {
var libraryBook = dbBooks[i]; var libraryBook = dbBooks[i];
@ -155,26 +129,31 @@ namespace LibationWinForms
if (libraryBook.Book.ContentType is ContentType.Episode) if (libraryBook.Book.ContentType is ContentType.Episode)
{ {
//Find the series that libraryBook, if it exists //Find the series that libraryBook belongs to, if it exists
var series = bindingList.AllItems().Where(i => i is SeriesEntry).Cast<SeriesEntry>().FirstOrDefault(i => libraryBook.Book.SeriesLink.Any(s => s.Series.Name == i.Series)); var series = bindingList.AllItems().Series().FirstOrDefault(i => libraryBook.Book.SeriesLink.Any(s => s.Series.Name == i.Series));
if (series is null) if (series is null)
{ {
//Series doesn't exist yet, so create and add it //Series doesn't exist yet, so create and add it
var newSeries = new SeriesEntry { Children = new List<GridEntry> { lb } }; var newSeries = new SeriesEntry { Children = new List<LibraryBookEntry> { lb } };
newSeries.setSeriesBook(libraryBook.Book.SeriesLink.First()); newSeries.setSeriesBook(libraryBook.Book.SeriesLink.First());
lb.Parent = newSeries; lb.Parent = newSeries;
newSeries.Liberate.Expanded = true; newSeries.Liberate.Expanded = true;
bindingList.Insert(0, newSeries); bindingList.Insert(0, newSeries);
series = newSeries;
} }
else else
{ {
lb.Parent = series; lb.Parent = series;
series.Children.Add(lb); series.Children.Add(lb);
} }
//Add episode beneath the parent
int seriesIndex = bindingList.IndexOf(series);
bindingList.Insert(seriesIndex + 1, lb);
} }
//Add the new product else
bindingList.Insert(0, lb); //Add the new product
bindingList.Insert(0, lb);
} }
// update existing // update existing
else else
@ -195,24 +174,27 @@ namespace LibationWinForms
var removedBooks = var removedBooks =
bindingList bindingList
.AllItems() .AllItems()
.Where(i => i is LibraryBookEntry) .LibraryBooks()
.Cast<LibraryBookEntry>()
.ExceptBy(dbBooks.Select(lb => lb.Book.AudibleProductId), ge => ge.AudibleProductId); .ExceptBy(dbBooks.Select(lb => lb.Book.AudibleProductId), ge => ge.AudibleProductId);
foreach (var removed in removedBooks.Where(b => b.Parent is not null))
{
((SeriesEntry)removed.Parent).Children.Remove(removed);
}
//Remove series that have no children //Remove series that have no children
var removedSeries = var removedSeries =
bindingList bindingList
.AllItems() .AllItems()
.Where(i => i is SeriesEntry) .Series()
.Cast<SeriesEntry>() .Where(i => i.Children.Count == 0);
.Where(i => removedBooks.Count(r => r.Series == i.Series) == i.Children.Count);
foreach (var removed in removedBooks.Cast<GridEntry>().Concat(removedSeries)) foreach (var removed in removedBooks.Cast<GridEntry>().Concat(removedSeries))
//no need to re-filter for removed books //no need to re-filter for removed books
bindingList.Remove(removed); bindingList.Remove(removed);
if (bindingList.Count != visibleCount) if (bindingList.Count != visibleCount)
VisibleCountChanged?.Invoke(this, bindingList.Count); VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count());
} }
#endregion #endregion
@ -229,24 +211,19 @@ namespace LibationWinForms
gridEntryBindingSource.Filter = searchString; gridEntryBindingSource.Filter = searchString;
if (visibleCount != bindingList.Count) if (visibleCount != bindingList.Count)
VisibleCountChanged?.Invoke(this, bindingList.Count); VisibleCountChanged?.Invoke(this, bindingList.LibraryBooks().Count());
} }
#endregion #endregion
internal IEnumerable<LibraryBook> GetVisible() internal IEnumerable<LibraryBookEntry> GetVisible()
=> bindingList => bindingList
.Where(row => row is LibraryBookEntry) .LibraryBooks();
.Cast<LibraryBookEntry>()
.Select(row => row.LibraryBook);
#region Column Customizations
// to ensure this is only ever called once: Load instead of 'override OnVisibleChanged'
private void ProductsGrid_Load(object sender, EventArgs e) private void ProductsGrid_Load(object sender, EventArgs e)
{ {
if (this.DesignMode) gridEntryDataGridView.ColumnWidthChanged += gridEntryDataGridView_ColumnWidthChanged;
return;
contextMenuStrip1.Items.Add(new ToolStripLabel("Show / Hide Columns")); contextMenuStrip1.Items.Add(new ToolStripLabel("Show / Hide Columns"));
contextMenuStrip1.Items.Add(new ToolStripSeparator()); contextMenuStrip1.Items.Add(new ToolStripSeparator());
@ -259,7 +236,7 @@ namespace LibationWinForms
var cmsKiller = new ContextMenuStrip(); var cmsKiller = new ContextMenuStrip();
foreach (DataGridViewColumn column in _dataGridView.Columns) foreach (DataGridViewColumn column in gridEntryDataGridView.Columns)
{ {
var itemName = column.DataPropertyName; var itemName = column.DataPropertyName;
var visible = gridColumnsVisibilities.GetValueOrDefault(itemName, true); var visible = gridColumnsVisibilities.GetValueOrDefault(itemName, true);
@ -288,38 +265,19 @@ namespace LibationWinForms
//We must set DisplayIndex properties in ascending order //We must set DisplayIndex properties in ascending order
foreach (var itemName in displayIndices.OrderBy(i => i.Value).Select(i => i.Key)) foreach (var itemName in displayIndices.OrderBy(i => i.Value).Select(i => i.Key))
{ {
var column = _dataGridView.Columns var column = gridEntryDataGridView.Columns
.Cast<DataGridViewColumn>() .Cast<DataGridViewColumn>()
.Single(c => c.DataPropertyName == itemName); .Single(c => c.DataPropertyName == itemName);
column.DisplayIndex = displayIndices.GetValueOrDefault(itemName, column.Index); column.DisplayIndex = displayIndices.GetValueOrDefault(itemName, column.Index);
} }
} }
private void gridEntryDataGridView_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e)
{
var config = Configuration.Instance;
var dictionary = config.GridColumnsDisplayIndices;
dictionary[e.Column.DataPropertyName] = e.Column.DisplayIndex;
config.GridColumnsDisplayIndices = dictionary;
}
private void gridEntryDataGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
{
var config = Configuration.Instance;
var dictionary = config.GridColumnsWidths;
dictionary[e.Column.DataPropertyName] = e.Column.Width;
config.GridColumnsWidths = dictionary;
}
private void HideMenuItem_Click(object sender, EventArgs e) private void HideMenuItem_Click(object sender, EventArgs e)
{ {
var menuItem = sender as ToolStripMenuItem; var menuItem = sender as ToolStripMenuItem;
var propertyName = menuItem.Tag as string; var propertyName = menuItem.Tag as string;
var column = _dataGridView.Columns var column = gridEntryDataGridView.Columns
.Cast<DataGridViewColumn>() .Cast<DataGridViewColumn>()
.FirstOrDefault(c => c.DataPropertyName == propertyName); .FirstOrDefault(c => c.DataPropertyName == propertyName);
@ -337,6 +295,15 @@ namespace LibationWinForms
} }
} }
private void gridEntryDataGridView_ColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e)
{
var config = Configuration.Instance;
var dictionary = config.GridColumnsDisplayIndices;
dictionary[e.Column.DataPropertyName] = e.Column.DisplayIndex;
config.GridColumnsDisplayIndices = dictionary;
}
private void gridEntryDataGridView_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e) private void gridEntryDataGridView_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)
{ {
if (e.ColumnIndex == descriptionGVColumn.Index) if (e.ColumnIndex == descriptionGVColumn.Index)
@ -345,6 +312,12 @@ namespace LibationWinForms
e.ToolTipText = "Click to see full size"; e.ToolTipText = "Click to see full size";
} }
#endregion private void gridEntryDataGridView_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
{
var config = Configuration.Instance;
var dictionary = config.GridColumnsWidths;
dictionary[e.Column.DataPropertyName] = e.Column.Width;
}
} }
} }

View File

@ -57,7 +57,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>81</value> <value>17, 17</value>
</metadata> </metadata>
</root> </root>

View File

@ -12,6 +12,7 @@ namespace LibationWinForms
{ {
internal class SeriesEntry : GridEntry internal class SeriesEntry : GridEntry
{ {
public List<LibraryBookEntry> Children { get; set; }
public override DateTime DateAdded => Children.Max(c => c.DateAdded); public override DateTime DateAdded => Children.Max(c => c.DateAdded);
public override string ProductRating { get; protected set; } public override string ProductRating { get; protected set; }
public override string PurchaseDate { get; protected set; } public override string PurchaseDate { get; protected set; }
@ -24,7 +25,7 @@ namespace LibationWinForms
public override string Category { get; protected set; } public override string Category { get; protected set; }
public override string Misc { get; protected set; } public override string Misc { get; protected set; }
public override string Description { get; protected set; } public override string Description { get; protected set; }
public override string DisplayTags => string.Empty; public override string DisplayTags { get; } = string.Empty;
public override LiberateStatus Liberate => _liberate; public override LiberateStatus Liberate => _liberate;
@ -41,18 +42,17 @@ namespace LibationWinForms
// Immutable properties // Immutable properties
{ {
var childLB = Children.Cast<LibraryBookEntry>(); int bookLenMins = Children.Sum(c => c.LibraryBook.Book.LengthInMinutes);
int bookLenMins = childLB.Sum(c => c.LibraryBook.Book.LengthInMinutes);
var myAverageRating = new Rating(childLB.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.OverallRating), childLB.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.PerformanceRating), childLB.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.StoryRating)); var myAverageRating = new Rating(Children.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.OverallRating), Children.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.PerformanceRating), Children.Average(c => c.LibraryBook.Book.UserDefinedItem.Rating.StoryRating));
var productAverageRating = new Rating(childLB.Average(c => c.LibraryBook.Book.Rating.OverallRating), childLB.Average(c => c.LibraryBook.Book.Rating.PerformanceRating), childLB.Average(c => c.LibraryBook.Book.Rating.StoryRating)); var productAverageRating = new Rating(Children.Average(c => c.LibraryBook.Book.Rating.OverallRating), Children.Average(c => c.LibraryBook.Book.Rating.PerformanceRating), Children.Average(c => c.LibraryBook.Book.Rating.StoryRating));
Title = SeriesBook.Series.Name; Title = SeriesBook.Series.Name;
Series = SeriesBook.Series.Name; Series = SeriesBook.Series.Name;
Length = bookLenMins == 0 ? "" : $"{bookLenMins / 60} hr {bookLenMins % 60} min"; Length = bookLenMins == 0 ? "" : $"{bookLenMins / 60} hr {bookLenMins % 60} min";
MyRating = myAverageRating.ToStarString()?.DefaultIfNullOrWhiteSpace(""); MyRating = myAverageRating.ToStarString()?.DefaultIfNullOrWhiteSpace("");
PurchaseDate = childLB.Min(c => c.LibraryBook.DateAdded).ToString("d"); PurchaseDate = Children.Min(c => c.LibraryBook.DateAdded).ToString("d");
ProductRating = productAverageRating.ToStarString()?.DefaultIfNullOrWhiteSpace(""); ProductRating = productAverageRating.ToStarString()?.DefaultIfNullOrWhiteSpace("");
Authors = Book.AuthorNames(); Authors = Book.AuthorNames();
Narrators = Book.NarratorNames(); Narrators = Book.NarratorNames();
@ -73,17 +73,17 @@ namespace LibationWinForms
{ {
{ nameof(Title), () => Book.SeriesSortable() }, { nameof(Title), () => Book.SeriesSortable() },
{ nameof(Series), () => Book.SeriesSortable() }, { nameof(Series), () => Book.SeriesSortable() },
{ nameof(Length), () => Children.Cast<LibraryBookEntry>().Sum(c=>c.LibraryBook.Book.LengthInMinutes) }, { nameof(Length), () => Children.Sum(c=>c.LibraryBook.Book.LengthInMinutes) },
{ nameof(MyRating), () => Children.Cast<LibraryBookEntry>().Average(c=>c.LibraryBook.Book.UserDefinedItem.Rating.FirstScore()) }, { nameof(MyRating), () => Children.Average(c=>c.LibraryBook.Book.UserDefinedItem.Rating.FirstScore()) },
{ nameof(PurchaseDate), () => Children.Cast<LibraryBookEntry>().Min(c=>c.LibraryBook.DateAdded) }, { nameof(PurchaseDate), () => Children.Min(c=>c.LibraryBook.DateAdded) },
{ nameof(ProductRating), () => Children.Cast<LibraryBookEntry>().Average(c => c.LibraryBook.Book.Rating.FirstScore()) }, { nameof(ProductRating), () => Children.Average(c => c.LibraryBook.Book.Rating.FirstScore()) },
{ nameof(Authors), () => string.Empty }, { nameof(Authors), () => string.Empty },
{ nameof(Narrators), () => string.Empty }, { nameof(Narrators), () => string.Empty },
{ nameof(Description), () => string.Empty }, { nameof(Description), () => string.Empty },
{ nameof(Category), () => string.Empty }, { nameof(Category), () => string.Empty },
{ nameof(Misc), () => string.Empty }, { nameof(Misc), () => string.Empty },
{ nameof(DisplayTags), () => string.Empty }, { nameof(DisplayTags), () => string.Empty },
{ nameof(Liberate), () => Liberate.BookStatus }, { nameof(Liberate), () => Liberate },
{ nameof(DateAdded), () => DateAdded }, { nameof(DateAdded), () => DateAdded },
}; };
} }

View File

@ -3,8 +3,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibationWinForms namespace LibationWinForms
{ {
@ -42,22 +40,20 @@ namespace LibationWinForms
{ {
List<T> itemsList = (List<T>)Items; List<T> itemsList = (List<T>)Items;
//Array.Sort() and List<T>.Sort() are unstable sorts. OrderBy is stable. var sortedItems = Items.OrderBy(ge => ge, Comparer).ToList();
var sortedItems = itemsList.OrderBy((ge) => ge, Comparer).ToList();
var children = sortedItems.Where(i => i.Parent is not null).ToList(); var children = sortedItems.Where(i => i.Parent is not null).ToList();
var parents = sortedItems.Where(i => i.Children is not null).ToList();
//Top Level items
var topLevelItems = sortedItems.Except(children);
itemsList.Clear(); itemsList.Clear();
itemsList.AddRange(topLevelItems);
foreach (var p in parents) //Only add parentless items at this stage. After these items are added in the
//correct sorting order, go back and add the children beneath their parents.
itemsList.AddRange(sortedItems.Except(children));
foreach (var parent in children.Select(c => c.Parent).Distinct())
{ {
var pIndex = itemsList.IndexOf(p); var pIndex = itemsList.IndexOf(parent);
foreach (var c in children.Where(c=> c.Parent == p)) foreach (var c in children.Where(c=> c.Parent == parent))
itemsList.Insert(++pIndex, c); itemsList.Insert(++pIndex, c);
} }
} }
@ -86,26 +82,5 @@ namespace LibationWinForms
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
} }
protected override int FindCore(PropertyDescriptor property, object key)
{
int count = Count;
System.Collections.IComparer valueComparer = null;
for (int i = 0; i < count; ++i)
{
var element = this[i];
var elemValue = element.GetMemberValue(property.Name);
valueComparer ??= element.GetMemberComparer(elemValue.GetType());
if (valueComparer.Compare(elemValue, key) == 0)
{
return i;
}
}
return -1;
}
} }
} }