public async Task ShowFileFormatErrorsAsync(AggregateException ex) { _isDialogVisible = true; var dialog = new FileFormatErrorDialog(); var dc = (BackupFileFormatErrorViewModel)dialog.DataContext; dc.Errors.Clear(); foreach (var e in ex.InnerExceptions) { if (e is BackupFileServicesException bex) { switch (e) { case WrongDatabaseVersionException dbVerEx: dc.Errors.Add(new FileFormatErrorListItem { Filename = dbVerEx.Filename, ErrorMsg = dbVerEx.Message }); break; case WrongManifestVersionException mftVerEx: dc.Errors.Add(new FileFormatErrorListItem { Filename = mftVerEx.Filename, ErrorMsg = mftVerEx.Message }); break; default: dc.Errors.Add(new FileFormatErrorListItem { Filename = "Error", ErrorMsg = bex.Message }); break; } } } await DialogHost.Show( dialog, (object sender, DialogClosingEventArgs args) => { _isDialogVisible = false; }).ConfigureAwait(false); }
public async Task ShowFileFormatErrorsAsync(AggregateException ex) { _isDialogVisible = true; var dialog = new FileFormatErrorDialog(); var dc = (BackupFileFormatErrorViewModel)dialog.DataContext; dc.Errors.Clear(); foreach (var e in ex.InnerExceptions) { if (e is BackupFileServicesException bex) { switch (e) { case WrongDatabaseVersionException dbVerEx: EventTracker.TrackWrongVer(dbVerEx.FoundVersion, dbVerEx.ExpectedVersion); dc.Errors.Add(new FileFormatErrorListItem(dbVerEx.Filename ?? "Error", dbVerEx.Message)); break; case WrongManifestVersionException mftVerEx: EventTracker.TrackWrongManifestVer(mftVerEx.FoundVersion, mftVerEx.ExpectedVersion); dc.Errors.Add(new FileFormatErrorListItem(mftVerEx.Filename ?? "Error", mftVerEx.Message)); break; default: EventTracker.Error(bex, "Importing file"); dc.Errors.Add(new FileFormatErrorListItem("Error", bex.Message)); break; } } } await DialogHost.Show( dialog, (object sender, DialogClosingEventArgs args) => _isDialogVisible = false).ConfigureAwait(false); }