Minor refactor

This commit is contained in:
Michael Bucari-Tovo 2022-07-14 02:46:45 -06:00
parent 7b28a274a8
commit a5d225dc44
4 changed files with 8 additions and 10 deletions

View File

@ -43,7 +43,7 @@ namespace LibationWinForms.AvaloniaUI.Views
Tag = quickFilterTag, Tag = quickFilterTag,
Header = $"_{++index}: {filter}" Header = $"_{++index}: {filter}"
}; };
quickFilterMenuItem.Click += (_, __) => performFilter(filter); quickFilterMenuItem.Click += async (_, __) => await performFilter(filter);
allItems.Add(quickFilterMenuItem); allItems.Add(quickFilterMenuItem);
} }
quickFiltersToolStripMenuItem.Items = allItems; quickFiltersToolStripMenuItem.Items = allItems;
@ -60,10 +60,10 @@ namespace LibationWinForms.AvaloniaUI.Views
public void editQuickFiltersToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) => new EditQuickFilters().ShowDialog(); public void editQuickFiltersToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) => new EditQuickFilters().ShowDialog();
public void productsDisplay_Initialized(object sender, EventArgs e) public async void productsDisplay_Initialized(object sender, EventArgs e)
{ {
if (QuickFilters.UseDefault) if (QuickFilters.UseDefault)
performFilter(QuickFilters.Filters.FirstOrDefault()); await performFilter(QuickFilters.Filters.FirstOrDefault());
} }
} }
} }

View File

@ -20,7 +20,7 @@ namespace LibationWinForms.AvaloniaUI.Views
await productsDisplay.RemoveCheckedBooksAsync(); await productsDisplay.RemoveCheckedBooksAsync();
} }
public void doneRemovingBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) public async void doneRemovingBtn_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{ {
removeBooksBtn.IsVisible = false; removeBooksBtn.IsVisible = false;
doneRemovingBtn.IsVisible = false; doneRemovingBtn.IsVisible = false;
@ -30,7 +30,7 @@ namespace LibationWinForms.AvaloniaUI.Views
//Restore the filter //Restore the filter
filterSearchTb.IsEnabled = true; filterSearchTb.IsEnabled = true;
filterSearchTb.IsVisible = true; filterSearchTb.IsVisible = true;
performFilter(filterSearchTb.Text); await performFilter(filterSearchTb.Text);
} }
public void removeLibraryBooksToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e) public void removeLibraryBooksToolStripMenuItem_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)

View File

@ -20,8 +20,6 @@ namespace LibationWinForms
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)] [return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)]
static extern bool AllocConsole(); static extern bool AllocConsole();
static bool UseAvaloniaUI = true;
[STAThread] [STAThread]
static async Task Main() static async Task Main()
{ {
@ -39,7 +37,6 @@ namespace LibationWinForms
if (!startupTask.Result.success) if (!startupTask.Result.success)
return; return;
//When RunStartupStuff completes, check if user has opted into beta and run Avalonia UI if they did. //When RunStartupStuff completes, check if user has opted into beta and run Avalonia UI if they did.
//Otherwise we just ignore all the Avalonia app build stuff and continue with winforms. //Otherwise we just ignore all the Avalonia app build stuff and continue with winforms.
@ -121,7 +118,7 @@ namespace LibationWinForms
// global exception handling (ShowAdminAlert) attempts to use logging. only call it after logging has been init'd // global exception handling (ShowAdminAlert) attempts to use logging. only call it after logging has been init'd
postLoggingGlobalExceptionHandling(); postLoggingGlobalExceptionHandling();
return (true, !useBeta); return (true, useBeta);
} }
private static void RunInstaller(Configuration config) private static void RunInstaller(Configuration config)

View File

@ -12,5 +12,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>false</SelfContained> <SelfContained>false</SelfContained>
<PublishSingleFile>false</PublishSingleFile> <PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup> </PropertyGroup>
</Project> </Project>