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; }