예제 #1
0
        //private readonly DownloadHandler _downloadHandler;

        public CefWebClient(CefWebBrowser core)
        {
            _core               = core;
            _lifeSpanHandler    = new CefWebLifeSpanHandler(_core);
            _displayHandler     = new CefWebDisplayHandler(_core);
            _loadHandler        = new CefWebLoadHandler(_core);
            _requestHandler     = new CefWebRequestHandler(_core);
            _keyboardHandler    = new CefWebKeyboardHandler(_core);
            _downloadHandler    = new CefWebDownloadHandler(_core);
            _contextMenuHandler = new CefWebContextMenuHandler(_core);
            _resourceHandler    = new CefWebResourceHandler();
        }
예제 #2
0
        private static Color offSelectedColor = Color.FromArgb(160, 160, 160); //标签未选中时的颜色

        /// <summary>
        /// 刷新当前浏览器
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="_core"></param>
        public static void ReflashBrowser(CefBrowser browser, CefWebBrowser _core)
        {
            MainForm.Instance.Invoke(new Action(() =>
            {
                MainForm.Instance.faTabStrip1.SelectedItem.BrowserIsLoading = true;
                MainForm.Instance.faTabStrip1.SelectedItem.Title            = "加载中...";
                if (_core.Browser.IsLoading)
                {
                    _core.Browser.StopLoad();
                }
                browser.GetMainFrame().LoadUrl(MainForm.Instance.faTabStrip1.SelectedItem.URL.Trim());
            }
                                                ));
        }
예제 #3
0
 /// <summary>
 /// 打开或者关闭DevTools
 /// </summary>
 /// <param name="_core"></param>
 /// <param name="browser"></param>
 public static void DevTools(CefWebBrowser _core, CefBrowser browser)
 {
     MainForm.Instance.Invoke(new Action(() =>
     {
         if (!_core.DevToolsOpen)
         {
             if (MainForm.Instance.faTabStrip1.SelectedItem.DevToolsName == null || MainForm.Instance.faTabStrip1.SelectedItem.DevToolsName == string.Empty)
             {
                 CefWindowInfo CefWindowInfo1;
                 int devWidth = MainForm.Instance.faTabStrip1.SelectedItem.Width;
                 MainForm.Instance.faTabStrip1.SelectedItem.splic.Panel1.AutoScroll = true;
                 MainForm.Instance.faTabStrip1.SelectedItem.splic.Panel2.AutoScroll = true;
                 MainForm.Instance.faTabStrip1.SelectedItem.splic.Panel2Collapsed   = false;
                 MainForm.Instance.faTabStrip1.SelectedItem.Tag = _core;
                 CefWindowInfo1         = CefWindowInfo.Create();
                 CefWindowInfo1.X       = devWidth / 2;
                 CefWindowInfo1.Y       = 0;
                 CefRectangle rectangle = new CefRectangle(0, 0, devWidth / 2, _core.Height);
                 //此举是为了多个Devtools打开的情况,要让后面的FindwindowEX函数能找到这个窗口的句柄
                 MainForm.Instance.faTabStrip1.SelectedItem.DevToolsName = "CefDevTools" + DateTime.Now.ToString("yyyyMMddHHmmss");
                 CefWindowInfo1.SetAsWindow(MainForm.Instance.faTabStrip1.SelectedItem.splic.Panel2.Handle, rectangle, MainForm.Instance.faTabStrip1.SelectedItem.DevToolsName);
                 browser.GetHost().ShowDevTools(CefWindowInfo1, new DevFormClient(), new CefBrowserSettings(), new CefPoint(0, 0));
                 browser.GetHost().SetFocus(true);
                 _core.DevToolsOpen = MainForm.Instance.faTabStrip1.SelectedItem.DevToolsOpen = true;
                 MainForm.Instance.faTabStrip1.SelectedItem.ItemBrowser     = browser;
                 MainForm.Instance.faTabStrip1.SelectedItem.splic.BackColor = SystemColors.ControlDark;
             }
             else
             {
                 MainForm.Instance.faTabStrip1.SelectedItem.splic.Panel2Collapsed = false;
                 _core.DevToolsOpen = MainForm.Instance.faTabStrip1.SelectedItem.DevToolsOpen = true;
                 MainForm.Instance.faTabStrip1.SelectedItem.ItemBrowser = browser;
             }
         }
         else
         {
             MainForm.Instance.faTabStrip1.SelectedItem.splic.Panel2Collapsed = true;
             _core.DevToolsOpen = MainForm.Instance.faTabStrip1.SelectedItem.DevToolsOpen = false;
             //_core = null;
             MainForm.Instance.faTabStrip1.SelectedItem.ItemBrowser = null;
             // MainForm.Instance.faTabStrip1.SelectedItem.DevToolsName = null;
             ResizeWindow(browser.GetHost().GetWindowHandle(), MainForm.Instance.faTabStrip1.SelectedItem.Width, MainForm.Instance.faTabStrip1.SelectedItem.Height);
             GC.Collect();
         }
     }));
 }
예제 #4
0
 public CefWebContextMenuHandler(CefWebBrowser core)
 {
     _core = core;
 }
 public TitleChangedEventArgs(string title, CefWebBrowser browser)
 {
     Title  = title;
     CefWeb = browser;
 }
예제 #6
0
 public CefWebLifeSpanHandler(CefWebBrowser core)
 {
     _core = core;
 }
예제 #7
0
 public CefWebDisplayHandler(CefWebBrowser core)
 {
     _core = core;
 }
예제 #8
0
 // public string _directory = "Temp/";
 //  private Dictionary<UInt64, MemoryStreamResponseFilter> responseDictionary = new Dictionary<UInt64, MemoryStreamResponseFilter>();
 public CefWebRequestHandler(CefWebBrowser core) : base()
 {
     _core            = core;
     _requestHeandler = this;
 }
예제 #9
0
 public AddressChangedEventArgs(CefFrame frame, string address, CefWebBrowser browser)
 {
     Address = address;
     Frame   = frame;
     CefWeb  = browser;
 }
예제 #10
0
 public CefWebLoadHandler(CefWebBrowser core)
 {
     _core = core;
 }
 public CefWebRenderProcessHandler(CefWebBrowser core)
 {
     _core = core;
 }
예제 #12
0
 public CefWebKeyboardHandler(CefWebBrowser core)
 {
     _core = core;
 }