give us a chance to retry if something went wrong

This commit is contained in:
Michael Becker 2020-01-04 21:14:03 -05:00
parent a24cb40a6e
commit 977fd038f8
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -506,7 +506,7 @@ namespace UniversalEditor.UserInterface
Console.WriteLine("found {0} editors for object model {1}", editors.Length.ToString(), doc.ObjectModel.ToString());
if (editors.Length > 0)
{
if (!loaded)
while (!loaded)
{
try
{
@ -521,6 +521,19 @@ namespace UniversalEditor.UserInterface
DialogResult result = MessageDialog.ShowDialog("The object model you specified is not supported by the selected DataFormat.", "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;
}
@ -538,10 +551,7 @@ namespace UniversalEditor.UserInterface
}
}
}
else
{
// no need to open and load file, it's already been done
}
Editor editor = editors[0].Create();
EditorPage page = new EditorPage();