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

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

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

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

            return CMTimebaseRemoveTimer (Handle, timer.Handle);
        }
Ejemplo n.º 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);
        }