Libation/Source/LibationWinForms/AvaloniaUI/Views/MainWindow/MainWindow.ScanNotification.axaml.cs
2022-07-11 00:13:32 -06:00

49 lines
1.6 KiB
C#

using ApplicationServices;
using Avalonia.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LibationWinForms.AvaloniaUI.Views
{
//DONE
public partial class MainWindow
{
private void Configure_ScanNotification()
{
scanningToolStripMenuItem.IsVisible = false;
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...";
}
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;
}
}
}