示例#1
0
        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);
        }
示例#2
0
        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);
        }