Пример #1
0
        public bool waitForWindowToAppear(string windowText, int seconds)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            while (true)
            {
                if ((stopWatch.Elapsed.TotalSeconds > seconds))
                {
                    return(false);
                }

                OpenWindows so     = new OpenWindows();
                string[]    titles = so.GetDesktopWindowsCaptions();

                foreach (string title in titles)
                {
                    if (title == windowText)
                    {
                        return(true);
                    }
                }
            }
        }
Пример #2
0
        public bool isLoggedIn(int wait = 0)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            while (true)
            {
                OpenWindows so     = new OpenWindows();
                string[]    titles = so.GetDesktopWindowsCaptions();

                foreach (string title in titles)
                {
                    if (title.Contains("Main Lobby") && title.Contains("Poker Texas Hold'em"))
                    {
                        return(true);
                    }
                }

                if (stopWatch.Elapsed.TotalSeconds > wait)
                {
                    return(false);
                }
            }
        }