public AwesomiumHTMLWindow(WebControl iWebControl)
        {
            _WebControl = iWebControl;
            _WebControl.SynchronousMessageTimeout = 0;
            _WebControl.ExecuteWhenReady(FireLoaded);
            _WebControl.ConsoleMessage += _WebControl_ConsoleMessage;
            _WebControl.Crashed += _WebControl_Crashed;

            MainFrame = new AwesomiumWebView(_WebControl);
        }
        public AwesomiumHTMLWindow(WebSession iSession, WebControl iWebControl)
        {
            _Session    = iSession;
            _WebControl = iWebControl;
            _WebControl.SynchronousMessageTimeout = 0;
            _WebControl.ExecuteWhenReady(FireLoaded);
            _WebControl.ConsoleMessage += _WebControl_ConsoleMessage;

            MainFrame = new AwesomiumWebView(_WebControl);
        }
        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 static Task<IAwesomeBinding> Bind(IWebView view, object iViewModel, object additional, JavascriptBindingMode iMode,
                                                    Action First, Action CleanUp)
        {
            TaskCompletionSource<IAwesomeBinding> tcs = new TaskCompletionSource<IAwesomeBinding>();

            view.ExecuteWhenReady(() =>
                    {
                        try 
                        { 
                            if (First != null) First();
                            var mapper = new BidirectionalMapper(iViewModel, view, iMode, additional);
                            mapper.Init().ContinueWith(_ => tcs.SetResult(new AwesomeBinding(mapper, CleanUp)));
                        }
                        catch (Exception e)
                        {
                            tcs.SetException(e);
                        }
                    });

            return tcs.Task;
        }
Beispiel #5
0
        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 static Task <IAwesomeBinding> Bind(IWebView view, object iViewModel, object additional, JavascriptBindingMode iMode,
                                                    Action First, Action CleanUp)
        {
            TaskCompletionSource <IAwesomeBinding> tcs = new TaskCompletionSource <IAwesomeBinding>();

            view.ExecuteWhenReady(() =>
            {
                try
                {
                    if (First != null)
                    {
                        First();
                    }
                    var mapper = new BidirectionalMapper(iViewModel, view, iMode, additional);
                    mapper.Init().ContinueWith(_ => tcs.SetResult(new AwesomeBinding(mapper, CleanUp)));
                }
                catch (Exception e)
                {
                    tcs.SetException(e);
                }
            });

            return(tcs.Task);
        }