- Change name LibationWinForm.exe => Libation.exe
- lots of pre-beta bug fixes
This commit is contained in:
parent
b126eed028
commit
c598576683
@ -5,6 +5,7 @@
|
|||||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ApplicationIcon>libation.ico</ApplicationIcon>
|
<ApplicationIcon>libation.ico</ApplicationIcon>
|
||||||
|
<AssemblyName>Libation</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -202,7 +202,6 @@
|
|||||||
this.libationFilesCustomRb.TabIndex = 3;
|
this.libationFilesCustomRb.TabIndex = 3;
|
||||||
this.libationFilesCustomRb.TabStop = true;
|
this.libationFilesCustomRb.TabStop = true;
|
||||||
this.libationFilesCustomRb.UseVisualStyleBackColor = true;
|
this.libationFilesCustomRb.UseVisualStyleBackColor = true;
|
||||||
this.libationFilesCustomRb.CheckedChanged += new System.EventHandler(this.libationFilesCustomRb_CheckedChanged);
|
|
||||||
//
|
//
|
||||||
// libationFilesMyDocsRb
|
// libationFilesMyDocsRb
|
||||||
//
|
//
|
||||||
|
|||||||
@ -18,7 +18,11 @@ namespace LibationWinForm
|
|||||||
public SettingsDialog()
|
public SettingsDialog()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
audibleLocaleCb.SelectedIndex = 0;
|
this.libationFilesCustomTb.TextChanged += (_, __) =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(libationFilesCustomTb.Text))
|
||||||
|
this.libationFilesCustomRb.Checked = true;
|
||||||
|
};
|
||||||
|
|
||||||
exeRoot = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Exe.FileLocationOnDisk), "Libation"));
|
exeRoot = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Exe.FileLocationOnDisk), "Libation"));
|
||||||
myDocs = Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Libation"));
|
myDocs = Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Libation"));
|
||||||
@ -34,10 +38,16 @@ namespace LibationWinForm
|
|||||||
this.decryptKeyTb.Text = config.DecryptKey;
|
this.decryptKeyTb.Text = config.DecryptKey;
|
||||||
this.decryptKeyDescLbl.Text = desc(nameof(config.DecryptKey));
|
this.decryptKeyDescLbl.Text = desc(nameof(config.DecryptKey));
|
||||||
|
|
||||||
this.booksLocationTb.Text = config.Books;
|
this.booksLocationTb.Text
|
||||||
|
= !string.IsNullOrWhiteSpace(config.Books)
|
||||||
|
? config.Books
|
||||||
|
: Path.GetDirectoryName(Exe.FileLocationOnDisk);
|
||||||
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
this.booksLocationDescLbl.Text = desc(nameof(config.Books));
|
||||||
|
|
||||||
this.audibleLocaleCb.Text = config.LocaleCountryCode;
|
this.audibleLocaleCb.Text
|
||||||
|
= !string.IsNullOrWhiteSpace(config.LocaleCountryCode)
|
||||||
|
? config.LocaleCountryCode
|
||||||
|
: "us";
|
||||||
|
|
||||||
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
||||||
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + exeRoot;
|
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + exeRoot;
|
||||||
@ -85,8 +95,6 @@ namespace LibationWinForm
|
|||||||
|
|
||||||
private void libationFiles_Changed(object sender, EventArgs e)
|
private void libationFiles_Changed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Check_libationFilesCustom_RadioButton();
|
|
||||||
|
|
||||||
var libationFilesDir
|
var libationFilesDir
|
||||||
= libationFilesRootRb.Checked ? exeRoot
|
= libationFilesRootRb.Checked ? exeRoot
|
||||||
: libationFilesMyDocsRb.Checked ? myDocs
|
: libationFilesMyDocsRb.Checked ? myDocs
|
||||||
@ -101,14 +109,7 @@ namespace LibationWinForm
|
|||||||
|
|
||||||
private void booksLocationSearchBtn_Click(object sender, EventArgs e) => selectFolder("Search for books location", this.booksLocationTb);
|
private void booksLocationSearchBtn_Click(object sender, EventArgs e) => selectFolder("Search for books location", this.booksLocationTb);
|
||||||
|
|
||||||
private void libationFilesCustomBtn_Click(object sender, EventArgs e)
|
private void libationFilesCustomBtn_Click(object sender, EventArgs e) => selectFolder("Search for Libation Files location", this.libationFilesCustomTb);
|
||||||
{
|
|
||||||
Check_libationFilesCustom_RadioButton();
|
|
||||||
selectFolder("Search for Libation Files location", this.libationFilesCustomTb);
|
|
||||||
}
|
|
||||||
private void libationFilesCustomRb_CheckedChanged(object sender, EventArgs e) => Check_libationFilesCustom_RadioButton();
|
|
||||||
|
|
||||||
private void Check_libationFilesCustom_RadioButton() => this.libationFilesCustomRb.Checked = true;
|
|
||||||
|
|
||||||
private static void selectFolder(string desc, TextBox textbox)
|
private static void selectFolder(string desc, TextBox textbox)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,14 +54,43 @@ namespace LibationWinForm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region bottom: qty books visible
|
#region reload grid
|
||||||
public void SetVisibleCount(int qty, string luceneSearchString = null)
|
bool isProcessingGridSelect = false;
|
||||||
|
private void reloadGrid()
|
||||||
{
|
{
|
||||||
visibleCountLbl.Text = string.Format(visibleCountLbl_Format, qty);
|
// suppressed filter while init'ing UI
|
||||||
|
var prev_isProcessingGridSelect = isProcessingGridSelect;
|
||||||
|
isProcessingGridSelect = true;
|
||||||
|
setGrid();
|
||||||
|
isProcessingGridSelect = prev_isProcessingGridSelect;
|
||||||
|
|
||||||
//if (!string.IsNullOrWhiteSpace(luceneSearchString))
|
// UI init complete. now we can apply filter
|
||||||
// visibleCountLbl.Text += " | " + luceneSearchString;
|
doFilter(lastGoodFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProductsGrid currProductsGrid;
|
||||||
|
private void setGrid()
|
||||||
|
{
|
||||||
|
SuspendLayout();
|
||||||
|
{
|
||||||
|
if (currProductsGrid != null)
|
||||||
|
{
|
||||||
|
gridPanel.Controls.Remove(currProductsGrid);
|
||||||
|
currProductsGrid.VisibleCountChanged -= setVisibleCount;
|
||||||
|
currProductsGrid.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
currProductsGrid = new ProductsGrid { Dock = DockStyle.Fill };
|
||||||
|
currProductsGrid.VisibleCountChanged += setVisibleCount;
|
||||||
|
gridPanel.Controls.Add(currProductsGrid);
|
||||||
|
currProductsGrid.Display();
|
||||||
|
}
|
||||||
|
ResumeLayout();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region bottom: qty books visible
|
||||||
|
private void setVisibleCount(object _, int qty) => visibleCountLbl.Text = string.Format(visibleCountLbl_Format, qty);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region bottom: backup counts
|
#region bottom: backup counts
|
||||||
@ -172,39 +201,6 @@ namespace LibationWinForm
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region reload grid
|
|
||||||
bool isProcessingGridSelect = false;
|
|
||||||
private void reloadGrid()
|
|
||||||
{
|
|
||||||
// suppressed filter while init'ing UI
|
|
||||||
var prev_isProcessingGridSelect = isProcessingGridSelect;
|
|
||||||
isProcessingGridSelect = true;
|
|
||||||
setGrid();
|
|
||||||
isProcessingGridSelect = prev_isProcessingGridSelect;
|
|
||||||
|
|
||||||
// UI init complete. now we can apply filter
|
|
||||||
doFilter(lastGoodFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
ProductsGrid currProductsGrid;
|
|
||||||
private void setGrid()
|
|
||||||
{
|
|
||||||
SuspendLayout();
|
|
||||||
{
|
|
||||||
if (currProductsGrid != null)
|
|
||||||
{
|
|
||||||
gridPanel.Controls.Remove(currProductsGrid);
|
|
||||||
currProductsGrid.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
currProductsGrid = new ProductsGrid(this) { Dock = DockStyle.Fill };
|
|
||||||
gridPanel.Controls.Add(currProductsGrid);
|
|
||||||
currProductsGrid.Display();
|
|
||||||
}
|
|
||||||
ResumeLayout();
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region filter
|
#region filter
|
||||||
private void filterHelpBtn_Click(object sender, EventArgs e) => new Dialogs.SearchSyntaxDialog().ShowDialog();
|
private void filterHelpBtn_Click(object sender, EventArgs e) => new Dialogs.SearchSyntaxDialog().ShowDialog();
|
||||||
|
|
||||||
@ -247,8 +243,7 @@ namespace LibationWinForm
|
|||||||
MessageBox.Show($"Bad filter string:\r\n\r\n{ex.Message}", "Bad filter string", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show($"Bad filter string:\r\n\r\n{ex.Message}", "Bad filter string", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
|
||||||
// re-apply last good filter
|
// re-apply last good filter
|
||||||
filterSearchTb.Text = lastGoodFilter;
|
doFilter(lastGoodFilter);
|
||||||
doFilter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -23,12 +23,10 @@ namespace LibationWinForm
|
|||||||
// - drag/drop ProductItem on design surface
|
// - drag/drop ProductItem on design surface
|
||||||
public partial class ProductsGrid : UserControl
|
public partial class ProductsGrid : UserControl
|
||||||
{
|
{
|
||||||
|
public event EventHandler<int> VisibleCountChanged;
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
|
|
||||||
private Form1 parent;
|
|
||||||
|
|
||||||
// this is a simple ctor for loading library and wish list. can expand later for other options. eg: overload ctor
|
|
||||||
public ProductsGrid(Form1 parent) : this() => this.parent = parent;
|
|
||||||
public ProductsGrid() => InitializeComponent();
|
public ProductsGrid() => InitializeComponent();
|
||||||
|
|
||||||
private bool hasBeenDisplayed = false;
|
private bool hasBeenDisplayed = false;
|
||||||
@ -54,7 +52,7 @@ namespace LibationWinForm
|
|||||||
dataGridView.CellFormatting += replaceFormatted;
|
dataGridView.CellFormatting += replaceFormatted;
|
||||||
dataGridView.CellFormatting += hiddenFormatting;
|
dataGridView.CellFormatting += hiddenFormatting;
|
||||||
// sorting breaks filters. must reapply filters after sorting
|
// sorting breaks filters. must reapply filters after sorting
|
||||||
dataGridView.Sorted += (_, __) => Filter();
|
dataGridView.Sorted += (_, __) => filter();
|
||||||
|
|
||||||
{ // add tag buttons
|
{ // add tag buttons
|
||||||
var editUserTagsButton = new DataGridViewButtonColumn { HeaderText = "Edit Tags" };
|
var editUserTagsButton = new DataGridViewButtonColumn { HeaderText = "Edit Tags" };
|
||||||
@ -119,7 +117,7 @@ namespace LibationWinForm
|
|||||||
//
|
//
|
||||||
// FILTER
|
// FILTER
|
||||||
//
|
//
|
||||||
Filter();
|
filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void paintEditTag_TextAndImage(object sender, DataGridViewCellPaintingEventArgs e)
|
private void paintEditTag_TextAndImage(object sender, DataGridViewCellPaintingEventArgs e)
|
||||||
@ -184,7 +182,7 @@ namespace LibationWinForm
|
|||||||
// needed to update text colors
|
// needed to update text colors
|
||||||
dataGridView.InvalidateRow(e.RowIndex);
|
dataGridView.InvalidateRow(e.RowIndex);
|
||||||
|
|
||||||
Filter();
|
filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int saveChangedTags(Book book, string newTags)
|
private static int saveChangedTags(Book book, string newTags)
|
||||||
@ -232,11 +230,14 @@ namespace LibationWinForm
|
|||||||
|
|
||||||
#region filter
|
#region filter
|
||||||
string _filterSearchString;
|
string _filterSearchString;
|
||||||
public void Filter() => Filter(_filterSearchString);
|
private void filter() => Filter(_filterSearchString);
|
||||||
public void Filter(string searchString)
|
public void Filter(string searchString)
|
||||||
{
|
{
|
||||||
_filterSearchString = searchString;
|
_filterSearchString = searchString;
|
||||||
|
|
||||||
|
if (dataGridView.Rows.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
var searchResults = new LibationSearchEngine.SearchEngine().Search(searchString);
|
var searchResults = new LibationSearchEngine.SearchEngine().Search(searchString);
|
||||||
var productIds = searchResults.Docs.Select(d => d.ProductId).ToList();
|
var productIds = searchResults.Docs.Select(d => d.ProductId).ToList();
|
||||||
|
|
||||||
@ -248,11 +249,9 @@ namespace LibationWinForm
|
|||||||
dataGridView.Rows[r].Visible = productIds.Contains(getGridEntry(r).GetBook().AudibleProductId);
|
dataGridView.Rows[r].Visible = productIds.Contains(getGridEntry(r).GetBook().AudibleProductId);
|
||||||
}
|
}
|
||||||
currencyManager.ResumeBinding();
|
currencyManager.ResumeBinding();
|
||||||
|
VisibleCountChanged?.Invoke(this, dataGridView.Rows.Cast<DataGridViewRow>().Count(r => r.Visible));
|
||||||
|
|
||||||
var luceneSearchString_debug = searchResults.SearchString;
|
var luceneSearchString_debug = searchResults.SearchString;
|
||||||
|
|
||||||
// after applying filters, display new visible count
|
|
||||||
parent.SetVisibleCount(dataGridView.Rows.Cast<DataGridViewRow>().Count(r => r.Visible), luceneSearchString_debug);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -5,29 +5,39 @@ namespace LibationWinForm
|
|||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// The main entry point for the application.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(FileManager.Configuration.Instance.Books))
|
if (!createSettings())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool createSettings()
|
||||||
{
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(FileManager.Configuration.Instance.Books))
|
||||||
|
return true;
|
||||||
|
|
||||||
var welcomeText = @"
|
var welcomeText = @"
|
||||||
This appears to be your first time using Libation. Welcome.
|
This appears to be your first time using Libation. Welcome.
|
||||||
Please fill fill in a few settings on the following page. You can also change these settings later.
|
Please fill in a few settings on the following page. You can also change these settings later.
|
||||||
|
|
||||||
After you make your selections, get started by importing your library.
|
After you make your selections, get started by importing your library.
|
||||||
Go to Import > Scan Library
|
Go to Import > Scan Library
|
||||||
".Trim();
|
".Trim();
|
||||||
MessageBox.Show(welcomeText, "Welcom to Libation", MessageBoxButtons.OK);
|
MessageBox.Show(welcomeText, "Welcom to Libation", MessageBoxButtons.OK);
|
||||||
new SettingsDialog().ShowDialog();
|
var dialogResult = new SettingsDialog().ShowDialog();
|
||||||
|
if (dialogResult != DialogResult.OK)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Initial set up cancelled.", "Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.Run(new Form1());
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,11 +170,4 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets')" />
|
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.111.0\build\net46\System.Data.SQLite.Core.targets'))" />
|
|
||||||
</Target>
|
|
||||||
</Project>
|
</Project>
|
||||||
16
__TODO.txt
16
__TODO.txt
@ -1,4 +1,19 @@
|
|||||||
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
-- begin BETA ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
if db present but no search files -- re-create
|
||||||
|
|
||||||
|
make sure the new "if (dataGridView.Rows.Count == 0)" doesn't break filtering if all are invisible
|
||||||
|
- load products. do a search with 0 results. do a search with results
|
||||||
|
|
||||||
|
libation errors on another computer:
|
||||||
|
copy pw, LibationSettings.json
|
||||||
|
file not found. probably about file locations. the bottom right and bottom left counts don't update
|
||||||
|
ONLY file in libation files: IdentityTokens.json. no other files OR folders
|
||||||
|
exception after library scan
|
||||||
|
file not found. same file?
|
||||||
|
no mdf,ldf files created in C:\Users\[username]
|
||||||
|
|
||||||
|
throttle needed for downloading images, pdf.s
|
||||||
|
|
||||||
Warn of known performance issues
|
Warn of known performance issues
|
||||||
- Library import
|
- Library import
|
||||||
- Tag add/edit
|
- Tag add/edit
|
||||||
@ -6,6 +21,7 @@ Warn of known performance issues
|
|||||||
- get decrypt key -- unavoidable
|
- get decrypt key -- unavoidable
|
||||||
|
|
||||||
Create release version and installer
|
Create release version and installer
|
||||||
|
https://dotnetcoretutorials.com/2019/06/20/publishing-a-single-exe-file-in-net-core-3-0/
|
||||||
-- end BETA ---------------------------------------------------------------------------------------------------------------------
|
-- end BETA ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- begin ENHANCEMENT, IMPORT UI ---------------------------------------------------------------------------------------------------------------------
|
-- begin ENHANCEMENT, IMPORT UI ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user