diff --git a/Source/LibationWinForms/grid/DescriptionDisplay.Designer.cs b/Source/LibationWinForms/grid/DescriptionDisplay.Designer.cs new file mode 100644 index 00000000..061695bf --- /dev/null +++ b/Source/LibationWinForms/grid/DescriptionDisplay.Designer.cs @@ -0,0 +1,63 @@ +namespace LibationWinForms +{ + partial class DescriptionDisplay + { + /// + /// 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); + } + + #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() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox1.Location = new System.Drawing.Point(0, 0); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(413, 162); + this.textBox1.TabIndex = 0; + // + // DescriptionDisplay + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(413, 162); + this.Controls.Add(this.textBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.Name = "DescriptionDisplay"; + this.Text = "DescriptionDisplay"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.TextBox textBox1; + } +} \ No newline at end of file diff --git a/Source/LibationWinForms/grid/DescriptionDisplay.cs b/Source/LibationWinForms/grid/DescriptionDisplay.cs new file mode 100644 index 00000000..0bca3fc7 --- /dev/null +++ b/Source/LibationWinForms/grid/DescriptionDisplay.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace LibationWinForms +{ + public partial class DescriptionDisplay : Form + { + public DescriptionDisplay() + { + InitializeComponent(); + textBox1.LostFocus += (_, _) => Close(); + this.Shown += DescriptionDisplay_Shown; + + var textHeight = TextRenderer.MeasureText("\n", textBox1.Font).Height; + } + + [DllImport("user32.dll")] + static extern bool HideCaret(IntPtr hWnd); + + private void DescriptionDisplay_Shown(object sender, EventArgs e) + { + textBox1.DeselectAll(); + HideCaret(textBox1.Handle); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + int lineCount = textBox1.GetLineFromCharIndex(int.MaxValue) + 2; + Height = Height - textBox1.Height + lineCount * TextRenderer.MeasureText(textBox1.Text, textBox1.Font).Height; + + } + } +} diff --git a/Source/LibationWinForms/grid/DescriptionDisplay.resx b/Source/LibationWinForms/grid/DescriptionDisplay.resx new file mode 100644 index 00000000..f298a7be --- /dev/null +++ b/Source/LibationWinForms/grid/DescriptionDisplay.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Source/LibationWinForms/grid/GridEntry.cs b/Source/LibationWinForms/grid/GridEntry.cs index b1c7f088..bd6d341d 100644 --- a/Source/LibationWinForms/grid/GridEntry.cs +++ b/Source/LibationWinForms/grid/GridEntry.cs @@ -26,6 +26,8 @@ namespace LibationWinForms public string AudibleProductId => Book.AudibleProductId; [Browsable(false)] public LibraryBook LibraryBook { get; private set; } + [Browsable(false)] + public string LongDescription { get; private set; } #endregion #region Model properties exposed to the view @@ -131,7 +133,8 @@ namespace LibationWinForms Narrators = Book.NarratorNames; Category = string.Join(" > ", Book.CategoriesNames); Misc = GetMiscDisplay(libraryBook); - Description = GetDescriptionDisplay(Book); + LongDescription = GetDescriptionDisplay(Book); + Description = TrimTextToWord(LongDescription, 62); } UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged; @@ -266,6 +269,14 @@ namespace LibationWinForms return doc.DocumentNode.InnerText; } + private static string TrimTextToWord(string text, int maxLength) + { + return + text.Length <= maxLength ? + text : + text.Substring(0, maxLength - 3) + "..."; + } + /// /// This information should not change during lifetime, so call only once. /// Maximum of 5 text rows will fit in 80-pixel row height. diff --git a/Source/LibationWinForms/grid/ProductsGrid.Designer.cs b/Source/LibationWinForms/grid/ProductsGrid.Designer.cs index 202fc078..89f53316 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.Designer.cs +++ b/Source/LibationWinForms/grid/ProductsGrid.Designer.cs @@ -32,21 +32,21 @@ 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.dataGridViewImageButtonBoxColumn1 = new LibationWinForms.LiberateDataGridViewImageButtonColumn(); - this.dataGridViewImageColumn1 = new System.Windows.Forms.DataGridViewImageColumn(); - this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewImageButtonBoxColumn2 = new LibationWinForms.EditTagsDataGridViewImageButtonColumn(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.liberateGVColumn = new LibationWinForms.LiberateDataGridViewImageButtonColumn(); + this.coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn(); + this.titleGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.authorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.narratorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lengthGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.seriesGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.descriptionGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.categoryGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.productRatingGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.purchaseDateGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.myRatingGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.tagAndDetailsGVColumn = new LibationWinForms.EditTagsDataGridViewImageButtonColumn(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit(); this.SuspendLayout(); @@ -64,20 +64,20 @@ this.gridEntryDataGridView.AutoGenerateColumns = false; this.gridEntryDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.gridEntryDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.dataGridViewImageButtonBoxColumn1, - this.dataGridViewImageColumn1, - this.dataGridViewTextBoxColumn1, - this.dataGridViewTextBoxColumn2, - this.dataGridViewTextBoxColumn3, - this.dataGridViewTextBoxColumn4, - this.dataGridViewTextBoxColumn5, - this.dataGridViewTextBoxColumn6, - this.dataGridViewTextBoxColumn7, - this.dataGridViewTextBoxColumn8, - this.dataGridViewTextBoxColumn9, - this.dataGridViewTextBoxColumn10, - this.dataGridViewTextBoxColumn11, - this.dataGridViewImageButtonBoxColumn2}); + this.liberateGVColumn, + this.coverGVColumn, + this.titleGVColumn, + this.authorsGVColumn, + this.narratorsGVColumn, + this.lengthGVColumn, + this.seriesGVColumn, + this.descriptionGVColumn, + this.categoryGVColumn, + this.productRatingGVColumn, + this.purchaseDateGVColumn, + this.myRatingGVColumn, + this.miscGVColumn, + this.tagAndDetailsGVColumn}); this.gridEntryDataGridView.ContextMenuStrip = this.contextMenuStrip1; this.gridEntryDataGridView.DataSource = this.gridEntryBindingSource; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; @@ -100,122 +100,123 @@ this.gridEntryDataGridView.ColumnDisplayIndexChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridEntryDataGridView_ColumnDisplayIndexChanged); this.gridEntryDataGridView.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.gridEntryDataGridView_ColumnWidthChanged); // - // dataGridViewImageButtonBoxColumn1 - // - this.dataGridViewImageButtonBoxColumn1.DataPropertyName = "Liberate"; - this.dataGridViewImageButtonBoxColumn1.HeaderText = "Liberate"; - this.dataGridViewImageButtonBoxColumn1.Name = "dataGridViewImageButtonBoxColumn1"; - this.dataGridViewImageButtonBoxColumn1.ReadOnly = true; - this.dataGridViewImageButtonBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewImageButtonBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.dataGridViewImageButtonBoxColumn1.Width = 75; - // - // dataGridViewImageColumn1 - // - this.dataGridViewImageColumn1.DataPropertyName = "Cover"; - this.dataGridViewImageColumn1.HeaderText = "Cover"; - this.dataGridViewImageColumn1.Name = "dataGridViewImageColumn1"; - this.dataGridViewImageColumn1.ReadOnly = true; - this.dataGridViewImageColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewImageColumn1.ToolTipText = "Cover Art"; - this.dataGridViewImageColumn1.Width = 80; - // - // dataGridViewTextBoxColumn1 - // - this.dataGridViewTextBoxColumn1.DataPropertyName = "Title"; - this.dataGridViewTextBoxColumn1.HeaderText = "Title"; - this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; - this.dataGridViewTextBoxColumn1.ReadOnly = true; - this.dataGridViewTextBoxColumn1.Width = 200; - // - // dataGridViewTextBoxColumn2 - // - this.dataGridViewTextBoxColumn2.DataPropertyName = "Authors"; - this.dataGridViewTextBoxColumn2.HeaderText = "Authors"; - this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; - this.dataGridViewTextBoxColumn2.ReadOnly = true; - // - // dataGridViewTextBoxColumn3 - // - this.dataGridViewTextBoxColumn3.DataPropertyName = "Narrators"; - this.dataGridViewTextBoxColumn3.HeaderText = "Narrators"; - this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; - this.dataGridViewTextBoxColumn3.ReadOnly = true; - // - // dataGridViewTextBoxColumn4 - // - this.dataGridViewTextBoxColumn4.DataPropertyName = "Length"; - this.dataGridViewTextBoxColumn4.HeaderText = "Length"; - this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; - this.dataGridViewTextBoxColumn4.ReadOnly = true; - this.dataGridViewTextBoxColumn4.ToolTipText = "Recording Length"; - // - // dataGridViewTextBoxColumn5 - // - this.dataGridViewTextBoxColumn5.DataPropertyName = "Series"; - this.dataGridViewTextBoxColumn5.HeaderText = "Series"; - this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; - this.dataGridViewTextBoxColumn5.ReadOnly = true; - // - // dataGridViewTextBoxColumn6 - // - this.dataGridViewTextBoxColumn6.DataPropertyName = "Description"; - this.dataGridViewTextBoxColumn6.HeaderText = "Description"; - this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6"; - this.dataGridViewTextBoxColumn6.ReadOnly = true; - // - // dataGridViewTextBoxColumn7 - // - this.dataGridViewTextBoxColumn7.DataPropertyName = "Category"; - this.dataGridViewTextBoxColumn7.HeaderText = "Category"; - this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7"; - this.dataGridViewTextBoxColumn7.ReadOnly = true; - // - // dataGridViewTextBoxColumn8 - // - this.dataGridViewTextBoxColumn8.DataPropertyName = "ProductRating"; - this.dataGridViewTextBoxColumn8.HeaderText = "Product Rating"; - this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8"; - this.dataGridViewTextBoxColumn8.ReadOnly = true; - this.dataGridViewTextBoxColumn8.Width = 108; - // - // dataGridViewTextBoxColumn9 - // - this.dataGridViewTextBoxColumn9.DataPropertyName = "PurchaseDate"; - this.dataGridViewTextBoxColumn9.HeaderText = "Purchase Date"; - this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9"; - this.dataGridViewTextBoxColumn9.ReadOnly = true; - // - // dataGridViewTextBoxColumn10 - // - this.dataGridViewTextBoxColumn10.DataPropertyName = "MyRating"; - this.dataGridViewTextBoxColumn10.HeaderText = "My Rating"; - this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10"; - this.dataGridViewTextBoxColumn10.ReadOnly = true; - this.dataGridViewTextBoxColumn10.Width = 108; - // - // dataGridViewTextBoxColumn11 - // - this.dataGridViewTextBoxColumn11.DataPropertyName = "Misc"; - this.dataGridViewTextBoxColumn11.HeaderText = "Misc"; - this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11"; - this.dataGridViewTextBoxColumn11.ReadOnly = true; - this.dataGridViewTextBoxColumn11.Width = 135; - // - // dataGridViewImageButtonBoxColumn2 - // - this.dataGridViewImageButtonBoxColumn2.DataPropertyName = "DisplayTags"; - this.dataGridViewImageButtonBoxColumn2.HeaderText = "Tags and Details"; - this.dataGridViewImageButtonBoxColumn2.Name = "dataGridViewImageButtonBoxColumn2"; - this.dataGridViewImageButtonBoxColumn2.ReadOnly = true; - this.dataGridViewImageButtonBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewImageButtonBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // // contextMenuStrip1 // this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); // + // liberateGVColumn + // + this.liberateGVColumn.DataPropertyName = "Liberate"; + this.liberateGVColumn.HeaderText = "Liberate"; + this.liberateGVColumn.Name = "liberateGVColumn"; + this.liberateGVColumn.ReadOnly = true; + this.liberateGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.liberateGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.liberateGVColumn.Width = 75; + // + // coverGVColumn + // + this.coverGVColumn.DataPropertyName = "Cover"; + this.coverGVColumn.HeaderText = "Cover"; + this.coverGVColumn.Name = "coverGVColumn"; + this.coverGVColumn.ReadOnly = true; + this.coverGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.coverGVColumn.ToolTipText = "Cover Art"; + this.coverGVColumn.Width = 80; + // + // titleGVColumn + // + this.titleGVColumn.DataPropertyName = "Title"; + this.titleGVColumn.HeaderText = "Title"; + this.titleGVColumn.Name = "titleGVColumn"; + this.titleGVColumn.ReadOnly = true; + this.titleGVColumn.Width = 200; + // + // authorsGVColumn + // + this.authorsGVColumn.DataPropertyName = "Authors"; + this.authorsGVColumn.HeaderText = "Authors"; + this.authorsGVColumn.Name = "authorsGVColumn"; + this.authorsGVColumn.ReadOnly = true; + // + // narratorsGVColumn + // + this.narratorsGVColumn.DataPropertyName = "Narrators"; + this.narratorsGVColumn.HeaderText = "Narrators"; + this.narratorsGVColumn.Name = "narratorsGVColumn"; + this.narratorsGVColumn.ReadOnly = true; + // + // lengthGVColumn + // + this.lengthGVColumn.DataPropertyName = "Length"; + this.lengthGVColumn.HeaderText = "Length"; + this.lengthGVColumn.Name = "lengthGVColumn"; + this.lengthGVColumn.ReadOnly = true; + this.lengthGVColumn.ToolTipText = "Recording Length"; + // + // seriesGVColumn + // + this.seriesGVColumn.DataPropertyName = "Series"; + this.seriesGVColumn.HeaderText = "Series"; + this.seriesGVColumn.Name = "seriesGVColumn"; + this.seriesGVColumn.ReadOnly = true; + // + // descriptionGVColumn + // + this.descriptionGVColumn.DataPropertyName = "Description"; + this.descriptionGVColumn.HeaderText = "Description"; + this.descriptionGVColumn.Name = "descriptionGVColumn"; + this.descriptionGVColumn.ReadOnly = true; + this.descriptionGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; + // + // categoryGVColumn + // + this.categoryGVColumn.DataPropertyName = "Category"; + this.categoryGVColumn.HeaderText = "Category"; + this.categoryGVColumn.Name = "categoryGVColumn"; + this.categoryGVColumn.ReadOnly = true; + // + // productRatingGVColumn + // + this.productRatingGVColumn.DataPropertyName = "ProductRating"; + this.productRatingGVColumn.HeaderText = "Product Rating"; + this.productRatingGVColumn.Name = "productRatingGVColumn"; + this.productRatingGVColumn.ReadOnly = true; + this.productRatingGVColumn.Width = 108; + // + // purchaseDateGVColumn + // + this.purchaseDateGVColumn.DataPropertyName = "PurchaseDate"; + this.purchaseDateGVColumn.HeaderText = "Purchase Date"; + this.purchaseDateGVColumn.Name = "purchaseDateGVColumn"; + this.purchaseDateGVColumn.ReadOnly = true; + // + // myRatingGVColumn + // + this.myRatingGVColumn.DataPropertyName = "MyRating"; + this.myRatingGVColumn.HeaderText = "My Rating"; + this.myRatingGVColumn.Name = "myRatingGVColumn"; + this.myRatingGVColumn.ReadOnly = true; + this.myRatingGVColumn.Width = 108; + // + // miscGVColumn + // + this.miscGVColumn.DataPropertyName = "Misc"; + this.miscGVColumn.HeaderText = "Misc"; + this.miscGVColumn.Name = "miscGVColumn"; + this.miscGVColumn.ReadOnly = true; + this.miscGVColumn.Width = 135; + // + // tagAndDetailsGVColumn + // + this.tagAndDetailsGVColumn.DataPropertyName = "DisplayTags"; + this.tagAndDetailsGVColumn.HeaderText = "Tags and Details"; + this.tagAndDetailsGVColumn.Name = "tagAndDetailsGVColumn"; + this.tagAndDetailsGVColumn.ReadOnly = true; + this.tagAndDetailsGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.tagAndDetailsGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // // ProductsGrid // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -234,20 +235,20 @@ private LibationWinForms.SyncBindingSource gridEntryBindingSource; private System.Windows.Forms.DataGridView gridEntryDataGridView; - private LiberateDataGridViewImageButtonColumn dataGridViewImageButtonBoxColumn1; - private System.Windows.Forms.DataGridViewImageColumn dataGridViewImageColumn1; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn6; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn7; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn8; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn9; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn10; - private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn11; - private EditTagsDataGridViewImageButtonColumn dataGridViewImageButtonBoxColumn2; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private LiberateDataGridViewImageButtonColumn liberateGVColumn; + private System.Windows.Forms.DataGridViewImageColumn coverGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn titleGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn authorsGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn narratorsGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn lengthGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn seriesGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn descriptionGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn categoryGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn productRatingGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn purchaseDateGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn myRatingGVColumn; + private System.Windows.Forms.DataGridViewTextBoxColumn miscGVColumn; + private EditTagsDataGridViewImageButtonColumn tagAndDetailsGVColumn; } } diff --git a/Source/LibationWinForms/grid/ProductsGrid.cs b/Source/LibationWinForms/grid/ProductsGrid.cs index f28d0449..dfac3312 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.cs +++ b/Source/LibationWinForms/grid/ProductsGrid.cs @@ -59,20 +59,27 @@ namespace LibationWinForms private async void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { // handle grid button click: https://stackoverflow.com/a/13687844 - if (e.RowIndex < 0 || _dataGridView.Columns[e.ColumnIndex] is not DataGridViewButtonColumn) + if (e.RowIndex < 0) return; - var liveGridEntry = getGridEntry(e.RowIndex); + var propertyName = _dataGridView.Columns[e.ColumnIndex].DataPropertyName; - switch (_dataGridView.Columns[e.ColumnIndex].DataPropertyName) - { - case nameof(liveGridEntry.Liberate): - await Liberate_Click(liveGridEntry); - break; - case nameof(liveGridEntry.DisplayTags): - Details_Click(liveGridEntry); - break; - } + if (propertyName == liberateGVColumn.DataPropertyName) + await Liberate_Click(getGridEntry(e.RowIndex)); + else if (propertyName == tagAndDetailsGVColumn.DataPropertyName) + Details_Click(getGridEntry(e.RowIndex)); + else if (propertyName == descriptionGVColumn.DataPropertyName) + DescriptionClick(getGridEntry(e.RowIndex)); + } + + private void DescriptionClick(GridEntry liveGridEntry) + { + var displayWindow = new DescriptionDisplay(); + displayWindow.Text = $"{liveGridEntry.Title} description"; + displayWindow.Load += (_, _) => displayWindow.RestoreSizeAndLocation(Configuration.Instance); + displayWindow.FormClosing += (_, _) => displayWindow.SaveSizeAndLocation(Configuration.Instance); + displayWindow.textBox1.Text = liveGridEntry.LongDescription; + displayWindow.Show(this); } private static async Task Liberate_Click(GridEntry liveGridEntry) @@ -82,7 +89,7 @@ namespace LibationWinForms // liberated: open explorer to file if (libraryBook.Book.Audio_Exists) { - var filePath = LibationFileManager.AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId); + var filePath = AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId); if (!Go.To.File(filePath)) { var suffix = string.IsNullOrWhiteSpace(filePath) ? "" : $":\r\n{filePath}"; diff --git a/Source/LibationWinForms/grid/ProductsGrid.resx b/Source/LibationWinForms/grid/ProductsGrid.resx index cc951239..8a560af5 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.resx +++ b/Source/LibationWinForms/grid/ProductsGrid.resx @@ -63,4 +63,7 @@ 197, 17 + + 81 + \ No newline at end of file