Added initial 'About' menu with version number

This commit is contained in:
Robert McRackan 2022-05-02 14:59:43 -04:00
parent 68ad627159
commit 1816bd721c
13 changed files with 388 additions and 358 deletions

View File

@ -5,8 +5,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AAXClean" Version="0.3.2" />
<PackageReference Include="AAXClean.Codecs" Version="0.1.10" />
<PackageReference Include="AAXClean" Version="0.3.5" />
<PackageReference Include="AAXClean.Codecs" Version="0.1.12" />
</ItemGroup>
<ItemGroup>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Version>7.0.0.1</Version>
<Version>7.0.1.1</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -61,6 +61,8 @@
this.backupsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.pdfsCountsLbl = new System.Windows.Forms.ToolStripStatusLabel();
this.addFilterBtn = new System.Windows.Forms.Button();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
@ -178,14 +180,14 @@
// removeAllAccountsToolStripMenuItem
//
this.removeAllAccountsToolStripMenuItem.Name = "removeAllAccountsToolStripMenuItem";
this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.removeAllAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.removeAllAccountsToolStripMenuItem.Text = "All Accounts";
this.removeAllAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeAllAccountsToolStripMenuItem_Click);
//
// removeSomeAccountsToolStripMenuItem
//
this.removeSomeAccountsToolStripMenuItem.Name = "removeSomeAccountsToolStripMenuItem";
this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.removeSomeAccountsToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.removeSomeAccountsToolStripMenuItem.Text = "Some Accounts";
this.removeSomeAccountsToolStripMenuItem.Click += new System.EventHandler(this.removeSomeAccountsToolStripMenuItem_Click);
//
@ -268,7 +270,9 @@
//
this.settingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.accountsToolStripMenuItem,
this.basicSettingsToolStripMenuItem});
this.basicSettingsToolStripMenuItem,
this.toolStripSeparator2,
this.aboutToolStripMenuItem});
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.settingsToolStripMenuItem.Text = "&Settings";
@ -276,14 +280,14 @@
// accountsToolStripMenuItem
//
this.accountsToolStripMenuItem.Name = "accountsToolStripMenuItem";
this.accountsToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
this.accountsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.accountsToolStripMenuItem.Text = "&Accounts...";
this.accountsToolStripMenuItem.Click += new System.EventHandler(this.accountsToolStripMenuItem_Click);
//
// basicSettingsToolStripMenuItem
//
this.basicSettingsToolStripMenuItem.Name = "basicSettingsToolStripMenuItem";
this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
this.basicSettingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.basicSettingsToolStripMenuItem.Text = "&Settings...";
this.basicSettingsToolStripMenuItem.Click += new System.EventHandler(this.basicSettingsToolStripMenuItem_Click);
//
@ -336,6 +340,18 @@
this.addFilterBtn.UseVisualStyleBackColor = true;
this.addFilterBtn.Click += new System.EventHandler(this.AddFilterBtn_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.aboutToolStripMenuItem.Text = "A&bout...";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
@ -397,5 +413,7 @@
private System.Windows.Forms.ToolStripMenuItem removeLibraryBooksToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeAllAccountsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeSomeAccountsToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
}
}

View File

@ -452,6 +452,9 @@ namespace LibationWinForms
private void accountsToolStripMenuItem_Click(object sender, EventArgs e) => new AccountsDialog(this).ShowDialog();
private void basicSettingsToolStripMenuItem_Click(object sender, EventArgs e) => new SettingsDialog().ShowDialog();
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
=> MessageBox.Show($"Running Libation version {AppScaffolding.LibationScaffolding.BuildVersion}", $"Libation v{AppScaffolding.LibationScaffolding.BuildVersion}");
#endregion
}
}

View File

@ -28,7 +28,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dinah.Core.WindowsDesktop" Version="4.0.6.1" />
<PackageReference Include="Dinah.Core.WindowsDesktop" Version="4.1.6.1" />
</ItemGroup>
<ItemGroup>

View File

