From d5ba405de0441bee22e986f5bc5dd4edfd1eac7f Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Wed, 11 May 2022 23:44:33 -0600 Subject: [PATCH] MatchCurrent --- Source/LibationWinForms/Form1.Designer.cs | 116 +++++++++---------- Source/LibationWinForms/Form1.cs | 33 +++--- Source/LibationWinForms/grid/ProductsGrid.cs | 7 +- 3 files changed, 77 insertions(+), 79 deletions(-) diff --git a/Source/LibationWinForms/Form1.Designer.cs b/Source/LibationWinForms/Form1.Designer.cs index 21c6c13e..087a62fb 100644 --- a/Source/LibationWinForms/Form1.Designer.cs +++ b/Source/LibationWinForms/Form1.Designer.cs @@ -1,33 +1,33 @@ namespace LibationWinForms { - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } - #region Windows Form Designer generated code + #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.gridPanel = new System.Windows.Forms.Panel(); this.filterHelpBtn = new System.Windows.Forms.Button(); @@ -76,8 +76,8 @@ // // gridPanel // - this.gridPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.gridPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.gridPanel.Location = new System.Drawing.Point(34, 178); this.gridPanel.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); @@ -110,7 +110,7 @@ // // filterSearchTb // - this.filterSearchTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + 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(527, 90); this.filterSearchTb.Margin = new System.Windows.Forms.Padding(10, 8, 10, 8); @@ -445,38 +445,38 @@ this.ResumeLayout(false); this.PerformLayout(); - } + } - #endregion + #endregion - private System.Windows.Forms.Panel gridPanel; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem; - private System.Windows.Forms.StatusStrip statusStrip1; - private System.Windows.Forms.ToolStripStatusLabel springLbl; - private System.Windows.Forms.ToolStripStatusLabel visibleCountLbl; - private System.Windows.Forms.ToolStripMenuItem liberateToolStripMenuItem; - private System.Windows.Forms.ToolStripStatusLabel backupsCountsLbl; - private System.Windows.Forms.ToolStripMenuItem beginBookBackupsToolStripMenuItem; - private System.Windows.Forms.ToolStripStatusLabel pdfsCountsLbl; - private System.Windows.Forms.ToolStripMenuItem beginPdfBackupsToolStripMenuItem; - private System.Windows.Forms.TextBox filterSearchTb; - private System.Windows.Forms.Button filterBtn; - private System.Windows.Forms.Button filterHelpBtn; - private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem scanLibraryToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem quickFiltersToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem firstFilterIsDefaultToolStripMenuItem; - private System.Windows.Forms.Button addFilterBtn; - private System.Windows.Forms.ToolStripMenuItem editQuickFiltersToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem basicSettingsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem accountsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem scanLibraryOfAllAccountsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem scanLibraryOfSomeAccountsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem noAccountsYetAddAccountToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem exportLibraryToolStripMenuItem; + private System.Windows.Forms.Panel gridPanel; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel springLbl; + private System.Windows.Forms.ToolStripStatusLabel visibleCountLbl; + private System.Windows.Forms.ToolStripMenuItem liberateToolStripMenuItem; + private System.Windows.Forms.ToolStripStatusLabel backupsCountsLbl; + private System.Windows.Forms.ToolStripMenuItem beginBookBackupsToolStripMenuItem; + private System.Windows.Forms.ToolStripStatusLabel pdfsCountsLbl; + private System.Windows.Forms.ToolStripMenuItem beginPdfBackupsToolStripMenuItem; + private System.Windows.Forms.TextBox filterSearchTb; + private System.Windows.Forms.Button filterBtn; + private System.Windows.Forms.Button filterHelpBtn; + private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem scanLibraryToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem quickFiltersToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem firstFilterIsDefaultToolStripMenuItem; + private System.Windows.Forms.Button addFilterBtn; + private System.Windows.Forms.ToolStripMenuItem editQuickFiltersToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem basicSettingsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem accountsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem scanLibraryOfAllAccountsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem scanLibraryOfSomeAccountsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem noAccountsYetAddAccountToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem exportLibraryToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem convertAllM4bToMp3ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeLibraryBooksToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeAllAccountsToolStripMenuItem; diff --git a/Source/LibationWinForms/Form1.cs b/Source/LibationWinForms/Form1.cs index dcfde7b5..e22021b9 100644 --- a/Source/LibationWinForms/Form1.cs +++ b/Source/LibationWinForms/Form1.cs @@ -42,9 +42,9 @@ namespace LibationWinForms this.FormClosing += (_, _) => this.SaveSizeAndLocation(Configuration.Instance); LibraryCommands.LibrarySizeChanged += reloadGridAndUpdateBottomNumbers; LibraryCommands.BookUserDefinedItemCommitted += setBackupCounts; - QuickFilters.Updated += updateFiltersMenu; - LibraryCommands.ScanBegin += LibraryCommands_ScanBegin; - LibraryCommands.ScanEnd += LibraryCommands_ScanEnd; + QuickFilters.Updated += updateFiltersMenu; + LibraryCommands.ScanBegin += LibraryCommands_ScanBegin; + LibraryCommands.ScanEnd += LibraryCommands_ScanEnd; // accounts updated this.Load += refreshImportMenu; @@ -86,7 +86,7 @@ namespace LibationWinForms this.UIThreadAsync(() => doFilter(lastGoodFilter)); setBackupCounts(); - } + } #region bottom: backup counts private System.ComponentModel.BackgroundWorker updateCountsBw; @@ -258,7 +258,7 @@ namespace LibationWinForms Configuration.Instance.AutoScanChanged += startAutoScan; } - private List<(string AccountId, string LocaleName)> preSaveDefaultAccounts; + private List<(string AccountId, string LocaleName)> preSaveDefaultAccounts; private List<(string AccountId, string LocaleName)> getDefaultAccounts() { using var persister = AudibleApiStorage.GetAccountsSettingsPersister(); @@ -317,11 +317,11 @@ namespace LibationWinForms } private async void scanLibraryToolStripMenuItem_Click(object sender, EventArgs e) - { - using var persister = AudibleApiStorage.GetAccountsSettingsPersister(); - var firstAccount = persister.AccountsSettings.GetAll().FirstOrDefault(); - await scanLibrariesAsync(firstAccount); - } + { + using var persister = AudibleApiStorage.GetAccountsSettingsPersister(); + var firstAccount = persister.AccountsSettings.GetAll().FirstOrDefault(); + await scanLibrariesAsync(firstAccount); + } private async void scanLibraryOfAllAccountsToolStripMenuItem_Click(object sender, EventArgs e) { @@ -518,7 +518,8 @@ namespace LibationWinForms #region Visible Books menu private void configVisibleBooksMenu() { - productsGrid.VisibleCountChanged += (_, qty) => { + productsGrid.VisibleCountChanged += (_, qty) => + { visibleBooksToolStripMenuItem.Text = string.Format(visibleBooksToolStripMenuItem_format, qty); visibleBooksToolStripMenuItem.Enabled = qty > 0; @@ -572,11 +573,11 @@ namespace LibationWinForms private void basicSettingsToolStripMenuItem_Click(object sender, EventArgs e) => new SettingsDialog().ShowDialog(); - private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) => MessageBox.Show($"Running Libation version {AppScaffolding.LibationScaffolding.BuildVersion}", $"Libation v{AppScaffolding.LibationScaffolding.BuildVersion}"); - #endregion + #endregion - #region Scanning label + #region Scanning label private void LibraryCommands_ScanBegin(object sender, int accountsLength) { scanLibraryToolStripMenuItem.Enabled = false; @@ -598,6 +599,6 @@ namespace LibationWinForms this.scanningToolStripMenuItem.Visible = false; } - #endregion - } + #endregion + } } diff --git a/Source/LibationWinForms/grid/ProductsGrid.cs b/Source/LibationWinForms/grid/ProductsGrid.cs index 1f32af6c..02e4d2a6 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.cs +++ b/Source/LibationWinForms/grid/ProductsGrid.cs @@ -15,6 +15,7 @@ using LibationWinForms.Dialogs; namespace LibationWinForms { + #region // legacy instructions to update data_grid_view // INSTRUCTIONS TO UPDATE DATA_GRID_VIEW // - delete current DataGridView @@ -36,7 +37,6 @@ namespace LibationWinForms public partial class ProductsGrid : UserControl { - internal event EventHandler LiberateClicked; /// Number of visible rows has changed public event EventHandler VisibleCountChanged; @@ -124,7 +124,7 @@ namespace LibationWinForms displayWindow.Show(this); } - private async Task Liberate_Click(GridEntry liveGridEntry) + private static async Task Liberate_Click(GridEntry liveGridEntry) { var libraryBook = liveGridEntry.LibraryBook; @@ -271,9 +271,6 @@ namespace LibationWinForms .Select(row => ((GridEntry)row.DataBoundItem).LibraryBook) .ToList(); - internal IEnumerable AllEntries - => bindingList; - private GridEntry getGridEntry(int rowIndex) => _dataGridView.GetBoundItem(rowIndex); #region Column Customizations