New feature #406 : Right Click Menu for Stop-Light Icon (Classic UI)

This commit is contained in:
Robert McRackan 2022-12-13 13:48:28 -05:00
parent 749173a463
commit d1528a095b
5 changed files with 267 additions and 227 deletions

View File

@ -338,7 +338,8 @@ namespace ApplicationServices
#region remove books #region remove books
public static Task<List<LibraryBook>> RemoveBooksAsync(List<string> idsToRemove) => Task.Run(() => removeBooks(idsToRemove)); public static Task<List<LibraryBook>> RemoveBooksAsync(List<string> idsToRemove) => Task.Run(() => removeBooks(idsToRemove));
private static List<LibraryBook> removeBooks(List<string> idsToRemove) public static List<LibraryBook> RemoveBook(string idToRemove) => removeBooks(new() { idToRemove });
private static List<LibraryBook> removeBooks(List<string> idsToRemove)
{ {
using var context = DbContexts.GetContext(); using var context = DbContexts.GetContext();
var libBooks = context.GetLibrary_Flat_NoTracking(); var libBooks = context.GetLibrary_Flat_NoTracking();

View File

@ -26,7 +26,7 @@ namespace LibationWinForms.GridView
[Browsable(false)] public float SeriesIndex { get; protected set; } [Browsable(false)] public float SeriesIndex { get; protected set; }
[Browsable(false)] public string LongDescription { get; protected set; } [Browsable(false)] public string LongDescription { get; protected set; }
[Browsable(false)] public abstract DateTime DateAdded { get; } [Browsable(false)] public abstract DateTime DateAdded { get; }
[Browsable(false)] protected Book Book => LibraryBook.Book; [Browsable(false)] public Book Book => LibraryBook.Book;
[Browsable(false)] public abstract bool IsSeries { get; } [Browsable(false)] public abstract bool IsSeries { get; }
[Browsable(false)] public abstract bool IsEpisode { get; } [Browsable(false)] public abstract bool IsEpisode { get; }

View File

@ -28,39 +28,39 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
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.gridEntryDataGridView = new System.Windows.Forms.DataGridView(); this.gridEntryDataGridView = new System.Windows.Forms.DataGridView();
this.removeGVColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.removeGVColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.liberateGVColumn = new LibationWinForms.GridView.LiberateDataGridViewImageButtonColumn(); this.liberateGVColumn = new LibationWinForms.GridView.LiberateDataGridViewImageButtonColumn();
this.coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn(); this.coverGVColumn = new System.Windows.Forms.DataGridViewImageColumn();
this.titleGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.titleGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.authorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.authorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.narratorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.narratorsGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lengthGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.lengthGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.seriesGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.seriesGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.descriptionGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.descriptionGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.categoryGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.categoryGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.productRatingGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.productRatingGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.purchaseDateGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.purchaseDateGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.myRatingGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.myRatingGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.miscGVColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tagAndDetailsGVColumn = new LibationWinForms.GridView.EditTagsDataGridViewImageButtonColumn(); this.tagAndDetailsGVColumn = new LibationWinForms.GridView.EditTagsDataGridViewImageButtonColumn();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.showHideColumnsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.syncBindingSource = new LibationWinForms.GridView.SyncBindingSource(this.components); this.syncBindingSource = new LibationWinForms.GridView.SyncBindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.syncBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.syncBindingSource)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// 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.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.removeGVColumn, this.removeGVColumn,
this.liberateGVColumn, this.liberateGVColumn,
this.coverGVColumn, this.coverGVColumn,
@ -76,182 +76,182 @@
this.myRatingGVColumn, this.myRatingGVColumn,
this.miscGVColumn, this.miscGVColumn,
this.tagAndDetailsGVColumn}); this.tagAndDetailsGVColumn});
this.gridEntryDataGridView.ContextMenuStrip = this.contextMenuStrip1; this.gridEntryDataGridView.ContextMenuStrip = this.showHideColumnsContextMenuStrip;
this.gridEntryDataGridView.DataSource = this.syncBindingSource; this.gridEntryDataGridView.DataSource = this.syncBindingSource;
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);
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
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.Name = "gridEntryDataGridView"; this.gridEntryDataGridView.Name = "gridEntryDataGridView";
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(1570, 380); this.gridEntryDataGridView.Size = new System.Drawing.Size(1570, 380);
this.gridEntryDataGridView.TabIndex = 0; this.gridEntryDataGridView.TabIndex = 0;
this.gridEntryDataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView_CellContentClick); this.gridEntryDataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DataGridView_CellContentClick);
this.gridEntryDataGridView.CellContextMenuStripNeeded += new System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventHandler(this.gridEntryDataGridView_CellContextMenuStripNeeded); this.gridEntryDataGridView.CellContextMenuStripNeeded += new System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventHandler(this.gridEntryDataGridView_CellContextMenuStripNeeded);
this.gridEntryDataGridView.CellToolTipTextNeeded += new System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler(this.gridEntryDataGridView_CellToolTipTextNeeded); this.gridEntryDataGridView.CellToolTipTextNeeded += new System.Windows.Forms.DataGridViewCellToolTipTextNeededEventHandler(this.gridEntryDataGridView_CellToolTipTextNeeded);
// //
// removeGVColumn // removeGVColumn
// //
this.removeGVColumn.DataPropertyName = "Remove"; this.removeGVColumn.DataPropertyName = "Remove";
this.removeGVColumn.FalseValue = ""; this.removeGVColumn.FalseValue = "";
this.removeGVColumn.Frozen = true; this.removeGVColumn.Frozen = true;
this.removeGVColumn.HeaderText = "Remove"; this.removeGVColumn.HeaderText = "Remove";
this.removeGVColumn.IndeterminateValue = ""; this.removeGVColumn.IndeterminateValue = "";
this.removeGVColumn.MinimumWidth = 60; this.removeGVColumn.MinimumWidth = 60;
this.removeGVColumn.Name = "removeGVColumn"; this.removeGVColumn.Name = "removeGVColumn";
this.removeGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.removeGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.removeGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.removeGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.removeGVColumn.ThreeState = true; this.removeGVColumn.ThreeState = true;
this.removeGVColumn.TrueValue = ""; this.removeGVColumn.TrueValue = "";
this.removeGVColumn.Width = 60; this.removeGVColumn.Width = 60;
// //
// liberateGVColumn // liberateGVColumn
// //
this.liberateGVColumn.DataPropertyName = "Liberate"; this.liberateGVColumn.DataPropertyName = "Liberate";
this.liberateGVColumn.HeaderText = "Liberate"; this.liberateGVColumn.HeaderText = "Liberate";
this.liberateGVColumn.Name = "liberateGVColumn"; this.liberateGVColumn.Name = "liberateGVColumn";
this.liberateGVColumn.ReadOnly = true; this.liberateGVColumn.ReadOnly = true;
this.liberateGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.liberateGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.liberateGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.liberateGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.liberateGVColumn.Width = 75; this.liberateGVColumn.Width = 75;
// //
// coverGVColumn // coverGVColumn
// //
this.coverGVColumn.DataPropertyName = "Cover"; this.coverGVColumn.DataPropertyName = "Cover";
this.coverGVColumn.HeaderText = "Cover"; this.coverGVColumn.HeaderText = "Cover";
this.coverGVColumn.Name = "coverGVColumn"; this.coverGVColumn.Name = "coverGVColumn";
this.coverGVColumn.ReadOnly = true; this.coverGVColumn.ReadOnly = true;
this.coverGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.coverGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.coverGVColumn.ToolTipText = "Cover Art"; this.coverGVColumn.ToolTipText = "Cover Art";
this.coverGVColumn.Width = 80; this.coverGVColumn.Width = 80;
// //
// titleGVColumn // titleGVColumn
// //
this.titleGVColumn.DataPropertyName = "Title"; this.titleGVColumn.DataPropertyName = "Title";
this.titleGVColumn.HeaderText = "Title"; this.titleGVColumn.HeaderText = "Title";
this.titleGVColumn.Name = "titleGVColumn"; this.titleGVColumn.Name = "titleGVColumn";
this.titleGVColumn.ReadOnly = true; this.titleGVColumn.ReadOnly = true;
this.titleGVColumn.Width = 200; this.titleGVColumn.Width = 200;
// //
// authorsGVColumn // authorsGVColumn
// //
this.authorsGVColumn.DataPropertyName = "Authors"; this.authorsGVColumn.DataPropertyName = "Authors";
this.authorsGVColumn.HeaderText = "Authors"; this.authorsGVColumn.HeaderText = "Authors";
this.authorsGVColumn.Name = "authorsGVColumn"; this.authorsGVColumn.Name = "authorsGVColumn";
this.authorsGVColumn.ReadOnly = true; this.authorsGVColumn.ReadOnly = true;
// //
// narratorsGVColumn // narratorsGVColumn
// //
this.narratorsGVColumn.DataPropertyName = "Narrators"; this.narratorsGVColumn.DataPropertyName = "Narrators";
this.narratorsGVColumn.HeaderText = "Narrators"; this.narratorsGVColumn.HeaderText = "Narrators";
this.narratorsGVColumn.Name = "narratorsGVColumn"; this.narratorsGVColumn.Name = "narratorsGVColumn";
this.narratorsGVColumn.ReadOnly = true; this.narratorsGVColumn.ReadOnly = true;
// //
// lengthGVColumn // lengthGVColumn
// //
this.lengthGVColumn.DataPropertyName = "Length"; this.lengthGVColumn.DataPropertyName = "Length";
this.lengthGVColumn.HeaderText = "Length"; this.lengthGVColumn.HeaderText = "Length";
this.lengthGVColumn.Name = "lengthGVColumn"; this.lengthGVColumn.Name = "lengthGVColumn";
this.lengthGVColumn.ReadOnly = true; this.lengthGVColumn.ReadOnly = true;
this.lengthGVColumn.ToolTipText = "Recording Length"; this.lengthGVColumn.ToolTipText = "Recording Length";
// //
// seriesGVColumn // seriesGVColumn
// //
this.seriesGVColumn.DataPropertyName = "Series"; this.seriesGVColumn.DataPropertyName = "Series";
this.seriesGVColumn.HeaderText = "Series"; this.seriesGVColumn.HeaderText = "Series";
this.seriesGVColumn.Name = "seriesGVColumn"; this.seriesGVColumn.Name = "seriesGVColumn";
this.seriesGVColumn.ReadOnly = true; this.seriesGVColumn.ReadOnly = true;
// //
// descriptionGVColumn // descriptionGVColumn
// //
this.descriptionGVColumn.DataPropertyName = "Description"; this.descriptionGVColumn.DataPropertyName = "Description";
this.descriptionGVColumn.HeaderText = "Description"; this.descriptionGVColumn.HeaderText = "Description";
this.descriptionGVColumn.Name = "descriptionGVColumn"; this.descriptionGVColumn.Name = "descriptionGVColumn";
this.descriptionGVColumn.ReadOnly = true; this.descriptionGVColumn.ReadOnly = true;
this.descriptionGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.descriptionGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
// //
// categoryGVColumn // categoryGVColumn
// //
this.categoryGVColumn.DataPropertyName = "Category"; this.categoryGVColumn.DataPropertyName = "Category";
this.categoryGVColumn.HeaderText = "Category"; this.categoryGVColumn.HeaderText = "Category";
this.categoryGVColumn.Name = "categoryGVColumn"; this.categoryGVColumn.Name = "categoryGVColumn";
this.categoryGVColumn.ReadOnly = true; this.categoryGVColumn.ReadOnly = true;
// //
// productRatingGVColumn // productRatingGVColumn
// //
this.productRatingGVColumn.DataPropertyName = "ProductRating"; this.productRatingGVColumn.DataPropertyName = "ProductRating";
this.productRatingGVColumn.HeaderText = "Product Rating"; this.productRatingGVColumn.HeaderText = "Product Rating";
this.productRatingGVColumn.Name = "productRatingGVColumn"; this.productRatingGVColumn.Name = "productRatingGVColumn";
this.productRatingGVColumn.ReadOnly = true; this.productRatingGVColumn.ReadOnly = true;
this.productRatingGVColumn.Width = 108; this.productRatingGVColumn.Width = 108;
// //
// purchaseDateGVColumn // purchaseDateGVColumn
// //
this.purchaseDateGVColumn.DataPropertyName = "PurchaseDate"; this.purchaseDateGVColumn.DataPropertyName = "PurchaseDate";
this.purchaseDateGVColumn.HeaderText = "Purchase Date"; this.purchaseDateGVColumn.HeaderText = "Purchase Date";
this.purchaseDateGVColumn.Name = "purchaseDateGVColumn"; this.purchaseDateGVColumn.Name = "purchaseDateGVColumn";
this.purchaseDateGVColumn.ReadOnly = true; this.purchaseDateGVColumn.ReadOnly = true;
// //
// myRatingGVColumn // myRatingGVColumn
// //
this.myRatingGVColumn.DataPropertyName = "MyRating"; this.myRatingGVColumn.DataPropertyName = "MyRating";
this.myRatingGVColumn.HeaderText = "My Rating"; this.myRatingGVColumn.HeaderText = "My Rating";
this.myRatingGVColumn.Name = "myRatingGVColumn"; this.myRatingGVColumn.Name = "myRatingGVColumn";
this.myRatingGVColumn.ReadOnly = true; this.myRatingGVColumn.ReadOnly = true;
this.myRatingGVColumn.Width = 108; this.myRatingGVColumn.Width = 108;
// //
// miscGVColumn // miscGVColumn
// //
this.miscGVColumn.DataPropertyName = "Misc"; this.miscGVColumn.DataPropertyName = "Misc";
this.miscGVColumn.HeaderText = "Misc"; this.miscGVColumn.HeaderText = "Misc";
this.miscGVColumn.Name = "miscGVColumn"; this.miscGVColumn.Name = "miscGVColumn";
this.miscGVColumn.ReadOnly = true; this.miscGVColumn.ReadOnly = true;
this.miscGVColumn.Width = 135; this.miscGVColumn.Width = 135;
// //
// tagAndDetailsGVColumn // tagAndDetailsGVColumn
// //
this.tagAndDetailsGVColumn.DataPropertyName = "DisplayTags"; this.tagAndDetailsGVColumn.DataPropertyName = "DisplayTags";
this.tagAndDetailsGVColumn.HeaderText = "Tags and Details"; this.tagAndDetailsGVColumn.HeaderText = "Tags and Details";
this.tagAndDetailsGVColumn.Name = "tagAndDetailsGVColumn"; this.tagAndDetailsGVColumn.Name = "tagAndDetailsGVColumn";
this.tagAndDetailsGVColumn.ReadOnly = true; this.tagAndDetailsGVColumn.ReadOnly = true;
this.tagAndDetailsGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.tagAndDetailsGVColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.tagAndDetailsGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.tagAndDetailsGVColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
// //
// contextMenuStrip1 // showHideColumnsContextMenuStrip
// //
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.showHideColumnsContextMenuStrip.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); this.showHideColumnsContextMenuStrip.Size = new System.Drawing.Size(181, 26);
// //
// syncBindingSource // syncBindingSource
// //
this.syncBindingSource.DataSource = typeof(LibationWinForms.GridView.GridEntry); this.syncBindingSource.DataSource = typeof(LibationWinForms.GridView.GridEntry);
// //
// ProductsGrid // ProductsGrid
// //
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.AutoScroll = true;
this.Controls.Add(this.gridEntryDataGridView); this.Controls.Add(this.gridEntryDataGridView);
this.Name = "ProductsGrid"; this.Name = "ProductsGrid";
this.Size = new System.Drawing.Size(1570, 380); this.Size = new System.Drawing.Size(1570, 380);
this.Load += new System.EventHandler(this.ProductsGrid_Load); this.Load += new System.EventHandler(this.ProductsGrid_Load);
((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.gridEntryDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.syncBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.syncBindingSource)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.DataGridView gridEntryDataGridView; private System.Windows.Forms.DataGridView gridEntryDataGridView;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ContextMenuStrip showHideColumnsContextMenuStrip;
private SyncBindingSource syncBindingSource; private SyncBindingSource syncBindingSource;
private System.Windows.Forms.DataGridViewCheckBoxColumn removeGVColumn; private System.Windows.Forms.DataGridViewCheckBoxColumn removeGVColumn;
private LiberateDataGridViewImageButtonColumn liberateGVColumn; private LiberateDataGridViewImageButtonColumn liberateGVColumn;

View File

@ -4,6 +4,7 @@ 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 DataLayer;
using Dinah.Core.WindowsDesktop.Forms; using Dinah.Core.WindowsDesktop.Forms;
using LibationFileManager; using LibationFileManager;
@ -102,9 +103,11 @@ namespace LibationWinForms.GridView
private void gridEntryDataGridView_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) private void gridEntryDataGridView_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e)
{ {
var dgv = (DataGridView)sender; // header
if (e.RowIndex < 0)
return;
// cover // cover
if (e.ColumnIndex == coverGVColumn.Index) if (e.ColumnIndex == coverGVColumn.Index)
return; return;
@ -116,6 +119,7 @@ namespace LibationWinForms.GridView
{ {
try try
{ {
var dgv = (DataGridView)sender;
var text = dgv[e.ColumnIndex, e.RowIndex].Value.ToString(); var text = dgv[e.ColumnIndex, e.RowIndex].Value.ToString();
InteropFactory.Create().CopyTextToClipboard(text); InteropFactory.Create().CopyTextToClipboard(text);
} }
@ -130,24 +134,59 @@ namespace LibationWinForms.GridView
var entry = getGridEntry(e.RowIndex); var entry = getGridEntry(e.RowIndex);
if (entry.IsSeries) if (entry.IsSeries)
return; return;
// \Visual Studio 2022\Libation\Source\LibationAvalonia\Views\ProductsDisplay.axaml var stopLightContextMenu = new ContextMenuStrip();
/* e.ContextMenuStrip = stopLightContextMenu;
<ContextMenu IsVisible="{Binding !Liberate.IsSeries}"> {
<MenuItem Header="Item 1" Click="ContextMenuItem1_Click" /> var menuItem = new ToolStripMenuItem()
<MenuItem Header="Item 2" Click="ContextMenuItem2_Click" /> {
<MenuItem Header="Item 3" Click="ContextMenuItem3_Click" /> Text = "Set Download status to 'Downloaded'",
</ContextMenu> Enabled = entry.Book.UserDefinedItem.BookStatus != LiberatedStatus.Liberated
*/ };
//var contextMenu = new ContextMenuStrip(); menuItem.Click += (_, __) => entry.Book.UpdateBookStatus(LiberatedStatus.Liberated);
//contextMenu.Items.Add("Item 1"); stopLightContextMenu.Items.Add(menuItem);
//contextMenu.Items.Add("Item 2"); }
//contextMenu.Items.Add("Item 3"); {
//e.ContextMenuStrip = contextMenu; var menuItem = new ToolStripMenuItem()
} {
Text = "Set Download status to 'Not Downloaded'",
Enabled = entry.Book.UserDefinedItem.BookStatus != LiberatedStatus.NotLiberated
};
menuItem.Click += (_, __) => entry.Book.UpdateBookStatus(LiberatedStatus.NotLiberated);
stopLightContextMenu.Items.Add(menuItem);
}
{
var menuItem = new ToolStripMenuItem() { Text = "Remove from library" };
menuItem.Click += (_, __) => LibraryCommands.RemoveBook(entry.AudibleProductId);
stopLightContextMenu.Items.Add(menuItem);
}
{
var menuItem = new ToolStripMenuItem() { Text = "Locate file..." };
menuItem.Click += (_, __) =>
{
try
{
var openFileDialog = new OpenFileDialog
{
Title = $"Locate the audiofile for '{entry.Book.Title}'",
Filter = "All files (*.*)|*.*",
FilterIndex = 1
};
if (openFileDialog.ShowDialog() == DialogResult.OK)
FilePathCache.Insert(entry.AudibleProductId, openFileDialog.FileName);
}
catch (Exception ex)
{
var msg = "Error saving book's location";
MessageBoxLib.ShowAdminAlert(this, msg, msg, ex);
}
};
stopLightContextMenu.Items.Add(menuItem);
}
}
private GridEntry getGridEntry(int rowIndex) => gridEntryDataGridView.GetBoundItem<GridEntry>(rowIndex); private GridEntry getGridEntry(int rowIndex) => gridEntryDataGridView.GetBoundItem<GridEntry>(rowIndex);
#endregion #endregion
@ -362,8 +401,8 @@ namespace LibationWinForms.GridView
gridEntryDataGridView.ColumnWidthChanged += gridEntryDataGridView_ColumnWidthChanged; gridEntryDataGridView.ColumnWidthChanged += gridEntryDataGridView_ColumnWidthChanged;
gridEntryDataGridView.ColumnDisplayIndexChanged += gridEntryDataGridView_ColumnDisplayIndexChanged; gridEntryDataGridView.ColumnDisplayIndexChanged += gridEntryDataGridView_ColumnDisplayIndexChanged;
contextMenuStrip1.Items.Add(new ToolStripLabel("Show / Hide Columns")); showHideColumnsContextMenuStrip.Items.Add(new ToolStripLabel("Show / Hide Columns"));
contextMenuStrip1.Items.Add(new ToolStripSeparator()); showHideColumnsContextMenuStrip.Items.Add(new ToolStripSeparator());
//Restore Grid Display Settings //Restore Grid Display Settings
var config = Configuration.Instance; var config = Configuration.Instance;
@ -385,11 +424,11 @@ namespace LibationWinForms.GridView
Tag = itemName Tag = itemName
}; };
menuItem.Click += HideMenuItem_Click; menuItem.Click += HideMenuItem_Click;
contextMenuStrip1.Items.Add(menuItem); showHideColumnsContextMenuStrip.Items.Add(menuItem);
column.Width = gridColumnsWidths.GetValueOrDefault(itemName, column.Width); column.Width = gridColumnsWidths.GetValueOrDefault(itemName, column.Width);
column.MinimumWidth = 10; column.MinimumWidth = 10;
column.HeaderCell.ContextMenuStrip = contextMenuStrip1; column.HeaderCell.ContextMenuStrip = showHideColumnsContextMenuStrip;
column.Visible = visible; column.Visible = visible;
//Setting a default ContextMenuStrip will allow the columns to handle the //Setting a default ContextMenuStrip will allow the columns to handle the

View File

@ -60,7 +60,7 @@
<metadata name="removeGVColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="removeGVColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="showHideColumnsContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>171, 17</value> <value>171, 17</value>
</metadata> </metadata>
<metadata name="syncBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="syncBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">