public void ExecuteScript(System.Reflection.Assembly scriptAssembly, ESAPIX.Facade.API.ScriptContext scriptContext, System.Windows.Window window) { if ((XC.Instance.CurrentContext) != (null)) { XC.Instance.CurrentContext.Thread.Invoke(() => { _client.ExecuteScript(scriptAssembly, scriptContext._client, window); } ); } else { _client.ExecuteScript(scriptAssembly, scriptContext, window); } }
public void Execute(ScriptContext context, Window window) { var scriptContext = new ESAPIX.Facade.API.ScriptContext(context); //When hooked up to bootstrapper (comment out otherwise) FacadeInitializer.Initialize(); //Get this window barely visible so that when it does show, it isn't ugly ;) window.Height = window.Width = 0; window.WindowStyle = WindowStyle.None; window.Hide(); window.Loaded += Window_Loaded; var plugCtx = new PluginContext(scriptContext, window); var frame = new DispatcherFrame(); XContext.Instance.CurrentContext = plugCtx; XExecute(plugCtx, frame); Dispatcher.PushFrame(frame); }