Exemplo n.º 1
0
        private async void RenameCollection(RecentCollectionViewModel recent_collection)
        {
            logger.Trace($"Renaming collection [{recent_collection.Name} - {recent_collection.Filename}]");

            if (recent_collection.Invalid)
            {
                logger.Trace("Collection is invalid, so cannot rename it");
                return;
            }

            var vm = new InputDialogViewModel
            {
                Title   = "Renaming Collection",
                Message = "Enter new name for collection",
                Hint    = recent_collection.Name
            };
            var result = (bool)await DialogManager.ShowInputDialogAsync(vm);

            if (result)
            {
                var collection = repository.LoadCollection(recent_collection.Filename);
                if (collection != null)
                {
                    recent_collection.Name = vm.Input;
                    collection.Name        = vm.Input;

                    repository.SaveCollection(collection);
                }
            }
        }
Exemplo n.º 2
0
        private async void RemoveCollection(RecentCollectionViewModel recent_collection)
        {
            logger.Trace($"Removing collection [{recent_collection.Name} - {recent_collection.Filename}]");

            if (!recent_collection.Invalid)
            {
                var result = (bool)await DialogManager.ShowPromptDialogAsync("Removing Collection", "Do you want to delete it from disk?");

                if (result)
                {
                    repository.DeleteCollection(recent_collection.Filename);
                }
            }

            state_manager.RemoveFromRecentCollections(recent_collection.Obj);
            RecentCollections.Remove(recent_collection);
        }
Exemplo n.º 3
0
        private async void SelectCollection(RecentCollectionViewModel recent_collection)
        {
            logger.Trace($"Selected collection [{recent_collection.Name} - {recent_collection.Filename}]");

            if (recent_collection.Invalid)
            {
                var result = (bool)await DialogManager.ShowPromptDialogAsync("Invalid Collection", "Do you want to remove it from the list?");

                if (result)
                {
                    state_manager.RemoveFromRecentCollections(recent_collection.Obj);
                    RecentCollections.Remove(recent_collection);
                }
            }
            else
            {
                var collection = repository.LoadCollection(recent_collection.Filename);
                state_manager.SetCurrentCollection(collection);
                MessageBus.Current.SendMessage(NavigationMessage.Books);
            }
        }