Exemplo n.º 1
0
 public void Reload(bool ignoreCache)
 {
     if (browser != null)
     {
         if (ignoreCache)
         {
             browser.ReloadIgnoreCache();
         }
         else
         {
             browser.Reload();
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Refreshes the view.
 /// </summary>
 /// <param name="ignoreCache">if set to <c>true</c> ignore cache.</param>
 private void RefreshView(bool ignoreCache)
 {
     if (CefBrowser != null)
     {
         Application.Current.InvokeOnMain(() =>
         {
             if (ignoreCache)
             {
                 CefBrowser.ReloadIgnoreCache();
             }
             else
             {
                 CefBrowser.Reload();
             }
         });
     }
 }
Exemplo n.º 3
0
        protected override bool OnKeyEvent(CefBrowser browser, CefKeyEvent keyEvent, IntPtr osEvent)
        {
            switch (keyEvent.WindowsKeyCode)
            {
            case (int)Keys.F12:
            {
                var host = browser.GetHost();
                var wi   = CefWindowInfo.Create();
                wi.SetAsPopup(IntPtr.Zero, "医汇通 - 开发调试工具");
                host.ShowDevTools(wi, new DevToolsWebClient(), new CefBrowserSettings());
                //var devToolsUrl = webBrowser.Browser.GetHost().GetDevToolsUrl(true);
                //var isShow = false;
                //foreach (Form field in Application.OpenForms)
                //{
                //    if (field.Text.EndsWith("开发调试工具"))
                //    {
                //        ((DevTools)field).LoadUrl(devToolsUrl);
                //        field.Activate();
                //        isShow = true;
                //    }
                //}
                //if (!isShow)
                //{
                //    var devtool = new DevTools(devToolsUrl);
                //    devtool.Size = new Size(this.Size.Width, devtool.Size.Height);
                //    var point = this.PointToScreen(new Point(0, 0));
                //    devtool.Location = new Point(point.X, point.Y + this.Size.Height - devtool.Size.Height);
                //    devtool.Show();
                //}
                break;
            }

            case (int)Keys.F5:
            {
                browser.ReloadIgnoreCache();
                break;
            }

            default:
                break;
            }
            return(base.OnKeyEvent(browser, keyEvent, osEvent));
        }