Exemple #1
0
        public async void _ScanDeviceLibrary()
        {
            var dlg = new Dialogs.YesNo("Rescan Library", "Your Kindle will be scanned for books which will then be organized and renamed according to your Kindle's settings.");
            await MaterialDesignThemes.Wpf.DialogHost.Show(dlg);

            if (dlg.DialogResult == false)
            {
                return;
            }

            var prgDlg = new Dialogs.Progress("Scanning Library", true);

            OpenBottomDrawer(prgDlg.Content);

            _ = Task.Run(() =>
            {
                try
                {
                    foreach (BookBase book in SelectedDevice.Rescan())
                    {
                        prgDlg.Current = $"Processed {book.Title}";
                    }
                }
                catch (Exception e)
                {
                    prgDlg.ShowError(e);
                }
                finally
                {
                    prgDlg.Finish($"{SelectedDevice.Name} library scan complete.");
                }
            });
        }