Using ScriptContext outside of Execute

Nov 5, 2014 at 4:40 AM
Can I use ScriptContext in other places outside of the default created Execute(ScriptContext...? For instance, if I want to build a user interface where the data from the plan is found on demand, I may want to have the user click a button. When they click that button, I want to get information about the plan (say the patient id) from the xaml.cs code-behind for that button. The problem is, because I have no available, I can't get that information.

Is there a way I can do this?

Nov 5, 2014 at 7:49 PM
You can add a new UserControl (WPF) to your project (for example, name it MainControl). Add a public property to it called Context of type ScriptContext. In the Execute method, create a new MainControl and set its Context property to the context variable. Add the MainControl to the Window object's layout (you get the Window object from the Execute method). Any event handlers for the controls in MainControl have access to the Context property.
Marked as answer by mcschmidt on 11/5/2014 at 5:45 PM
Nov 6, 2014 at 1:45 AM
Works great, Thanks!