Libation/LibationWinForm/UNTESTED/Dialogs/IndexLibraryDialog.cs
Robert McRackan b9314ac678 Added validation and error handling
BETA READY
2019-11-15 22:43:04 -05:00

32 lines
809 B
C#

using System.Windows.Forms;
using ApplicationServices;
namespace LibationWinForm
{
public partial class IndexLibraryDialog : Form
{
public int NewBooksAdded { get; private set; }
public int TotalBooksProcessed { get; private set; }
public IndexLibraryDialog()
{
InitializeComponent();
this.Shown += IndexLibraryDialog_Shown;
}
private async void IndexLibraryDialog_Shown(object sender, System.EventArgs e)
{
try
{
(TotalBooksProcessed, NewBooksAdded) = await LibraryCommands.IndexLibraryAsync(new Login.WinformResponder());
}
catch
{
MessageBox.Show("Error importing library. Please try again. If this happens after 2 or 3 tries, contact administrator", "Error importing library", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.Close();
}
}
}