예제 #1
0
파일: Timing.cs 프로젝트: saveenr/saveenr
		public static bool WaitForCondition( IWaitClient client, int timeout, int interval, out int elapsed)
		{
			elapsed=0;
			client.WaitCallback(WaitState.begin_state,0);
			StopWatch watch = new StopWatch();
			watch.Start();
			bool success=false;
			while ( watch.ElapsedMiliseconds  <= timeout)
			{
				if ( client.StopWaiting() == true )
				{
					client.WaitCallback(WaitState.finished_state , watch.ElapsedMiliseconds  );
					success=true;
					break;
				}
				System.Threading.Thread.Sleep( interval);
				client.WaitCallback(WaitState.interval_state , watch.ElapsedMiliseconds );
			}
			client.WaitCallback(WaitState.timeout_state ,watch.ElapsedMiliseconds );
			return success;
		}
예제 #2
0
        public static bool WaitForCondition(IWaitClient client, int timeout, int interval, out int elapsed)
        {
            elapsed = 0;
            client.WaitCallback(WaitState.begin_state, 0);
            StopWatch watch = new StopWatch();

            watch.Start();
            bool success = false;

            while (watch.ElapsedMiliseconds <= timeout)
            {
                if (client.StopWaiting() == true)
                {
                    client.WaitCallback(WaitState.finished_state, watch.ElapsedMiliseconds);
                    success = true;
                    break;
                }
                System.Threading.Thread.Sleep(interval);
                client.WaitCallback(WaitState.interval_state, watch.ElapsedMiliseconds);
            }
            client.WaitCallback(WaitState.timeout_state, watch.ElapsedMiliseconds);
            return(success);
        }
예제 #3
0
파일: UI.cs 프로젝트: Avinash-acid/saveenr
        public static void Window_SetAsForegroundWindow(int hwnd)
        {
            WindowsAutomation.win32.SetForegroundWindow(hwnd);

            int  timeout = 3 * 1000;
            bool err     = true;

            Timing.StopWatch w1 = new Timing.StopWatch();
            w1.Start();
            while (w1.ElapsedMiliseconds < timeout)
            {
                if (WindowsAutomation.win32.GetForegroundWindow() == hwnd)
                {
                    err = false;
                    break;
                }
                System.Threading.Thread.Sleep(250);
            }

            if (err)
            {
                throw new Errors.AutomationError("Did not set FG window");
            }
        }
예제 #4
0
파일: UI.cs 프로젝트: saveenr/saveenr
		public static void Window_SetAsForegroundWindow( int hwnd )
		{
			WindowsAutomation.win32.SetForegroundWindow(hwnd);

			int timeout = 3 * 1000;
			bool err=true;
			Timing.StopWatch w1 = new Timing.StopWatch();
			w1.Start();
			while (w1.ElapsedMiliseconds < timeout )
			{
				if ( WindowsAutomation.win32.GetForegroundWindow() == hwnd )
				{
					err=false;
					break;
				}
				System.Threading.Thread.Sleep(250);
			}

			if (err)
			{
					throw new Errors.AutomationError( "Did not set FG window");
			}
		}