close Accessor before we attempt to retry so it loads from the beginning next time

This commit is contained in:
Michael Becker 2020-08-31 20:19:52 -04:00
parent d185b83fa8
commit 01c659db7f
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -552,6 +552,8 @@ namespace UniversalEditor.UserInterface
}
catch (InvalidDataFormatException ex)
{
doc.Accessor.Close();
// we're catching this one because there's nothing anyone (not even the developer) can do about it if the DF throws ObjectModelNotSupported
// TODO: For DataFormats that support it (i.e. Layout-based) we should be able to "debug" the DataFormat to find out exactly where it failed
DialogResult result = MessageDialog.ShowDialog("The data format you specified could not load the file.", "Error", MessageDialogButtons.RetryCancel, MessageDialogIcon.Error);
@ -561,6 +563,7 @@ namespace UniversalEditor.UserInterface
dlg.DataFormat = doc.DataFormat;
dlg.ObjectModel = doc.ObjectModel;
dlg.Accessor = doc.Accessor;
if (dlg.ShowDialog() == DialogResult.OK)
{
doc.DataFormat = dlg.DataFormat;