Skip to content

Commit

Permalink
Merge pull request #230 from tonyhallett/fix-invokescript-unknown-name
Browse files Browse the repository at this point in the history
wrap invokeScript in try/catch
  • Loading branch information
tonyhallett authored Feb 15, 2022
2 parents 1571c6c + 225034b commit 6a2822c
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions SharedProject/Output/OutputToolWindowControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,8 @@ public OutputToolWindowControl(ScriptManager scriptManager,IFCCEngine fccEngine)
});
};


this.fccEngine = fccEngine;
}
}

protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
{
Expand All @@ -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;
}
Expand Down

0 comments on commit 6a2822c

Please sign in to comment.