Example #1
0
 public void AddTimer(NSTimer timer, NSRunLoopMode forMode)
 {
     AddTimer(timer, FromEnum(forMode));
 }
Example #2
0
 public void AddTimer(NSTimer timer, string forMode)
 {
     AddTimer(timer, GetRealMode(forMode));
 }
Example #3
0
        public void Stop()
        {
            if (animating) {
                if (displayLinkSupported) {
                    if (displayLink != null && displayLink.IsRunning)
                        displayLink.Stop ();

                } else {
                    animationTimer.Invalidate ();
                    animationTimer = null;
                }
            }
            animating = false;
        }
Example #4
0
        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;
        }
Example #5
0
 public void AddTimer(NSTimer timer, NSRunLoopMode forMode)
 {
     AddTimer (timer, FromEnum (forMode));
 }
Example #6
0
 public void Fire(NSTimer timer)
 {
     action();
 }
Example #7
0
 public void AddTimer(NSTimer timer, string forMode)
 {
     AddTimer (timer, GetRealMode (forMode));
 }
Example #8
0
        public CMTimebaseError SetTimerToFireImmediately(NSTimer timer)
        {
            if (timer == null)
                throw new ArgumentNullException ("timer");

            return CMTimebaseSetTimerToFireImmediately (Handle, timer.Handle);
        }
Example #9
0
        public CMTimebaseError SetTimerNextFireTime(NSTimer timer, CMTime fireTime)
        {
            if (timer == null)
                throw new ArgumentNullException ("timer");

            return CMTimebaseSetTimerNextFireTime (Handle, timer.Handle, fireTime, 0);
        }
Example #10
0
        public CMTimebaseError RemoveTimer(NSTimer timer)
        {
            if (timer == null)
                throw new ArgumentNullException ("timer");

            return CMTimebaseRemoveTimer (Handle, timer.Handle);
        }
Example #11
0
        //
        // 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);
        }