Make Form1 MVVM

This commit is contained in:
Michael Bucari-Tovo 2022-07-15 00:23:22 -06:00
parent 7b7e1d8574
commit 180d591b0a
15 changed files with 402 additions and 369 deletions

View file

@ -9,36 +9,18 @@ namespace LibationWinForms.AvaloniaUI.Views
{
private void Configure_ScanNotification()
{
scanningToolStripMenuItem.IsVisible = false;
_viewModel.NumAccountsScanning = 0;
LibraryCommands.ScanBegin += LibraryCommands_ScanBegin;
LibraryCommands.ScanEnd += LibraryCommands_ScanEnd;
}
private void LibraryCommands_ScanBegin(object sender, int accountsLength)
{
removeLibraryBooksToolStripMenuItem.IsEnabled = false;
removeAllAccountsToolStripMenuItem.IsEnabled = false;
removeSomeAccountsToolStripMenuItem.IsEnabled = false;
scanLibraryToolStripMenuItem.IsEnabled = false;
scanLibraryOfAllAccountsToolStripMenuItem.IsEnabled = false;
scanLibraryOfSomeAccountsToolStripMenuItem.IsEnabled = false;
this.scanningToolStripMenuItem.IsVisible = true;
this.scanningToolStripMenuItem_Text.Text
= (accountsLength == 1)
? "Scanning..."
: $"Scanning {accountsLength} accounts...";
_viewModel.NumAccountsScanning = accountsLength;
}
private void LibraryCommands_ScanEnd(object sender, EventArgs e)
{
removeLibraryBooksToolStripMenuItem.IsEnabled = true;
removeAllAccountsToolStripMenuItem.IsEnabled = true;
removeSomeAccountsToolStripMenuItem.IsEnabled = true;
scanLibraryToolStripMenuItem.IsEnabled = true;
scanLibraryOfAllAccountsToolStripMenuItem.IsEnabled = true;
scanLibraryOfSomeAccountsToolStripMenuItem.IsEnabled = true;
this.scanningToolStripMenuItem.IsVisible = false;
_viewModel.NumAccountsScanning = 0;
}
}
}