// Checks for an existing library, if none exists create folders and call library gen method, if one does exist then it loads it up. private async Task <string> DoLibraryCheck() { bool isEmpty = !Directory.EnumerateFiles(ConfigClass.appLibraryFolder).Any(); // Checks if there are any libraries currently stored locally // If no local library exists, generate a new one via user input. if (isEmpty) { lblStatus.Content = "Library not found - Please select a root folder for your music."; MusickInputLibraryLocation folderSelectDialog = new MusickInputLibraryLocation(); folderSelectDialog.Owner = this; if (folderSelectDialog.ShowDialog() == true) { selectedFolder = folderSelectDialog.lblSelectedFolder.Content.ToString(); folderSelectDialog.Close(); MusickInputLibraryName libraryNameDialog = new MusickInputLibraryName(); libraryNameDialog.Owner = this; // Show testDialog as a modal dialog and determine if true. if (libraryNameDialog.ShowDialog() == true) { this.libraryName = libraryNameDialog.txtLibraryName.Text + ".txt"; // Read the contents of testDialog's TextBox. } lblStatus.Content = "Generating library from selected folder..."; await DoGenerateLibrary(selectedFolder); return("Library not found - Generating from path..."); } // If user somehow manages to dodge the dialog, this error will show (highly unlikely, but whatever) else { System.Windows.MessageBox.Show("You must select a library location!"); this.Close(); return("No Folder selected."); } } // If one exists, load the library. else { lblStatus.Content = "Library found - Loading Library..."; await Task.Delay(800); await DoLoadLibrary(); return("Library Found..."); } }
private async void txtLibraryAdd_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (txtLibraryAdd.Text != "") { MusickInputLibraryLocation folderSelectDialog = new MusickInputLibraryLocation(); folderSelectDialog.Owner = this; if (folderSelectDialog.ShowDialog() == true) { string selectedFolder = folderSelectDialog.lblSelectedFolder.Content.ToString(); string libraryName = txtLibraryAdd.Text; folderSelectDialog.Close(); txtLibraryAdd.Clear(); libList.Add(await DoGenerateLibrary(selectedFolder, libraryName)); } } } }
// Checks for an existing library, if none exists create folders and call library gen method, if one does exist then it loads it up. private async Task<string> DoLibraryCheck() { bool isEmpty = !Directory.EnumerateFiles(ConfigClass.appLibraryFolder).Any(); // Checks if there are any libraries currently stored locally // If no local library exists, generate a new one via user input. if (isEmpty) { lblStatus.Content = "Library not found - Please select a root folder for your music."; MusickInputLibraryLocation folderSelectDialog = new MusickInputLibraryLocation(); folderSelectDialog.Owner = this; if (folderSelectDialog.ShowDialog() == true) { selectedFolder = folderSelectDialog.lblSelectedFolder.Content.ToString(); folderSelectDialog.Close(); MusickInputLibraryName libraryNameDialog = new MusickInputLibraryName(); libraryNameDialog.Owner = this; // Show testDialog as a modal dialog and determine if true. if (libraryNameDialog.ShowDialog() == true) { this.libraryName = libraryNameDialog.txtLibraryName.Text + ".txt"; // Read the contents of testDialog's TextBox. } lblStatus.Content = "Generating library from selected folder..."; await DoGenerateLibrary(selectedFolder); return "Library not found - Generating from path..."; } // If user somehow manages to dodge the dialog, this error will show (highly unlikely, but whatever) else { System.Windows.MessageBox.Show("You must select a library location!"); this.Close(); return "No Folder selected."; } } // If one exists, load the library. else { lblStatus.Content = "Library found - Loading Library..."; await Task.Delay(800); await DoLoadLibrary(); return "Library Found..."; } }
private async void txtLibraryAdd_KeyDown(object sender, KeyEventArgs e) { if(e.Key == Key.Enter) { if (txtLibraryAdd.Text != "") { MusickInputLibraryLocation folderSelectDialog = new MusickInputLibraryLocation(); folderSelectDialog.Owner = this; if (folderSelectDialog.ShowDialog() == true) { string selectedFolder = folderSelectDialog.lblSelectedFolder.Content.ToString(); string libraryName = txtLibraryAdd.Text; folderSelectDialog.Close(); txtLibraryAdd.Clear(); libList.Add(await DoGenerateLibrary(selectedFolder,libraryName)); } } } }