Show full book description when Description cell is clicked.

This commit is contained in:
Michael Bucari-Tovo 2022-05-09 16:44:44 -06:00
parent 1c9ea0a710
commit 201ecebda9
7 changed files with 353 additions and 166 deletions

View File

@ -0,0 +1,63 @@
namespace LibationWinForms
{
partial class DescriptionDisplay
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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;
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -26,6 +26,8 @@ namespace LibationWinForms
public string AudibleProductId => Book.AudibleProductId; public string AudibleProductId => Book.AudibleProductId;
[Browsable(false)] [Browsable(false)]
public LibraryBook LibraryBook { get; private set; } public LibraryBook LibraryBook { get; private set; }
[Browsable(false)]
public string LongDescription { get; private set; }
#endregion #endregion
#region Model properties exposed to the view #region Model properties exposed to the view
@ -131,7 +133,8 @@ namespace LibationWinForms
Narrators = Book.NarratorNames; Narrators = Book.NarratorNames;
Category = string.Join(" > ", Book.CategoriesNames); Category = string.Join(" > ", Book.CategoriesNames);
Misc = GetMiscDisplay(libraryBook); Misc = GetMiscDisplay(libraryBook);
Description = GetDescriptionDisplay(Book); LongDescription = GetDescriptionDisplay(Book);
Description = TrimTextToWord(LongDescription, 62);
} }
UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged; UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged;
@ -266,6 +269,14 @@ namespace LibationWinForms
return doc.DocumentNode.InnerText; return doc.DocumentNode.InnerText;
} }
private static string TrimTextToWord(string text, int maxLength)
{
return
text.Length <= maxLength ?
text :
text.Substring(0, maxLength - 3) + "...";
}
/// <summary> /// <summary>
/// This information should not change during <see cref="GridEntry"/> lifetime, so call only once. /// This information should not change during <see cref="GridEntry"/> lifetime, so call only once.
/// Maximum of 5 text rows will fit in 80-pixel row height. /// Maximum of 5 text rows will fit in 80-pixel row height.

View File

@ -32,21 +32,21 @@
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.gridEntryBindingSource = new LibationWinForms.SyncBindingSource(this.components);
this.gridEntryDataGridView = new System.Windows.Forms.DataGridView(); 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.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.gridEntryBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
@ -64,20 +64,20 @@
this.gridEntryDataGridView.AutoGenerateColumns = 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.dataGridViewImageButtonBoxColumn1, this.liberateGVColumn,
this.dataGridViewImageColumn1, this.coverGVColumn,
this.dataGridViewTextBoxColumn1, this.titleGVColumn,
this.dataGridViewTextBoxColumn2, this.authorsGVColumn,
this.dataGridViewTextBoxColumn3, this.narratorsGVColumn,
this.dataGridViewTextBoxColumn4, this.lengthGVColumn,
this.dataGridViewTextBoxColumn5, this.seriesGVColumn,
this.dataGridViewTextBoxColumn6, this.descriptionGVColumn,
this.dataGridViewTextBoxColumn7, this.categoryGVColumn,
this.dataGridViewTextBoxColumn8, this.productRatingGVColumn,
this.dataGridViewTextBoxColumn9, this.purchaseDateGVColumn,
this.dataGridViewTextBoxColumn10, this.myRatingGVColumn,
this.dataGridViewTextBoxColumn11, this.miscGVColumn,
this.dataGridViewImageButtonBoxColumn2}); this.tagAndDetailsGVColumn});
this.gridEntryDataGridView.ContextMenuStrip = this.contextMenuStrip1; this.gridEntryDataGridView.ContextMenuStrip = this.contextMenuStrip1;
this.gridEntryDataGridView.DataSource = this.gridEntryBindingSource; this.gridEntryDataGridView.DataSource = this.gridEntryBindingSource;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
@ -100,122 +100,123 @@
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); 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 // contextMenuStrip1
// //
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); 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 // ProductsGrid
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -234,20 +235,20 @@
private LibationWinForms.SyncBindingSource gridEntryBindingSource; private LibationWinForms.SyncBindingSource gridEntryBindingSource;
private System.Windows.Forms.DataGridView gridEntryDataGridView; 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 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;
} }
} }

View File

@ -59,20 +59,27 @@ namespace LibationWinForms
private async void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) private async 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 || _dataGridView.Columns[e.ColumnIndex] is not DataGridViewButtonColumn) if (e.RowIndex < 0)
return; return;
var liveGridEntry = getGridEntry(e.RowIndex); var propertyName = _dataGridView.Columns[e.ColumnIndex].DataPropertyName;
switch (_dataGridView.Columns[e.ColumnIndex].DataPropertyName) if (propertyName == liberateGVColumn.DataPropertyName)
{ await Liberate_Click(getGridEntry(e.RowIndex));
case nameof(liveGridEntry.Liberate): else if (propertyName == tagAndDetailsGVColumn.DataPropertyName)
await Liberate_Click(liveGridEntry); Details_Click(getGridEntry(e.RowIndex));
break; else if (propertyName == descriptionGVColumn.DataPropertyName)
case nameof(liveGridEntry.DisplayTags): DescriptionClick(getGridEntry(e.RowIndex));
Details_Click(liveGridEntry); }
break;
} 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) private static async Task Liberate_Click(GridEntry liveGridEntry)
@ -82,7 +89,7 @@ namespace LibationWinForms
// liberated: open explorer to file // liberated: open explorer to file
if (libraryBook.Book.Audio_Exists) 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)) if (!Go.To.File(filePath))
{ {
var suffix = string.IsNullOrWhiteSpace(filePath) ? "" : $":\r\n{filePath}"; var suffix = string.IsNullOrWhiteSpace(filePath) ? "" : $":\r\n{filePath}";

View File

@ -63,4 +63,7 @@
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>197, 17</value> <value>197, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>81</value>
</metadata>
</root> </root>