/// <summary> /// Called when a library has been selected by the LibrarySelectionDialogFragment /// </summary> /// <param name="selectedLibrary"></param> private void LibrarySelected(Library selectedLibrary) { // Save the library being scanned libraryBeingScanned = selectedLibrary; // Start the library scan process and let the user know what is happening cancelHasBeenRequested = false; commandState = CommandStateType.Scanning; LibraryScanController.ResetController(); LibraryScanController.ScanReporter = this; LibraryScanController.ScanLibraryAsynch(libraryBeingScanned); ScanProgressDialogFragment.ShowFragment(CommandRouter.Manager, libraryBeingScanned.Name, CancelRequested, BindDialog); }
/// <summary> /// Delegate called when the scan process has finished /// </summary> public void ScanFinished() { // Check if any of the songs in the library have not been matched or have changed (only process if the scan was not cancelled) if ((cancelHasBeenRequested == false) && (LibraryScanModel.UnmatchedSongs.Count > 0)) { // Delete all of the unmatched songs. Don't wait for this to finish, the DeleteFinished method will be called when it has finished. commandState = CommandStateType.Deleting; LibraryScanController.DeleteReporter = this; LibraryScanController.DeleteSongsAsync(); } // If the ScanProgressDialogFragment is available then we can proceed with the next stage of the process else if (scanProgressDialog != null) { scanProgressDialog.Dismiss(); NotifyScanFinished(); } else { commandState = CommandStateType.ScanComplete; } }