/// <summary>
        /// Adds folders to the library
        /// </summary>
        private void AddToLibrary()
        {
            List <string> oldSelectedFolders = SolutionWideSettings.Instance.LibraryFolderPaths;
            List <string> selectedFolders    = FolderSelectionViewModel.ShowFolderSelectionAsDialog(oldSelectedFolders);

            if (oldSelectedFolders == null || oldSelectedFolders.SequenceEqual(selectedFolders) == false)
            {
                SolutionWideSettings.Instance.LibraryFolderPaths = selectedFolders;
                _mediaLibraryItems.Clear();

                RefreshLibraryCommand.RaiseCanExecuteChanged();
                RefreshLibrary();
            }
        }
Exemple #2
0
        /// <summary>
        /// Shows the folder selection dialog with the already selected folders
        /// </summary>
        /// <param name="currentlySelectedFolders">folders that are now in the media folders list</param>
        /// <returns>list of currently selected folders</returns>
        public static List <string> ShowFolderSelectionAsDialog(List <string> currentlySelectedFolders)
        {
            FolderSelectionViewModel viewModel = new FolderSelectionViewModel(currentlySelectedFolders);
            Window view         = viewModel.View as Window;
            bool?  dialogResult = view?.ShowDialog();

            if (dialogResult != null && dialogResult.Value)
            {
                SolutionWideSettings.Instance.ArtistTitleSeparator = viewModel.Separator;
                SolutionWideSettings.Instance.ArtistBeforeTitle    = viewModel.FileNameSchema ==
                                                                     NamingSchema.ArtistBeforeTitle;
                SolutionWideSettings.Instance.ParseTagBeforeName = viewModel.ParsingPriorities ==
                                                                   ParsingPriority.TagBeforeFileName;
                return(viewModel._selectedFolders.ToList());
            }
            return(currentlySelectedFolders);
        }