Skip to content

Commit 6a2822c

Browse files
authored
Merge pull request #230 from tonyhallett/fix-invokescript-unknown-name
wrap invokeScript in try/catch
2 parents 1571c6c + 225034b commit 6a2822c

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

SharedProject/Output/OutputToolWindowControl.xaml.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@ public OutputToolWindowControl(ScriptManager scriptManager,IFCCEngine fccEngine)
102102
});
103103
};
104104

105-
106105
this.fccEngine = fccEngine;
107-
}
106+
}
108107

109108
protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
110109
{
@@ -114,23 +113,27 @@ protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)
114113

115114
private void OutputToolWindowControl_Loaded(object sender, RoutedEventArgs e)
116115
{
117-
if (!hasLoaded)
118-
{
119-
if(FCCOutputBrowser.Document == null)
120-
{
121-
fccEngine.ReadyForReport();
122-
}
123-
124-
hasLoaded = true;
116+
if (!hasLoaded)
117+
{
118+
fccEngine.ReadyForReport();
125119
FCCOutputBrowser.Visibility = Visibility.Visible;
126-
}
120+
hasLoaded = false;
121+
}
127122
}
128123

129124
public object InvokeScript(string scriptName, params object[] args)
130125
{
131126
if (FCCOutputBrowser.Document != null)
132127
{
133-
return FCCOutputBrowser.InvokeScript(scriptName, args);
128+
try
129+
{
130+
// Can use FCCOutputBrowser.IsLoaded but
131+
// it is possible for this to be successful when IsLoaded false.
132+
return FCCOutputBrowser.InvokeScript(scriptName, args);
133+
}
134+
catch {
135+
// todo what to do about missed
136+
}
134137
}
135138
return null;
136139
}

0 commit comments

Comments
 (0)