public void Dispose() { _Context.RunAsync(() => { if (_JavascriptSessionInjector != null) { _JavascriptSessionInjector.Dispose(); _JavascriptSessionInjector = null; } }); }
public static async Task<IHTMLBinding> Bind(IHTMLWindow view, string iViewModel) { var context = view.MainFrame; var root = await context.EvaluateAsync(() => { var json = context.GetGlobal().GetValue("JSON"); return json.Invoke("parse", context, context.Factory.CreateString(iViewModel)); }); var injector = new JavascriptSessionInjector(context, null); var mappedroot = injector.Map(root, null); await injector.RegisterInSession(mappedroot); return new StringBinding(context, mappedroot, injector); }
public void Dispose() { WebCore.QueueWork(() => { if (_CleanUp != null) { _CleanUp(); _CleanUp = null; } if (_JavascriptSessionInjector != null) { _JavascriptSessionInjector.Dispose(); _JavascriptSessionInjector = null; } } ); }
public static Task <IAwesomeBinding> Bind(IWebView view, string iViewModel, Action First = null, Action CleanUp = null) { TaskCompletionSource <IAwesomeBinding> tcs = new TaskCompletionSource <IAwesomeBinding>(); view.ExecuteWhenReady(() => { if (First != null) { First(); } JSObject json = view.ExecuteJavascriptWithResult("JSON"); var root = json.Invoke("parse", new JSValue(iViewModel)); var injector = new JavascriptSessionInjector(view, new GlobalBuilder(view, "MVVMGlue"), null); var mappedroot = injector.Map(root, null); injector.RegisterInSession(mappedroot); tcs.SetResult(new StringBinding(mappedroot, injector, CleanUp)); }); return(tcs.Task); }
internal StringBinding(JSObject root, JavascriptSessionInjector iJavascriptSessionInjector, Action CleanUp) { _JavascriptSessionInjector = iJavascriptSessionInjector; _CleanUp = CleanUp; _Root = root; }
internal StringBinding(IWebView context, IJavascriptObject root, JavascriptSessionInjector iJavascriptSessionInjector) { _JavascriptSessionInjector = iJavascriptSessionInjector; _Context = context; _Root = root; }