- 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>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ApplicationIcon>libation.ico</ApplicationIcon>
|
||||
<AssemblyName>Libation</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -202,7 +202,6 @@
|
||||
this.libationFilesCustomRb.TabIndex = 3;
|
||||
this.libationFilesCustomRb.TabStop = true;
|
||||
this.libationFilesCustomRb.UseVisualStyleBackColor = true;
|
||||
this.libationFilesCustomRb.CheckedChanged += new System.EventHandler(this.libationFilesCustomRb_CheckedChanged);
|
||||
//
|
||||
// libationFilesMyDocsRb
|
||||
//
|
||||
|
||||
@ -18,7 +18,11 @@ namespace LibationWinForm
|
||||
public SettingsDialog()
|
||||
{
|
||||
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"));
|
||||
myDocs = Path.GetFullPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Libation"));
|
||||
@ -34,10 +38,16 @@ namespace LibationWinForm
|
||||
this.decryptKeyTb.Text = 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.audibleLocaleCb.Text = config.LocaleCountryCode;
|
||||
this.audibleLocaleCb.Text
|
||||
= !string.IsNullOrWhiteSpace(config.LocaleCountryCode)
|
||||
? config.LocaleCountryCode
|
||||
: "us";
|
||||
|
||||
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
||||
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + exeRoot;
|
||||
@ -80,13 +90,11 @@ namespace LibationWinForm
|
||||
break;
|
||||
}
|
||||
|
||||
libationFiles_Changed(this, null);
|
||||
libationFiles_Changed(this, null);
|
||||
}
|
||||
|
||||
private void libationFiles_Changed(object sender, EventArgs e)
|
||||
{
|
||||
Check_libationFilesCustom_RadioButton();
|
||||
|
||||
var libationFilesDir
|
||||
= libationFilesRootRb.Checked ? exeRoot
|
||||
: 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 libationFilesCustomBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
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 void libationFilesCustomBtn_Click(object sender, EventArgs e) => selectFolder("Search for Libation Files location", this.libationFilesCustomTb);
|
||||
|
||||
private static void selectFolder(string desc, TextBox textbox)
|
||||
{
|
||||
|
||||
@ -54,14 +54,43 @@ namespace LibationWinForm
|
||||
}
|
||||
}
|
||||
|
||||
#region bottom: qty books visible
|
||||
public void SetVisibleCount(int qty, string luceneSearchString = null)
|
||||
#region reload grid
|
||||
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))
|
||||
// visibleCountLbl.Text += " | " + luceneSearchString;
|
||||
}
|
||||
// UI init complete. now we can apply filter
|
||||
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
|
||||
|
||||
#region bottom: backup counts
|
||||
@ -172,41 +201,8 @@ namespace LibationWinForm
|
||||
}
|
||||
#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
|
||||
private void filterHelpBtn_Click(object sender, EventArgs e) => new Dialogs.SearchSyntaxDialog().ShowDialog();
|
||||
#region filter
|
||||
private void filterHelpBtn_Click(object sender, EventArgs e) => new Dialogs.SearchSyntaxDialog().ShowDialog();
|
||||
|
||||
private void AddFilterBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -247,8 +243,7 @@ namespace LibationWinForm
|
||||
MessageBox.Show($"Bad filter string:\r\n\r\n{ex.Message}", "Bad filter string", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
// re-apply last good filter
|
||||
filterSearchTb.Text = lastGoodFilter;
|
||||
doFilter();
|
||||
doFilter(lastGoodFilter);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -22,13 +22,11 @@ namespace LibationWinForm
|
||||
// - click on Data Sources > ProductItem. drowdown: DataGridView
|
||||
// - drag/drop ProductItem on design surface
|
||||
public partial class ProductsGrid : UserControl
|
||||
{
|
||||
private DataGridView dataGridView;
|
||||
{
|
||||
public event EventHandler<int> VisibleCountChanged;
|
||||
|
||||
private Form1 parent;
|
||||
private DataGridView dataGridView;
|
||||
|
||||
// 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();
|
||||
|
||||
private bool hasBeenDisplayed = false;
|
||||
@ -54,7 +52,7 @@ namespace LibationWinForm
|
||||
dataGridView.CellFormatting += replaceFormatted;
|
||||
dataGridView.CellFormatting += hiddenFormatting;
|
||||
// sorting breaks filters. must reapply filters after sorting
|
||||
dataGridView.Sorted += (_, __) => Filter();
|
||||
dataGridView.Sorted += (_, __) => filter();
|
||||
|
||||
{ // add tag buttons
|
||||
var editUserTagsButton = new DataGridViewButtonColumn { HeaderText = "Edit Tags" };
|
||||
@ -119,7 +117,7 @@ namespace LibationWinForm
|
||||
//
|
||||
// FILTER
|
||||
//
|
||||
Filter();
|
||||
filter();
|
||||
}
|
||||
|
||||
private void paintEditTag_TextAndImage(object sender, DataGridViewCellPaintingEventArgs e)
|
||||
@ -184,7 +182,7 @@ namespace LibationWinForm
|
||||
// needed to update text colors
|
||||
dataGridView.InvalidateRow(e.RowIndex);
|
||||
|
||||
Filter();
|
||||
filter();
|
||||
}
|
||||
|
||||
private static int saveChangedTags(Book book, string newTags)
|
||||
@ -232,11 +230,14 @@ namespace LibationWinForm
|
||||
|
||||
#region filter
|
||||
string _filterSearchString;
|
||||
public void Filter() => Filter(_filterSearchString);
|
||||
private void filter() => Filter(_filterSearchString);
|
||||
public void Filter(string searchString)
|
||||
{
|
||||
_filterSearchString = searchString;
|
||||
|
||||
if (dataGridView.Rows.Count == 0)
|
||||
return;
|
||||
|
||||
var searchResults = new LibationSearchEngine.SearchEngine().Search(searchString);
|
||||
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);
|
||||
}
|
||||
currencyManager.ResumeBinding();
|
||||
VisibleCountChanged?.Invoke(this, dataGridView.Rows.Cast<DataGridViewRow>().Count(r => r.Visible));
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -5,29 +5,39 @@ namespace LibationWinForm
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(FileManager.Configuration.Instance.Books))
|
||||
{
|
||||
var welcomeText = @"
|
||||
if (!createSettings())
|
||||
return;
|
||||
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
|
||||
private static bool createSettings()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(FileManager.Configuration.Instance.Books))
|
||||
return true;
|
||||
|
||||
var welcomeText = @"
|
||||
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.
|
||||
Go to Import > Scan Library
|
||||
".Trim();
|
||||
MessageBox.Show(welcomeText, "Welcom to Libation", MessageBoxButtons.OK);
|
||||
new SettingsDialog().ShowDialog();
|
||||
MessageBox.Show(welcomeText, "Welcom to Libation", MessageBoxButtons.OK);
|
||||
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 />
|
||||
<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>
|
||||
16
__TODO.txt
16
__TODO.txt
@ -1,4 +1,19 @@
|
||||
-- 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
|
||||
- Library import
|
||||
- Tag add/edit
|
||||
@ -6,6 +21,7 @@ Warn of known performance issues
|
||||
- get decrypt key -- unavoidable
|
||||
|
||||
Create release version and installer
|
||||
https://dotnetcoretutorials.com/2019/06/20/publishing-a-single-exe-file-in-net-core-3-0/
|
||||
-- end BETA ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- begin ENHANCEMENT, IMPORT UI ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user