public void AddTimer(NSTimer timer, NSRunLoopMode forMode) { AddTimer(timer, FromEnum(forMode)); }
public void AddTimer(NSTimer timer, string forMode) { AddTimer(timer, GetRealMode(forMode)); }
public void Stop() { if (animating) { if (displayLinkSupported) { if (displayLink != null && displayLink.IsRunning) displayLink.Stop (); } else { animationTimer.Invalidate (); animationTimer = null; } } animating = false; }
private void StartAnimation(double updatesPerSecond) { if (!animating) { if (displayLinkSupported) { if (displayLink != null && !displayLink.IsRunning) displayLink.Start (); } else { // Can't use TimeSpan.FromSeconds() as that only has 1ms // resolution, and we need better (e.g. 60fps doesn't fit nicely // in 1ms resolution, but does in ticks). var timeout = new TimeSpan ((long)(((1.0 * TimeSpan.TicksPerSecond) / updatesPerSecond) + 0.5)); if (SwapInterval) { animationTimer = NSTimer.CreateRepeatingScheduledTimer (timeout, delegate { NeedsDisplay = true; }); } else { animationTimer = NSTimer.CreateRepeatingScheduledTimer (timeout, delegate { RenderScene (); }); } NSRunLoop.Current.AddTimer (animationTimer, NSRunLoopMode.Default); NSRunLoop.Current.AddTimer (animationTimer, NSRunLoopMode.EventTracking); } } animating = true; }
public void AddTimer(NSTimer timer, NSRunLoopMode forMode) { AddTimer (timer, FromEnum (forMode)); }
public void Fire(NSTimer timer) { action(); }
public void AddTimer(NSTimer timer, string forMode) { AddTimer (timer, GetRealMode (forMode)); }
public CMTimebaseError SetTimerToFireImmediately(NSTimer timer) { if (timer == null) throw new ArgumentNullException ("timer"); return CMTimebaseSetTimerToFireImmediately (Handle, timer.Handle); }
public CMTimebaseError SetTimerNextFireTime(NSTimer timer, CMTime fireTime) { if (timer == null) throw new ArgumentNullException ("timer"); return CMTimebaseSetTimerNextFireTime (Handle, timer.Handle, fireTime, 0); }
public CMTimebaseError RemoveTimer(NSTimer timer) { if (timer == null) throw new ArgumentNullException ("timer"); return CMTimebaseRemoveTimer (Handle, timer.Handle); }
// // Dispatch timers not supported // // CMTimebaseAddTimerDispatchSource // CMTimebaseRemoveTimerDispatchSource // CMTimebaseSetTimerDispatchSourceNextFireTime // CMTimebaseSetTimerDispatchSourceToFireImmediately #endregion Other #if !COREBUILD public CMTimebaseError AddTimer(NSTimer timer, NSRunLoop runloop) { if (timer == null) throw new ArgumentNullException ("timer"); if (runloop == null) throw new ArgumentNullException ("runloop"); // NSRunloop and CFRunloop[Ref] are NOT toll free bridged types using (var cf = runloop.GetCFRunLoop ()) return CMTimebaseAddTimer (Handle, timer.Handle, cf.Handle); }