コード例 #1
0
        public static API_Chrome_Hijack hijack_Chrome(this API_Chrome_Hijack chromeHijack, Panel targetPanel, bool hijackJustViewer)
        {
            if (chromeHijack.notNull() && chromeHijack.ChromeProcess.notNull() && targetPanel.notNull())
            {
                chromeHijack.Panel_Chrome = targetPanel;
                var hijackGui = chromeHijack.Panel_Chrome.add_Handle_HijackGui(false);
                if (hijackJustViewer)
                {
                    hijackGui.hijackProcessWindow(chromeHijack.ChromeProcess,
                                                  (mainWindowHandle) =>
                    {
                        // this doesn't work well now since the main chrome window (with the address bar) still gains focus)
                        // need to look at how to capture and filter events from the child to the parent (and vice versa)
                        //
                        var targetWindow = mainWindowHandle.child_Windows().second();
                        return(targetWindow);

                        //return mainWindowHandle;  // for now hijack the whole thing
                    });
                }
                else
                {
                    hijackGui.hijackProcessMainWindow(chromeHijack.ChromeProcess);
                }
            }
            return(chromeHijack);
        }
コード例 #2
0
 public static API_Chrome_Hijack hijack_ChromeDriver(this API_Chrome_Hijack chromeHijack, Panel targetPanel)
 {
     if (chromeHijack.notNull() && chromeHijack.ChromeDriverProcess.notNull() && targetPanel.notNull())
     {
         chromeHijack.Panel_ChromeDriver = targetPanel;
         chromeHijack.Panel_ChromeDriver.add_Handle_HijackGui(false)
         .hijackProcessMainWindow(chromeHijack.ChromeDriverProcess);
     }
     return(chromeHijack);
 }