@ -13,8 +13,8 @@ namespace LibationWinForms
internal class EditTagsDataGridViewImageButtonCell : DataGridViewImageButtonCell
{
private static readonly Image ButtonImage = Properties.Resources.edit_25x25;
private static readonly Color HiddenForeColor = Color.LightGray;
private static Image ButtonImage { get; } = Properties.Resources.edit_25x25;
private static Color HiddenForeColor { get; } = Color.LightGray;
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
{

View File

@ -24,8 +24,7 @@ namespace LibationWinForms
[Browsable(false)]
public string AudibleProductId => Book.AudibleProductId;
[Browsable(false)]
public LibraryBook LibraryBook { get; }
public LibraryBook LibraryBook { get; private set; }
#endregion
#region Model properties exposed to the view
@ -40,17 +39,17 @@ namespace LibationWinForms
}
}
public string ProductRating { get; }
public string PurchaseDate { get; }
public string MyRating { get; }
public string Series { get; }
public string Title { get; }
public string Length { get; }
public string Authors { get; }
public string Narrators { get; }
public string Category { get; }
public string Misc { get; }
public string Description { get; }
public string ProductRating { get; private set; }
public string PurchaseDate { get; private set; }
public string MyRating { get; private set; }
public string Series { get; private set; }
public string Title { get; private set; }
public string Length { get; private set; }
public string Authors { get; private set; }
public string Narrators { get; private set; }
public string Category { get; private set; }
public string Misc { get; private set; }
public string Description { get; private set; }
public string DisplayTags
{
get => string.Join("\r\n", Book.UserDefinedItem.TagsEnumerated);
@ -68,14 +67,25 @@ namespace LibationWinForms
LibraryBook.Book.UserDefinedItem.PdfStatus = value.PdfStatus;
}
}
#endregion
public event EventHandler<string> LibraryBookUpdated;
public event EventHandler Committed;
// alias
private Book Book => LibraryBook.Book;
public GridEntry(LibraryBook libraryBook)
public GridEntry(LibraryBook libraryBook) => setLibraryBook(libraryBook);
public void UpdateLibraryBook(LibraryBook libraryBook)
{
if (AudibleProductId != libraryBook.Book.AudibleProductId)
throw new Exception("Invalid grid entry update. IDs must match");
setLibraryBook(libraryBook);
}
private void setLibraryBook(LibraryBook libraryBook)
{
LibraryBook = libraryBook;
_memberValues = CreateMemberValueDictionary();
@ -107,6 +117,9 @@ namespace LibationWinForms
}
UserDefinedItem.ItemChanged += UserDefinedItem_ItemChanged;
// this will never have a value when triggered by ctor b/c nothing can subscribe to the event until after ctor is complete
LibraryBookUpdated?.Invoke(this, AudibleProductId);
}
private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e)
@ -134,22 +147,16 @@ namespace LibationWinForms
switch (itemName)
{
case nameof(udi.Tags):
{
Book.UserDefinedItem.Tags = udi.Tags;
NotifyPropertyChanged(nameof(DisplayTags));
}
break;
case nameof(udi.BookStatus):
{
Book.UserDefinedItem.BookStatus = udi.BookStatus;
NotifyPropertyChanged(nameof(Liberate));
}
break;
case nameof(udi.PdfStatus):
{
Book.UserDefinedItem.PdfStatus = udi.PdfStatus;
NotifyPropertyChanged(nameof(Liberate));
}
break;
}
@ -195,7 +202,7 @@ namespace LibationWinForms
public virtual object GetMemberValue(string memberName) => _memberValues[memberName]();
public virtual IComparer GetMemberComparer(Type memberType) => _memberTypeComparers[memberType];
private Dictionary<string, Func<object>> _memberValues { get; }
private Dictionary<string, Func<object>> _memberValues { get; set; }
/// <summary>
/// Create getters for all member object values by name

View File

@ -1,5 +1,4 @@
using ApplicationServices;
using System;
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Linq;

View File

@ -38,7 +38,7 @@ namespace LibationWinForms
InitializeComponent();
// sorting breaks filters. must reapply filters after sorting
_dataGridView.Sorted += (_, __) => Filter();
_dataGridView.Sorted += Filter;
_dataGridView.CellContentClick += DataGridView_CellContentClick;
EnableDoubleBuffering();
@ -110,7 +110,7 @@ namespace LibationWinForms
private SortableBindingList<GridEntry> bindingList;
/// <summary>Insert ad hoc library books to top of grid</summary>
public void AddToTop(DataLayer.LibraryBook libraryBook) => bindingList.Insert(0, new GridEntry(libraryBook));
public void AddToTop(DataLayer.LibraryBook libraryBook) => bindingList.Insert(0, libraryBookToGridEntry(libraryBook));
#region UI display functions
@ -135,12 +135,7 @@ namespace LibationWinForms
}
var orderedGridEntries = lib
.Select(lb =>
{
var entry = new GridEntry(lb);
entry.Committed += (_, __) => Filter();
return entry;
}).ToList()
.Select(lb => libraryBookToGridEntry(lb))
// default load order
.OrderByDescending(ge => (DateTime)ge.GetMemberValue(nameof(ge.PurchaseDate)))
//// more advanced example: sort by author, then series, then title
@ -157,12 +152,20 @@ namespace LibationWinForms
Filter();
}
private GridEntry libraryBookToGridEntry(DataLayer.LibraryBook libraryBook)
{
var entry = new GridEntry(libraryBook);
entry.Committed += Filter;
entry.LibraryBookUpdated += (sender, productId) => _dataGridView.InvalidateRow(_dataGridView.GetRowIdOfBoundItem((GridEntry)sender));
return entry;
}
#endregion
#region Filter
private string _filterSearchString;
private void Filter() => Filter(_filterSearchString);
private void Filter(object _ = null, EventArgs __ = null) => Filter(_filterSearchString);
public void Filter(string searchString)
{
_filterSearchString = searchString;