From 977fd038f83ea9cb690ef8bc3bb730c1181e7e0d Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sat, 4 Jan 2020 21:14:03 -0500 Subject: [PATCH] give us a chance to retry if something went wrong --- .../MainWindow.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs b/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs index c40ce5c7..ae6c3eb6 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/MainWindow.cs @@ -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();