void Awake() { if (instance == null) { instance = this; } }
private void TestPhysics() { var mesh = Actor.GetComponent <StaticMeshComponent>(); mesh.SimulatePhysics = true; mesh.IsGravityEnabled = true; //mesh.LocalPosition Vector socket = mesh.GetSocketLocation("Socket"); Vector impluse = new Vector(0.0f, 0.0f, 10000000.0f); /* Impluse * mesh.AddImpulse(impluse); * mesh.AddImpulseAtLocation(impluse, socket); * mesh.AddRadialImpulse(socket, 100000.0f, 100000.0f, RadialImpulseFalloff.MAX); */ mesh.AddForceAtLocation(impluse, socket); //mesh.AddRadialForce(socket, 1000000.0f, 1000000.0f, RadialImpulseFalloff.MAX); //mesh.AddTorque(impluse); TimerTest.DelayInvoke(1.0f, () => { Vector velocity = Vector.ZeroVector; //velocity = mesh.GetPhysicsLinearVelocity(); //velocity = mesh.GetPhysicsAngularVelocity(); //velocity = mesh.GetPhysicsLinearVelocityAtPoint(socket); //Log.Error("[PhysiscTest] get velocity:" + velocity); velocity = new Vector(0.0f, -1000000.0f, -100000.0f); mesh.SetPhysicsLinearVelocity(velocity); }); }
private void TestBPAnimation() { TimerTest.DelayInvoke(2, () => { this.SendEvent("SetHorseWoman", 1); TimerTest.DelayInvoke(5, () => { this.SendEvent("SetHorseWoman", 2); }); }); }
private void TestUI() { TimerTest.DelayInvoke(2, () => { this.SendEvent("SetTitle", "奇境森林"); }); TimerTest.DelayInvoke(4, () => { this.SendEvent("SetContent", "UIContent:奇境森林\r\n奇境森林\r\n奇境森林\r\n奇境森林\r\n奇境森林"); }); }
/// <summary> /// 测试加载关卡 /// </summary> private void TestLoadLevel() { Log.Error("[WorldTest] CurrentLevelName:" + World.GetCurrentLevel()); //要加载的窗口必须 窗口->关卡 菜单中注册 World.LoadStreamingLevel("SubMain"); TimerTest.DelayInvoke(5, () => { TestUnLoadLevel(); }); }
private void TestSimpleAnimation() { TimerTest.DelayInvoke(2, () => { this.SendEvent("Play"); TimerTest.DelayInvoke(5, () => { this.SendEvent("Pause"); }); }); }
/// <summary> /// 测试动态加载蓝图,路径以/开头表示根目录,然后输入文件的全路径 /// </summary> private void TestSpawnActor() { var trans = new Transform(); var actor = World.SpwanActor("Resources/Blueprints/Actor3_blueprint", ref trans); var cube = actor.GetComponentByTag <StaticMeshComponent>("Cube"); if (cube == null) { Log.Error("[WorldTest] cube is null"); } else { cube.Visible = true; cube.Activited = false; } var sphere = actor.GetComponentByTag <StaticMeshComponent>("Sphere"); if (sphere == null) { Log.Error("[WorldTest] sphere is null"); } else { sphere.Visible = true; sphere.Activited = false; } actor.Root.LocalPosition = new Vector(1000, 1000, 1000); actor.Root.LocalScale = new Vector(5, 5, 5); var seq = actor.Sequencer; if (seq == null) { Log.Error("[WorldTest] Sequencer is null"); } else { Log.Error("[WorldTest] Sequencer name:" + seq.GetType()); } var init = actor.GetMonoComponent() as InitTest; init.Activited = false; //测试初始化组件值,会在initialize之后调用,beginplay之前调用 init.TestValue = 100; init.SendEvent("TestEventInt", 1881); init.SendEvent("TestEventString", "string"); //actor.Destroy(); TimerTest.DelayInvoke(1.0f, () => { init.SendEvent("TestEventString", "timerstring"); }); }
public void TestMethod1() { // Arrange var logic = new TimerTest(); var container = new CompositionContainer(); // var loggerMock = new Mock<ILogger>(); //container.ComposeExportedValue<ILogger>(loggerMock.Object); container.ComposeParts(logic); // Test logic.StartTimer(); // Validate //loggerMock.Verify(logger => logger.Write(It.IsAny<string>()), Times.Once()); }
private void TestMovement() { if (Pawn == null) { Log.Error("[MovementTest] MyPawn is null"); } else { Controller con = Pawn.Controller; if (con == null) { Log.Error("[MovementTest] ai is null"); } else { TimerTest.DelayInvoke(5, () => { con.SimpleMoveToLocation(new Vector(1000.0f, 0, 0)); }); } } }
private void TestParticleSystem() { var particles = Actor.GetComponent <ParticleSystemComponent>(); if (particles == null) { Log.Error("[ParticleTest] particle is null"); } particles.RegParticleBurst(this); particles.RegParticleCollide(this); particles.RegParticleDeath(this); particles.RegParticleSpawn(this); particles.RegSystemFinished(this); particles.ActivateSystem(); TimerTest.DelayInvoke(5.0f, () => { particles.DeactivateSystem(); TimerTest.DelayInvoke(3.0f, () => { particles.ActivateSystem(); }); }); }
static int Main() { SimpleReadWriteThreadStaticTest.Run(42, "SimpleReadWriteThreadStatic"); ThreadStaticsTestWithTasks.Run(); if (ThreadTest.Run() != Pass) { return(Fail); } if (TimerTest.Run() != Pass) { return(Fail); } if (FinalizeTest.Run() != Pass) { return(Fail); } return(Pass); }
public bool WaitForPageLoad(int firstWait, int timeoutMs, bool needToLog) { TimerTest PageLoadTimer = new TimerTest(); Thread.Sleep(firstWait); if (timeoutMs < 0) { throw new Exception("wait time cannot be less than " + firstWait + " ms!"); } for (; PageLoadTimer.GetElapsedTime() < timeoutMs;) { string readyStateJsStr = "return document.readyState;"; var javaScriptExecutor = Instance as IJavaScriptExecutor; bool isReady = javaScriptExecutor.ExecuteScript(readyStateJsStr).Equals("complete"); if (isReady) { if (needToLog) { PageLoadTimer.Finish("Page Loaded in"); } return(true); } } if (needToLog) { PageLoadTimer.Finish("Page failed to load after"); } return(false); }
static void Test1() { //for (var i = 0; i < 10000; i++) //{ // var tt = new TimerTest(); // //Thread.Sleep(10); //} Parallel.For(0, 10000, async k => { var tt = new TimerTest(); //await Task.Delay(5000); }); for (var i = 0; i < 100; i++) { Console.WriteLine("_count={0}", _count); Thread.Sleep(1000); if (i == 5) { GC.Collect(); } } }
public void init() { print("UDPSend.init()"); port = 8052; clientCount = 4; IPS = new string[] { IP1, IP2, IP3, IP4 }; //ResetIPOrder(regenIPList); // two time intervals; timeInterval = new int[] { 800, 800, 50, 50 }; //remoteEndpoint array remoteEndPoints = new IPEndPoint[clientCount]; for (int i = 0; i < clientCount; i++) { remoteEndPoints[i] = new IPEndPoint(IPAddress.Parse(IPS[i]), port); } //clients array clients = new UdpClient[clientCount]; for (int i = 0; i < clientCount; i++) { clients[i] = new UdpClient(); } // timers array timers = new TimerTest[clientCount]; for (int i = 0; i < clientCount; i++) { timers[i] = new TimerTest(); } foreach (TimerTest timer in timers) { timer.AddListener(this); } }
static int Main() { SimpleReadWriteThreadStaticTest.Run(42, "SimpleReadWriteThreadStatic"); // TODO: After issue https://github.com/dotnet/corert/issues/2695 is fixed, move FinalizeTest to run at the end if (FinalizeTest.Run() != Pass) { return(Fail); } ThreadStaticsTestWithTasks.Run(); if (ThreadTest.Run() != Pass) { return(Fail); } if (TimerTest.Run() != Pass) { return(Fail); } return(Pass); }
/// <summary> /// Find Web Element. /// If element is not ready by Await parameter or absent on the page, it will be seached in period of time configured in paramsLib /// </summary> /// <param name="by">Configure by what need to search web element</param> /// <param name="awaitFor">Await.Visible() or Await.Visible(1000 -- like timeout)</param> /// <returns>element wrapper "ElemType"</returns> public ElemType Elem(BaseClasses.By by, Await awaitFor) { TimerTest timer = new TimerTest(); ElemType elType = new ElemType(this); if (awaitFor.TimeOut < 0) { throw new Exception("Wait period cannot be less than 0"); } if (awaitFor.Value == string.Empty) { elType = FindIfrElement(by); if (!elType.IsNull) { return(elType); } } for (; timer.GetElapsedTime() < awaitFor.TimeOut;) { ElemType webElement = FindIfrElement(by); if (IsElementReady(webElement, awaitFor)) { timer.Finish("Element changed status to ready in "); return(webElement); } } timer.Finish("Element wasnt changed it's status to requested in "); return(elType); }
public static void Main(){ TimerTest test = new TimerTest(); Console.WriteLine("The timer has started and will count for five seconds."); test.timerevent.WaitOne(); Console.WriteLine("...and control returned to the primary thread."); }
// // This routine is a sample of what a performance and capacity planning trace // provider will do to generate ETW traces. // static void PerfTracingSample(int eventCount, int argCount, bool bString) { uint i; uint Status; Int64 AvgTime; int arg1 = 3276; int arg2 = 56797; Guid TransactionGuid = new Guid("{b4955bf0-3af1-4740-b475-99055d3fe9aa}"); Console.WriteLine("Perf Tracing Sample running"); TimerTest MyTimer = new TimerTest(); WinTraceProvider MyProvider = new WinTraceProvider(new Guid("{98bea4af-ef37-424a-b457-9ea1cfd77dd9}")); MyTimer.Start(); for (i = 0; i < eventCount; i++) { if (MyProvider.enabled) { if (!bString) { switch (argCount) { case 0: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start); break; case 1: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1); break; case 2: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1, arg2); break; case 3: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1, arg2, arg1); break; case 4: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1, arg2, arg1, arg2); break; case 5: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1, arg2, arg1, arg2, arg1); break; case 6: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1, arg2, arg1, arg2, arg1, arg2); break; case 7: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1, arg2, arg1, arg2, arg1, arg2, arg1); break; case 8: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, arg1, arg2, arg1, arg2, arg1, arg2, arg1, arg1); break; } } else { switch (argCount) { case 0: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start); break; case 1: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012"); break; case 2: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012", "12345678901234567890123456789012"); break; case 3: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012"); break; case 4: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012"); break; case 5: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012"); break; case 6: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012"); break; case 7: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012"); break; case 8: Status = MyProvider.TraceEvent(TransactionGuid, EventType.Start, "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012", "12345678901234567890123456789012"); break; } } } } MyTimer.Stop(); AvgTime = MyTimer.Average() / eventCount; Console.WriteLine("Start {0} End {1} Count {2} Delta {3} Freq {4}", MyTimer.m_Start, MyTimer.m_End, MyTimer.m_Count, MyTimer.m_Sum, MyTimer.m_Freq); AvgTime = MyTimer.m_Sum / MyTimer.m_Freq; // This is in seconds Console.WriteLine("Elapsed Time {0} milli seconds ", AvgTime * 1000); // Assumes you are running on a 1700 MHz box. AvgTime = MyTimer.m_Sum * (1700 * 1000000 / eventCount); AvgTime = AvgTime / MyTimer.m_Freq; Console.WriteLine("Done! Average Time for {0} calls = {1} Cycles", eventCount, AvgTime); }
// // Here's what a debug trace provider will have to do to generate debug traces // static void DebugTracingSample(int eventCount, int argCount, bool bString) { uint i; int EventCount = eventCount; uint Status; long AvgTime; unsafe { /* Test to determine how characters are encoded in the String class */ sbyte[] b = { 0x64, 0x65, 0x66, 0x67 }; fixed(sbyte *sbyteArray = b) { String s = new String(sbyteArray, 0, 4); Console.WriteLine("Test String = " + s + " Length = " + s.Length); int len = s.Length * 2; fixed(char *cArray = s.ToCharArray()) { byte *bArray = (byte *)cArray; for (int h = 0; h < len; h++) { Console.WriteLine("[{0}]:{1}", h, bArray[h]); } } } } Console.WriteLine("DebugTracing Sample Running"); unsafe { Console.WriteLine("sizeof char = " + sizeof(char)); } TimerTest MyTimer = new TimerTest(); WinTraceProvider MyProvider = new WinTraceProvider(new Guid("{98bea4af-ef37-424a-b457-9ea1cfd77dd9}")); /*** scratch work - start ***/ Assembly assembly; assembly = Assembly.GetAssembly(MyTimer.GetType()); Console.WriteLine("Code base : " + assembly.CodeBase); /*** scratch work - end ***/ string frmtstr = "Hello {0}"; string frmtstr2 = "Arg0 = {0} Arg1 = {1}"; string frmtstr3 = "Arg0 ={0} Arg1 = {1} Arg2 = {2}"; bool bool_v = false; byte byte_v = (byte)99; sbyte sbyte_v = (sbyte)-114; short short_v = (short)-54; ushort ushort_v = (ushort)5000; int int_v = -654; uint uint_v = (uint)12345; long long_v = (long)-98765; ulong ulong_v = (ulong)1234567; string string_v = "Does it work [2]?"; char char_v = 'G'; decimal decimal_v = (decimal)200.876543243213D; object decimal_obj = decimal_v; double double_v = (double)3.00; float float_v = 2.00F; //This is a string of length 128 bytes string testStr = "We began in earnest on Microsoft Windows 2000 in August 1996!!!!"; //string testStr = "12345678"; //16 bytes in length //Yes, it is only a performance test and hence we do not need the actual formatting. Yet.... string testFmtStr1 = "Test Message = {0}", testFmtStr2 = testFmtStr1 + ",{1}", testFmtStr3 = testFmtStr2 + ",{2}"; string testFmtStr4 = testFmtStr3 + ",{3}", testFmtStr5 = testFmtStr4 + ",{4}", testFmtStr6 = testFmtStr5 + ",{5}"; string testFmtStr7 = testFmtStr6 + ",{6}", testFmtStr8 = testFmtStr7 + ",{7}"; Console.WriteLine("Length = " + testStr.Length); string emptyString = ""; Console.WriteLine("Length of empty string = " + emptyString.Length); //Console.WriteLine(String.Format("Dummy Format {0} {1}","Hello")); unsafe { Console.WriteLine("size of decimal = " + sizeof(decimal)); } Console.WriteLine("Length of decimal string = " + decimal_obj.ToString().Length); if (bString) { //Gather performance results for logging a message containing 1 128-byte argument. Console.WriteLine("Helooooo {0} {1} {2}", decimal_v, (object)null, decimal_v); //MyProvider.DoTraceMessage(1,"Helloooo {0} {1} {2}",decimal_v,(object)null,decimal_v); MyTimer.Start(); for (i = 0; i < eventCount; i++) { if (MyProvider.enabled) { switch (argCount) { case 1: MyProvider.DoTraceMessage(1, testFmtStr1, testStr); break; case 2: MyProvider.DoTraceMessage(1, testFmtStr2, testStr, testStr); break; case 3: MyProvider.DoTraceMessage(1, testFmtStr3, testStr, testStr, testStr); break; case 4: MyProvider.DoTraceMessage(1, testFmtStr4, testStr, testStr, testStr, testStr); break; case 5: MyProvider.DoTraceMessage(1, testFmtStr5, testStr, testStr, testStr, testStr, testStr); break; case 6: MyProvider.DoTraceMessage(1, testFmtStr6, testStr, testStr, testStr, testStr, testStr, testStr); break; case 7: MyProvider.DoTraceMessage(1, testFmtStr7, testStr, testStr, testStr, testStr, testStr, testStr, testStr); break; case 8: MyProvider.DoTraceMessage(1, testFmtStr8, testStr, testStr, testStr, testStr, testStr, testStr, testStr, testStr); break; } } } MyTimer.Stop(); } else { MyTimer.Start(); MyProvider.DoTraceMessage(1, frmtstr, bool_v); MyProvider.DoTraceMessage(1, frmtstr, byte_v); MyProvider.DoTraceMessage(1, frmtstr, sbyte_v); MyProvider.DoTraceMessage(1, frmtstr, short_v); MyProvider.DoTraceMessage(1, frmtstr, ushort_v); MyProvider.DoTraceMessage(1, frmtstr, int_v); MyProvider.DoTraceMessage(1, frmtstr, uint_v); MyProvider.DoTraceMessage(1, frmtstr, long_v); MyProvider.DoTraceMessage(1, frmtstr, ulong_v); MyProvider.DoTraceMessage(1, frmtstr, float_v); MyProvider.DoTraceMessage(1, frmtstr, double_v); MyProvider.DoTraceMessage(1, frmtstr, decimal_v); MyProvider.DoTraceMessage(1, frmtstr, char_v); MyProvider.DoTraceMessage(1, frmtstr, string_v); MyProvider.DoTraceMessage(1, frmtstr2, uint_v, byte_v); Status = MyProvider.DoTraceMessage(1, frmtstr3, decimal_v, float_v, long_v); /* * for (i=0; i < eventCount; i++) * { * if (MyProvider.enabled) * { * for(i=0; i < eventCount; i++) * { * if (MyProvider.enabled) * { * switch(argCount) * { * case 1:MyProvider.DoTraceMessage(1,testFmtStr1,decimal_v);break; * case 2:MyProvider.DoTraceMessage(1,testFmtStr2,decimal_v,decimal_v);break; * case 3:MyProvider.DoTraceMessage(1,testFmtStr3,decimal_v,decimal_v,decimal_v);break; * case 4:MyProvider.DoTraceMessage(1,testFmtStr4,decimal_v,decimal_v,decimal_v,decimal_v);break; * case 5:MyProvider.DoTraceMessage(1,testFmtStr5,decimal_v,decimal_v,decimal_v,decimal_v, decimal_v);break; * case 6:MyProvider.DoTraceMessage(1,testFmtStr6,decimal_v,decimal_v,decimal_v,decimal_v, decimal_v, decimal_v);break; * case 7:MyProvider.DoTraceMessage(1,testFmtStr7,decimal_v,decimal_v,decimal_v,decimal_v, decimal_v, decimal_v, decimal_v);break; * case 8:MyProvider.DoTraceMessage(1,testFmtStr8,decimal_v,decimal_v,decimal_v,decimal_v, decimal_v, decimal_v, decimal_v, decimal_v);break; * } * } * } * * * * } * } */ MyTimer.Stop(); /* * * AvgTime = MyTimer.m_Sum * (1700 * 1000000 / eventCount); * AvgTime = AvgTime / MyTimer.m_Freq; * Console.WriteLine("Encoding Scheme [{2} args] : Average Time for {0} calls = {1} Cycles", eventCount, AvgTime, argCount); * * MyTimer.Clear(); * MyTimer.Start(); * for (i=0; i < eventCount; i++) * { * if (MyProvider.enabled) * { * for(i=0; i < eventCount; i++) * { * if (MyProvider.enabled) * { * switch(argCount) * { * case 1:MyProvider.DoTraceMessage(1,testFmtStr1,((object)decimal_v).ToString());break; * case 2:MyProvider.DoTraceMessage(1,testFmtStr2,((object)decimal_v).ToString(),((object)decimal_v).ToString());break; * case 3:MyProvider.DoTraceMessage(1,testFmtStr3,((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString());break; * case 4:MyProvider.DoTraceMessage(1,testFmtStr4,((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString());break; * case 5:MyProvider.DoTraceMessage(1,testFmtStr5,((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(), ((object)decimal_v).ToString());break; * case 6:MyProvider.DoTraceMessage(1,testFmtStr6,((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(), ((object)decimal_v).ToString(), ((object)decimal_v).ToString());break; * case 7:MyProvider.DoTraceMessage(1,testFmtStr7,((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(), ((object)decimal_v).ToString(), ((object)decimal_v).ToString(), ((object)decimal_v).ToString());break; * case 8:MyProvider.DoTraceMessage(1,testFmtStr8,((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(),((object)decimal_v).ToString(), ((object)decimal_v).ToString(), ((object)decimal_v).ToString(), ((object)decimal_v).ToString(), ((object)decimal_v).ToString());break; * } * } * } * * } * } * * MyTimer.Stop(); * * * * * AvgTime = MyTimer.m_Sum * (1700 * 1000000 / eventCount); * AvgTime = AvgTime / MyTimer.m_Freq; * Console.WriteLine("ToString() Scheme [{2} args] : Average Time for {0} calls = {1} Cycles", eventCount, AvgTime, argCount); */ } Console.WriteLine("Debug Test Complete. Timing Results:"); AvgTime = MyTimer.Average() / eventCount; Console.WriteLine("StartTime {0} EndTime {1} Count {2} Sum {3} Freq {4}", MyTimer.m_Start, MyTimer.m_End, eventCount, MyTimer.m_Sum, MyTimer.m_Freq); AvgTime = MyTimer.m_Sum / MyTimer.m_Freq; // This is in seconds AvgTime = MyTimer.m_Sum * (1700 * 1000000 / eventCount); AvgTime = AvgTime / MyTimer.m_Freq; Console.WriteLine("Done! Average Time for {0} calls = {1} Cycles", eventCount, AvgTime); }
private void TimerTestBgtn_OnClick(object sender, RoutedEventArgs e) { TimerTest win = new TimerTest(); win.Show(); }
/// <summary> /// 定时器测试 /// </summary> public static void TestTimer() { TimerTest.GetInstance().setDueTime(0, 0, 0, 0, 0); TimerTest.GetInstance().setPeriod(0, 0, 0, 0, 1); TimerTest.GetInstance().Start(); }
void Start() { timeChange = FindObjectOfType <TimerTest>().GetComponent <TimerTest>(); }
public bool WaitForAjax(int firstWait, int timeoutMs) { bool isJqueryComplete = false; bool isPrototypeComplete = false; bool isDojoComplete = false; TimerTest timer = new TimerTest(); Thread.Sleep(firstWait); for (; timer.GetElapsedTime() < timeoutMs;) { try { var javaScriptExecutor = Instance as IJavaScriptExecutor; if (javaScriptExecutor != null) { isJqueryComplete = (bool)javaScriptExecutor.ExecuteScript(" return jQuery.active == 0"); } } catch (Exception) { //// Normal behaviour } try { var javaScriptExecutor = Instance as IJavaScriptExecutor; if (javaScriptExecutor != null) { isDojoComplete = (bool) javaScriptExecutor.ExecuteScript("userWindow.dojo.io.XMLHTTPTransport.inFlight.length == 0"); } } catch (Exception) { //// Normal behaviour } try { var javaScriptExecutor = Instance as IJavaScriptExecutor; if (javaScriptExecutor != null) { isPrototypeComplete = (bool)javaScriptExecutor.ExecuteScript("userWindow.Ajax.activeRequestCount == 0"); } } catch (Exception) { //// Normal behaviour } if (isJqueryComplete | isPrototypeComplete | isDojoComplete) { timer.Finish("Wait for Ajax sucessfully finished in"); return(true); } } timer.Finish("Wait for Ajax failed after"); return(false); }
public static void Main(string[] args) { //Console.WriteLine ("Hello World!"); TimerTest tid = new TimerTest(); }