예제 #1
0
		private static void WaitForProtectDialog_EscapeKey(object nTimeOut)
		{
			try
			{
				WindowEnumerator we = new WindowEnumerator();
				int nTimeStep = Convert.ToInt32(nTimeOut);
				nTimeStep /= 20;
				if (nTimeStep < 10)
					nTimeStep = 10;

				// with the new interesting UI we need to wait for it to get there
				// or it will just swallow the button click
				Thread.Sleep(10000);
				for (int iLoop = 0; iLoop < 20; ++iLoop)
				{
					Thread.Sleep(nTimeStep);

					we.CollectWindowDetails();
					if (we.ProtectDialogIsShowing())
					{
						if (we.PressEscapeKey())
							s_eBackgroundProcessing = enumBackgroundProcessing.complete;
						else
							s_eBackgroundProcessing = enumBackgroundProcessing.error;
						return;
					}
				}
				s_eBackgroundProcessing = enumBackgroundProcessing.timedout;
			}
			catch (System.Exception)
			{
				// This is a separate thread
				// Don't blow up the program with a nasty exception
			}
		}
예제 #2
0
		public bool BackgroundWaitForProtectDialog_PressEscapeKey(int nTimeOut)
		{
			if (enumBackgroundProcessing.busy == s_eBackgroundProcessing)
				return false;
			s_eBackgroundProcessing = enumBackgroundProcessing.busy;

			ParameterizedThreadStart workerStart = new ParameterizedThreadStart(WaitForProtectDialog_EscapeKey);
			Thread WorkerThread = new Thread(workerStart);
			WorkerThread.Name = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + ".WaitForProtectDialog_EscapeKey";
			WorkerThread.Start(nTimeOut);
			Thread.Sleep(100);
			return true;
		}