Beispiel #1
0
        public async void _ReorganizeDeviceLibrary()
        {
            var dlg = new Dialogs.YesNo("Reorganize Library", "All books in your Kindle's library will be moved and renamed according to your Kindle's settings. This may take some time depending on the size of your library.");
            await MaterialDesignThemes.Wpf.DialogHost.Show(dlg);

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

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

            OpenBottomDrawer(prgDlg.Content);

            _ = Task.Run(() =>
            {
                try
                {
                    foreach (BookBase book in SelectedDevice.Reorganize())
                    {
                        prgDlg.Current = $"Processed {book.Title}";
                    }
                    prgDlg.Current = "Cleaning up...";
                    SelectedDevice.Clean();
                }
                catch (Exception e)
                {
                    prgDlg.ShowError(e);
                }
                finally
                {
                    prgDlg.Finish($"{SelectedDevice.Name} reorganized.");
                }
            });
        }