From 225034b20d46cdd6aa0240e3e0f84ef36e8cab90 Mon Sep 17 00:00:00 2001 From: Tony Hallett Date: Tue, 15 Feb 2022 11:36:16 +0000 Subject: [PATCH] wrap invokeScript in try/cacth --- .../Output/OutputToolWindowControl.xaml.cs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/SharedProject/Output/OutputToolWindowControl.xaml.cs b/SharedProject/Output/OutputToolWindowControl.xaml.cs index 2eb315b4..659cd72c 100644 --- a/SharedProject/Output/OutputToolWindowControl.xaml.cs +++ b/SharedProject/Output/OutputToolWindowControl.xaml.cs @@ -102,9 +102,8 @@ public OutputToolWindowControl(ScriptManager scriptManager,IFCCEngine fccEngine) }); }; - this.fccEngine = fccEngine; - } + } protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi) { @@ -114,23 +113,27 @@ protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi) private void OutputToolWindowControl_Loaded(object sender, RoutedEventArgs e) { - if (!hasLoaded) - { - if(FCCOutputBrowser.Document == null) - { - fccEngine.ReadyForReport(); - } - - hasLoaded = true; + if (!hasLoaded) + { + fccEngine.ReadyForReport(); FCCOutputBrowser.Visibility = Visibility.Visible; - } + hasLoaded = false; + } } public object InvokeScript(string scriptName, params object[] args) { if (FCCOutputBrowser.Document != null) { - return FCCOutputBrowser.InvokeScript(scriptName, args); + try + { + // Can use FCCOutputBrowser.IsLoaded but + // it is possible for this to be successful when IsLoaded false. + return FCCOutputBrowser.InvokeScript(scriptName, args); + } + catch { + // todo what to do about missed + } } return null; }