private void OnUpdate(object sender, ElapsedEventArgs e) { if (_closing) { return; } //DisplayCooldowns(); KeyUtils.WindowToSendKeysIn = WinUtils.GetActiveWindow(); this.Invoke((MethodInvoker) delegate { if (_closing) { return; } lblIsDown.Text = $"elapsed s: {timer.ElapsedSeconds}, interval: {timer.Interval}"; lblValue.Text = $"elapsed ms: {timer.ElapsedMs}"; lblEnabled.Text = $"Enabled: {timer.Enabled}"; }); mousePos = Maths.Translate(mousePos, new Vector(1, 1), 5).ToIntVector(); _timerUpdate.Start(); }
private void OnUpdate(object sender, ElapsedEventArgs e) { timerUpdate.Stop(); string activeWindow = WinUtils.GetActiveWindow(); if (activeWindow == null || (activeWindow != Constants.KO_WINDOW && !activeWindow.Contains("Microsoft Visual Studio"))) { btnStop_Click(null, null); return; } if (upDirection.IsZero()) { TrySetUpDir(); } SetCurrentPosition(); distanceToDestination = Math.Abs((destination - currentPos).Length); if (distanceToDestination <= lengthDiffForReachingDestination) { Console.WriteLine("DONE!!!!"); btnStop_Click(null, null); return; } else if (isMoving && ShouldReajustPosition()) { isMoving = false; KeyUtils.SendCharUp('w'); currentDirectionStartPoint = currentPos; StartMove(); } timerUpdate.Start(); }
private void OnUpdate(object sender, ElapsedEventArgs e) { _updateTimer.Stop(); string activeWindow = WinUtils.GetActiveWindow(); if (string.IsNullOrEmpty(activeWindow) || activeWindow != Constants.KO_WINDOW) { #if DEBUG if (!activeWindow.ToLower().Contains("visual studio")) #endif { Stop(); return; } } Time.StartFrame(); try { foreach (var go in _gos) { go.Update(); } Time.EndFrame(); _updateTimer.Start(); } catch (Exception ex) { Debug.Log("Exception: " + ex.Message); Stop(); } }
private void OnUpdate(object sender, ElapsedEventArgs e) { if (this.IsDisposed) { return; } this.Invoke((MethodInvoker) delegate { SetPosition(); lblCurrentWindow.Text = $"Current Window: {WinUtils.GetActiveWindow()}"; }); }