also catch InvalidDataFormatException because let's be honest, there's nothing we can do at that point

This commit is contained in:
Michael Becker 2020-01-23 03:38:40 -05:00
parent 39b913897d
commit 991cde070c
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -527,6 +527,28 @@ namespace UniversalEditor.UserInterface
}
return;
}
catch (InvalidDataFormatException ex)
{
// we're catching this one because there's nothing anyone (not even the developer) can do about it if the DF throws ObjectModelNotSupported
DialogResult result = MessageDialog.ShowDialog("The data format you specified could not load the file.", "Error", MessageDialogButtons.RetryCancel, MessageDialogIcon.Error);
if (result == DialogResult.Retry)
{
DocumentPropertiesDialog dlg = new DocumentPropertiesDialog();
dlg.DataFormat = doc.DataFormat;
dlg.ObjectModel = doc.ObjectModel;
dlg.Accessor = doc.Accessor;
if (dlg.ShowDialog() == DialogResult.OK)
{
doc.DataFormat = dlg.DataFormat;
doc.ObjectModel = dlg.ObjectModel;
doc.Accessor = dlg.Accessor;
}
// try loading it again
continue;
}
return;
}
catch (Exception ex)
{
if (!System.Diagnostics.Debugger.IsAttached)