//------------------------------------------------------------------------------------------------------------------- private void AddFoldersAction() { string[] fileExtentions = new string[] { "mp3", "wav", "avi", "mpeg", "mpeg2", "wma", "wmv", "mp4", "mpg", "mkv" }; ShowFolderViewModel showFolderViewModel = new ShowFolderViewModel(); OnFolderDialogQuery(showFolderViewModel); var sf = showFolderViewModel.GetSelectetedFolders(); foreach (var d in sf) { foreach (string ext in fileExtentions) { foreach (var f in d.Directory.GetFiles("*." + ext, SearchOption.AllDirectories)) { TrackInfo ti = new TrackInfo() { DirectoryName = f.DirectoryName, FileName = f.Name, FullDirectoryName = f.Directory.FullName, Position = 0 }; MediaData.CurrentList.AddTrackInfo(ti); } } } Save(); }
//------------------------------------------------------------------------------------------------------------------- public void OnFolderDialogQuery(ShowFolderViewModel showFolderViewModel) { Action <object> handle = FolderDialogQuery; if (handle != null) { handle(showFolderViewModel); } }