async void onFsToDb(object x) { ExceptionMsg = $"Checking \"{TrgFolder}\" for new & missing files ... "; Bpr.BeepOk(); var progressHandler = new Progress <string>(value => { ExceptionMsg = value; }); var progress = progressHandler as IProgress <string>; var sw = Stopwatch.StartNew(); var task = new FileSysProcessor().FsToDb(_db, TrgFolder, progress); await task; ExceptionMsg = $"{task.Result} new rows added in {sw.Elapsed:m\\:ss}, final status: {task.Status}. "; }
async void player_MediaFailed(object sender, System.Windows.ExceptionRoutedEventArgs e) { var now = DateTime.Now; var exm = e.ErrorException.InnermostMessage(); ExceptionMsg = $"MediaFailed: {exm}"; CurMediaUnit.GenreID = 15; // exception: do not play next time ...until deliberately selected and fixed. if (CurMediaUnit.Notes == null || !CurMediaUnit.Notes.Contains(exm)) { var len = (CurMediaUnit.Notes == null ? 0 : CurMediaUnit.Notes.Length); var errmsg = $" {now} {exm} "; if (errmsg.Length < (1024 - len)) { CurMediaUnit.Notes += $" {now} {exm} "; } else if (200 > (1024 - len)) { CurMediaUnit.Notes += $" {now} {exm} ".Substring(0, 199); } } if (!File.Exists(CurMediaUnit.PathFileExtOrg)) { if (File.Exists(CurMediaUnit.PathFileExtOrg.ToLower().Replace("m:\\", "c:\\1\\m\\"))) { _player.Source = new Uri(CurMediaUnit.PathFileExtOrg = CurMediaUnit.PathFileExtOrg.ToLower().Replace("m:\\", "c:\\1\\m\\")); saveAllToDb_Speak(); ExceptionMsg = $"MediaFailed: SOLVED: renamed M:\\ to C:\\1\\M\\ {_player.Source.LocalPath} "; await Task.Delay(500); synth.Speak("Restarting..."); playAndStartCounters(); return; } ExceptionMsg = string.Format("MediaFailed: File does not exist; marking that in DB. "); CurMediaUnit.DeletedAt = now; CurMediaUnit.Notes = FileSysProcessor.SAfeAddNote(CurMediaUnit, $" Found missing trying to play on {now.ToShortDateString()}."); } saveAllToDb_Speak(); if (canMoveNext) { onMoveNext(null); playAndStartCounters(); } }