Add SeriesViewDialog

This commit is contained in:
MBucari 2023-03-19 20:05:18 -06:00 committed by Mbucari
parent 784ab73a36
commit 9ae1f0399b
27 changed files with 1293 additions and 18 deletions

View file

@ -41,7 +41,6 @@
productsGrid.TabIndex = 0;
productsGrid.VisibleCountChanged += productsGrid_VisibleCountChanged;
productsGrid.LiberateClicked += productsGrid_LiberateClicked;
productsGrid.ConvertToMp3Clicked += productsGrid_ConvertToMp3Clicked;
productsGrid.CoverClicked += productsGrid_CoverClicked;
productsGrid.DetailsClicked += productsGrid_DetailsClicked;
productsGrid.DescriptionClicked += productsGrid_DescriptionClicked;

View file

@ -5,6 +5,7 @@ using FileLiberator;
using LibationFileManager;
using LibationUiBase.GridView;
using LibationWinForms.Dialogs;
using LibationWinForms.SeriesView;
using System;
using System.Collections.Generic;
using System.Drawing;
@ -218,6 +219,20 @@ namespace LibationWinForms.GridView
bookRecordMenuItem.Click += (_, _) => new BookRecordsDialog(entry.LibraryBook).ShowDialog(this);
}
#endregion
#region View All Series
if (entry.Book.SeriesLink.Any())
{
var header = entry.Liberate.IsSeries ? "View All Episodes in Series" : "View All Books in Series";
var viewSeriesMenuItem = new ToolStripMenuItem { Text = header };
ctxMenu.Items.Add(viewSeriesMenuItem);
viewSeriesMenuItem.Click += (_, _) => new SeriesViewDialog(entry.LibraryBook).Show();
}
#endregion
}
@ -333,12 +348,6 @@ namespace LibationWinForms.GridView
LiberateClicked?.Invoke(this, liveGridEntry.LibraryBook);
}
private void productsGrid_ConvertToMp3Clicked(ILibraryBookEntry liveGridEntry)
{
if (liveGridEntry.LibraryBook.Book.UserDefinedItem.BookStatus is not LiberatedStatus.Error)
ConvertToMp3Clicked?.Invoke(this, liveGridEntry.LibraryBook);
}
private void productsGrid_RemovableCountChanged(object sender, EventArgs e)
{
RemovableCountChanged?.Invoke(sender, productsGrid.GetAllBookEntries().Count(lbe => lbe.Remove is true));

View file

@ -21,7 +21,6 @@ namespace LibationWinForms.GridView
/// <summary>Number of visible rows has changed</summary>
public event EventHandler<int> VisibleCountChanged;
public event LibraryBookEntryClickedEventHandler LiberateClicked;
public event LibraryBookEntryClickedEventHandler ConvertToMp3Clicked;
public event GridEntryClickedEventHandler CoverClicked;
public event LibraryBookEntryClickedEventHandler DetailsClicked;
public event GridEntryRectangleClickedEventHandler DescriptionClicked;
@ -308,7 +307,8 @@ namespace LibationWinForms.GridView
//Add episode to the grid beneath the parent
int seriesIndex = bindingList.IndexOf(seriesEntry);
bindingList.Insert(seriesIndex + 1, episodeEntry);
int episodeIndex = seriesEntry.Children.IndexOf(episodeEntry);
bindingList.Insert(seriesIndex + 1 + episodeIndex, episodeEntry);
if (seriesEntry.Liberate.Expanded)
bindingList.ExpandItem(seriesEntry);