Пример #1
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            webView.SetCspCheckEnable(false);
            webView.CookieEnabled = true;
            webView.NavigationToNewWindowEnable = false;

            webView.OnTitleChange += new EventHandler <TitleChangeEventArgs>(OnWebViewTitleChange);
            //webView.OnURLChange += new EventHandler<UrlChangeEventArgs>(OnWebViewURLChange);
            //webView.OnLoadingFinish += new EventHandler<LoadingFinishEventArgs>(OnWebViewLoadingFinish);
            //webView.OnLoadUrlBegin += new EventHandler<LoadUrlBeginEventArgs>(OnWebViewLoadUrlBegin);
            //webView.OnDocumentReady += new EventHandler<DocumentReadyEventArgs>(OnWebViewDocumentReady);
            //webView.OnDownload += new EventHandler<DownloadEventArgs>(OnWebViewDownload);

            #region BindFunction
            JsValue.BindFunction("OnLogin", new wkeJsNativeFunction(OnLogin), 2);
            JsValue.BindFunction("OnLogout", new wkeJsNativeFunction(OnLogout), 0);
            JsValue.BindGetter("ServerUri", new wkeJsNativeFunction(GetServerUri));
            JsValue.BindGetter("Token", new wkeJsNativeFunction(GetToken));
            JsValue.BindSetter("Token", new wkeJsNativeFunction(SetToken));
            JsValue.BindFunction("Dial", new wkeJsNativeFunction(OnDial), 3);
            #endregion

            //var devToolPath ="file:///" + (Application.StartupPath + @"\front_end\inspector.html").Replace("\\","/");
            var devToolPath = "file:///D:/test/miniblinknet/Demo/bin/Debug/front_end/inspector.html";
            //webView.SetDebugConfig("showDevTools", devToolPath);
            //webView.ShowDevtools(devToolPath, null, IntPtr.Zero);
            //webView.LoadFile(@"Assets\pages\login.html");
            webView.LoadFile(@"Assets\pages\login.html");

            vpxWindow = new VPXWindow();
            toolbar   = new MFWToolBar();
            toolbar.BindPanel(vpxWindow.pnlContainer);
            MFWCore.MFWEvent += MFWEventHandle;

            deviceManager.PropertyChanged += OnPropertyChangedEventHandler;

            var userName = "******";
            var pwd      = "123456789";
            MFWCore.Register(SipServer, userName, pwd, vpxWindow.pnlContainer);
        }
Пример #2
0
        public BlinkBrowser()
        {
            this.webBrowser   = new WebView();
            this.FormClosing += Form_FormClosing;
            this.webBrowser.Bind(this.panel1, false);
            GlobalForScript tg = new GlobalForScript(this);

            JsValue.BindGetter("external", new wkeJsNativeFunction(tg.js_load));
            this.webBrowser.DragDropEnable = false;
            this.webBrowser.DragEnable     = false;
            this.webBrowser.CookieEnabled  = false;
            this.webBrowser.NavigationToNewWindowEnable = true;
            this.webBrowser.TouchEnable = false;
            this.webBrowser.SetCspCheckEnable(false);
            this.webBrowser.NpapiPluginsEnabled = false;
            this.mq             = new Queue <string>();
            this.timer          = new Timer();
            this.timer.Interval = 100;
            this.timer.Enabled  = true;

            this.timer.Tick += (sender, e) =>
            {
                try
                {
                    if (mq.Count > 0)
                    {
                        var script = mq.Dequeue();
                        this.webBrowser.RunJS(script);
                    }
                    //this.timer.Stop();
                }
                catch (Exception ex)
                {
                    Log.WriteLog("Error", ex.Message);
                }
            };
            this.timer.Start();
        }