Esempio n. 1
0
        /// <summary>
        /// Calls a similar method depending on browser type
        /// </summary>
        /// <param name="wSkype"></param>
        /// <param name="browserData"></param>
        private void WebSkypeStructRefresh(ref WebSkypeStruct wSkype, InternetBrowserData browserData)
        {
            switch (browserData.Browser)
            {
            case InternetBrowser.GoogleChrome:
                GoogleChromeSet.WebSkypeStructRefresh(ref webSkypeStruct, browserData);
                break;

            case InternetBrowser.Opera:
                OperaSet.WebSkypeStructRefresh(ref webSkypeStruct, browserData);
                break;

            case InternetBrowser.Firefox:
                //FirefoxSet.WebSkypeStructRefresh(ref webSkypeStruct, browserData);
                break;

            case InternetBrowser.TorBrowser:
                //TorBrowserSet.WebSkypeStructRefresh(ref webSkypeStruct, browserData);
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Calls a similar method depending on browser type
        /// </summary>
        /// <param name="wSkype"></param>
        private void WebSkypeStructToNull(ref WebSkypeStruct wSkype)
        {
            switch (browserData.Browser)
            {
            case InternetBrowser.GoogleChrome:
                GoogleChromeSet.WebSkypeStructToNull(ref wSkype);
                break;

            case InternetBrowser.Opera:
                OperaSet.WebSkypeStructToNull(ref wSkype);
                break;

            case InternetBrowser.Firefox:
                //FirefoxSet.WebSkypeStructToNull(ref wSkype);
                break;

            case InternetBrowser.TorBrowser:
                //TorBrowserSet.WebSkypeStructToNull(ref wSkype);
                break;
            }
        }
Esempio n. 3
0
        private void Opera(InternetBrowserData ibData)
        {
            IntPtr        initialForeground;
            string        windowName        = "";
            List <IntPtr> rootWindowsChrome = new List <IntPtr>();

            try
            {
                if (ibData.Process == null)
                {
                    return;
                }
                initialForeground = Interop.GetForegroundWindow();

                // check if skype tab or toggle window exists
                if (webSkypeStruct.windowHandle == IntPtr.Zero || OperaSet.WebSkypeIsNullOrEmpty(webSkypeStruct))
                {
                    if (!OperaSet.WebSkypeStructRefresh(ref webSkypeStruct, ibData))
                    {
                        return;
                    }
                }

                AutomationElement operaAE = AutomationElement.FromHandle(webSkypeStruct.windowHandle);
                windowName = operaAE.Current.Name;

                if (windowName.Contains("Skype - Opera") && Tools.WebSkypeOrNotifyWindowHandle(initialForeground, webSkypeStruct.windowHandle))
                {
                    Tools.RestoreMinimizedWindow(webSkypeStruct.windowHandle);
                    Interop.SetForegroundWindow(webSkypeStruct.windowHandle);
                    return;
                }
                if (windowName.Contains("Skype - Opera") && initialForeground != webSkypeStruct.windowHandle)
                {
                    if (atInstance.TabOrWindow == SwitchTo.Window)
                    {
                        Interop.SetForegroundWindow(atInstance.AltTabList[1]); //its a previus window in a list
                        Tools.RestoreMinimizedWindow(atInstance.AltTabList[1]);
                    }
                    //do nothing, we have an extension to switch between tabs
                    //ok just !(simulate mouse click) send ctrl+tab in to space
                    if (atInstance.TabOrWindow == SwitchTo.Tab)
                    {
                        Interop.PostMessage(webSkypeStruct.windowHandle, Const.WM_KEYDOWN, (IntPtr)WindowsVirtualKey.VK_CONTROL, (IntPtr)0x001D0001);
                        Interop.PostMessage(webSkypeStruct.windowHandle, Const.WM_KEYDOWN, (IntPtr)WindowsVirtualKey.VK_TAB, (IntPtr)0x000F0001);

                        Interop.PostMessage(webSkypeStruct.windowHandle, Const.WM_KEYUP, (IntPtr)WindowsVirtualKey.VK_TAB, (IntPtr)0xC00F0001);
                        Interop.PostMessage(webSkypeStruct.windowHandle, Const.WM_KEYUP, (IntPtr)WindowsVirtualKey.VK_CONTROL, (IntPtr)0xC01D0001);
                    }
                    return;
                }
                //situation if process is not foreground, and/or skype tab is not active
                //cant get SelectionItemPattern - http://stackoverflow.com/questions/22747613/control-pattern-availability-is-set-to-true-but-returns-unsupported-pattern-e
                //than simulate mouse click !
                Tools.RestoreMinimizedWindow(webSkypeStruct.windowHandle);
                Interop.SetForegroundWindow(webSkypeStruct.windowHandle);
                if (Tools.FullscreenProcess(webSkypeStruct.windowHandle))
                {
                    Interop.PostMessage(initialForeground, Const.WM_KEYDOWN, (IntPtr)WindowsVirtualKey.VK_ESCAPE, IntPtr.Zero);
                    Interop.PostMessage(initialForeground, Const.WM_KEYUP, (IntPtr)WindowsVirtualKey.VK_ESCAPE, IntPtr.Zero);
                    Thread.Sleep(50); // пауза ( на быстрых пк не успевает свернуться интерфейс, а условие необходимо для клика мыши по вкладке
                }
                Tools.SimulateClickUIAutomation(webSkypeStruct.skypeTab, operaAE, webSkypeStruct.windowHandle);

                if (initialForeground != webSkypeStruct.windowHandle)
                {
                    if (!Tools.NotWebSkypeButNotifyWindowHandle(initialForeground, webSkypeStruct.windowHandle))
                    {
                        Thread.Sleep(100); //задержка, для того, чтобы успел сработать обработчик события, который среагирует на переключение вкладки
                        atInstance.TabOrWindow = SwitchTo.Window;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                //testWatchTime = testWatch.Elapsed;
                //testWatch.Stop();
                //Console.WriteLine(testWatchTime.ToString());
                Thread.Sleep(50);
                threadHwnd = IntPtr.Zero;
            }
        }