private void OnTimedEvent(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs) { //<> if (KEN.Right >= RYU.Left + 10) { kenCollision = true; if (KEN.InvokeRequired) { KEN.Invoke(new Action(() => KEN.Left = RYU.Left - RYU.Width + 10)); } else { KEN.Left = RYU.Left - RYU.Width + 10; } } else { kenCollision = false; } if (RYU.Left < KEN.Right - 10) { ryuCollision = true; if (RYU.InvokeRequired) { RYU.Invoke(new Action(() => RYU.Left = KEN.Right - 10)); } else { RYU.Left = KEN.Right - 10; } } else { ryuCollision = false; } #region outOfBounds if (KEN.Right > screen.Right) { kenOutOfBounds = true; if (KEN.InvokeRequired) { KEN.Invoke(new Action(() => KEN.Left = pointRight.X)); } else { KEN.Left = pointRight.X; } } else { kenOutOfBounds = false; } if (KEN.Left < screen.Left) { kenOutOfBounds = true; if (KEN.InvokeRequired) { KEN.Invoke(new Action(() => KEN.Left = pointLeft.X)); } else { KEN.Left = pointLeft.X; } } else { kenOutOfBounds = false; } if (RYU.Left < screen.Left) { ryuOutOfBounds = true; if (RYU.InvokeRequired) { RYU.Invoke(new Action(() => RYU.Left = pointLeft.X)); } else { RYU.Left = pointLeft.X; } } else { ryuOutOfBounds = false; } if (RYU.Right > screen.Right) { ryuOutOfBounds = true; if (RYU.InvokeRequired) { RYU.Invoke(new Action(() => RYU.Left = pointRight.X)); } else { RYU.Left = pointRight.X; } } else { ryuOutOfBounds = false; } #endregion }
private void OnTimedEvent(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs) { //Debug.Print("tick"); if (!playbackActive) { fastTimer.Stop(); return; } if (playbackForward) { //Debug.Print("forward"); updatePosition(true); } else { //Debug.Print("back"); updatePosition(false); } if (!ckLoop.Checked) { if (playbackPos == 0) playbackActive = false; if (playbackPos == (numFrames - 1)) playbackActive = false; } }
private void OnTimedEvent(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs) { doStep(); }
/// <summary> /// This callback is invoked by the timer when a time-slice is over /// </summary> /// <param name="sender"></param> /// <param name="timerEventArgs"></param> private void OnTimedEvent(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs) { Dictionary<int, List<byte[]>> dmxVals = new Dictionary<int, List<byte[]>>(); List<int> dmxStartAdresses = new List<int>(); int i = 0; for (i = 0; i < movingHeads.Count; i++) { if (movingHeads[i].SingleTurn != 0x00) { var tmp = TurnSingleStep(movingHeads[i].SingleTurn, i); dmxVals.Add(i, tmp); dmxStartAdresses.Add(MhAdresses[i]); } } i = 0; foreach (var item in dmxVals.Values) { TransmitterSet(item, dmxStartAdresses[i]); ++i; } Transmitter.Flush(); // publish all changes at once if (!isDuringSetup) VMSvc.DmxValuesChanged(dmxVals); }
public void saveframe(object sender, MicroLibrary.MicroTimerEventArgs timerEventArgs) { if (videoOut.Ptr != IntPtr.Zero && videoOut != null) { try { if (img3 == null) videoOut.WriteFrame(old); //write old frame in case img3 is not pulled yet else { videoOut.WriteFrame(img3); old = img3; img3 = null; } } catch { } // img3.Dispose(); } }