Esempio n. 1
0
 private void systemProcessHook_WindowEvent(object sender, IntPtr handle, Interop.ShellEvents shell)
 {
     if (shell == Interop.ShellEvents.HSHELL_WINDOWDESTROYED)
     {
         if (altTabList.Remove(handle))
         {
             Console.WriteLine("hwnd:{0}, title:{1} removed. altTabList cound ={2}", handle.ToString(), WowDisableWinKeyTools.GetWindowTitle(handle), altTabList.Count.ToString());
         }
     }
     if (shell == Interop.ShellEvents.HSHELL_WINDOWCREATED && OpenWindowGetter.KeepWindowHandleInAltTabList(handle))
     {
         altTabList.Insert(0, handle);
         Console.WriteLine("hwnd:{0}, title:{1} inserted. altTabList cound ={2}", handle.ToString(), WowDisableWinKeyTools.GetWindowTitle(handle), altTabList.Count.ToString());
         tabOrWindow = SwitchTo.Window;
     }
 }
Esempio n. 2
0
        private void HookManager_ForegroundChanged(object sender, EventArgs e)
        {
            bool   newWindow = true;
            IntPtr fore      = (IntPtr)sender;

            try
            {
                // try to find new foreground window in alt tab list
                foreach (IntPtr hWnd in altTabList)
                {
                    if (hWnd == fore)
                    {
                        newWindow = false;
                        break;
                    }
                }
                //Thread.Sleep(10);
                //if (newWindow && OpenWindowGetter.KeepWindowHandleInAltTabList(fore))
                //{
                //    altTabList.Insert(0, fore);
                //    Console.WriteLine(WowDisableWinKeyTools.GetWindowTitle(fore) + " " + fore.ToString());
                //}
                if (!newWindow)
                {
                    IntPtr windowHWnd = altTabList.Find(x => x == fore);
                    if (windowHWnd != IntPtr.Zero)
                    {
                        altTabList.Remove(windowHWnd);
                        altTabList.Insert(0, windowHWnd);
                        tabOrWindow = SwitchTo.Window;
                    }
                }
                //check if window exists, remove from list if not
            }
            catch { }
        }
Esempio n. 3
0
 public ActionItemSwitchEventArgs(SwitchTo switchTo)
 {
     this.SwitchTo = switchTo;
 }
Esempio n. 4
0
 public static void SwitchToLastWindow()
 {
     SwitchTo.Window(Driver.WindowHandles.Last());
 }
Esempio n. 5
0
 public static void SwitchToDefaultWindow()
 {
     SwitchTo.Window(Driver.WindowHandles.First());
 }
Esempio n. 6
0
 public static void SwitchToPrevious()
 {
     SwitchTo.ParentFrame();
 }
Esempio n. 7
0
 public static void SwitchToIframe(IWebElement iframe)
 {
     SwitchTo.Frame(iframe);
 }