public ClockTimer () : base() { outputString = DateTime.Now.ToString("hh:mm:ss"); myTTimer = NSTimer.CreateRepeatingScheduledTimer (1,delegate { outputString = DateTime.Now.ToString("hh:mm:ss"); }); }
public ClockView(IntPtr handle) : base(handle) { _clock = new Clock (); _timer = NSTimer.CreateRepeatingScheduledTimer (1, delegate { SetNeedsDisplayInRect (Bounds); }); }
protected override void Dispose (bool disposing) { disposed = true; if (beatTimer != null) { beatTimer.Dispose (); beatTimer = null; } base.Dispose (disposing); }
public void AddTimer(NSTimer timer, NSRunLoopMode forMode) { AddTimer(timer, FromEnum(forMode)); }
public void AddTimer(NSTimer timer, string forMode) { AddTimer(timer, GetRealMode(forMode)); }
public void AddTimer (NSTimer timer, NSRunLoopMode forMode) { AddTimer (timer, FromEnum (forMode)); }
public void AddTimer (NSTimer timer, string forMode) { AddTimer (timer, GetRealMode (forMode)); }
void ScheduleBeatTimer () { if (disposed) { return; } if (beatTimer != null) { beatTimer.Dispose (); } OnHeartBeat (); beatTimer = NSTimer.CreateScheduledTimer (60 / (double)CurrentHeartBeat.Rate, ScheduleBeatTimer); }
public Timer () { m_helper = new NSTimer(); enabled = false; }
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); }
public CMTimebaseError AddTimer (NSTimer timer, NSRunLoop runloop) { if (timer == null) throw new ArgumentNullException ("timer"); if (runloop == null) throw new ArgumentNullException ("runloop"); // FIXME: Crashes inside CoreMedia return CMTimebaseAddTimer (Handle, timer.Handle, runloop.Handle); }
public Server(NSObject app) { _app = app; string[] args = new string[] { // "-vvvvv", "--no-xlib", }; vlc = VLC.libvlc_new(args.Length, args); _timer = NSTimer.CreateRepeatingTimer(0.1, ev_timer); NSRunLoop.Current.AddTimer(_timer, NSRunLoop.NSRunLoopCommonModes); TcpListener tcpListener = new TcpListener(IPAddress.Any, 4357); (new Thread(delegate() { tcpListener.Start(); while (true) { try { Client c = new Client(this, tcpListener.AcceptTcpClient()); lock (_lock) { if (mp != IntPtr.Zero) { c.Send(_playing ? "*playing" : "*paused"); c.Send(_seekable ? "*seekable" : "*notseekable"); c.Send("*audiotrack " + _audiotrack); c.Send("*audiotrackcount " + _audiotrackcount); c.Send("*subtitle " + _subtitle); c.Send("*subtitlecount " + _subtitlecount); c.Send("*time " + _time); c.Send("*length " + _length); } } } catch (Exception e) { Console.WriteLine("error creating client: " + e.ToString()); } } }) { IsBackground = true }).Start(); }
partial void requestAction (NSButton sender) { myTimer = NSTimer.CreateScheduledTimer (3.0, delegate { if (popupRequestType.Cell.SelectedItemIndex == 0) NSApp.RequestUserAttention (NSRequestUserAttentionType.InformationalRequest); else NSApp.RequestUserAttention (NSRequestUserAttentionType.CriticalRequest); }); }
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 Stop () { if (animating) { if (displayLinkSupported) { if (displayLink != null && displayLink.IsRunning) displayLink.Stop (); } else { animationTimer.Invalidate (); animationTimer = null; } } animating = false; }
/// <summary> /// Mouse Wheel /// </summary> /// <param name="e"></param> protected override void OnMouseWheel(GeoMouseArgs e) //Fix this { if (_zoomTimer != null) { _zoomTimer.Invalidate (); // if the timer was already started, stop it. _zoomTimer.Dispose (); } if ((e.Map.IsZoomedToMaxExtent == true) && (_direction * e.Delta < 0)) {} else { e.Map.IsZoomedToMaxExtent = false; Rectangle r = e.Map.MapFrame.View; // For multiple zoom steps before redrawing, we actually // want the x coordinate relative to the screen, not // the x coordinate relative to the previously modified view. if (_client == Rectangle.Empty) { _client = r; } int cw = _client.Width; int ch = _client.Height; double w = r.Width; double h = r.Height; if (_direction * e.Delta > 0) { double inFactor = 2.0 * _sensitivity; r.Inflate(Convert.ToInt32(-w / inFactor), Convert.ToInt32(-h / inFactor)); // try to keep the mouse cursor in the same geographic position r.X += Convert.ToInt32((e.X * w / (_sensitivity * cw)) - w / inFactor); r.Y += Convert.ToInt32((e.Y * h / (_sensitivity * ch)) - h / inFactor); } else { double outFactor = 0.5 * _sensitivity; r.Inflate(Convert.ToInt32(w / _sensitivity), Convert.ToInt32(h / _sensitivity)); r.X += Convert.ToInt32(w / _sensitivity - (e.X * w / (outFactor * cw))); r.Y += Convert.ToInt32(h / _sensitivity - (e.Y * h / (outFactor * ch))); } e.Map.MapFrame.View = r; e.Map.Invalidate(); _zoomTimer = NSTimer.CreateScheduledTimer(TimeSpan.FromMilliseconds (_timerInterval), delegate{ZoomTimerTick();}); _mapFrame = e.Map.MapFrame; if (!BusySet) { Map.IsBusy = true; BusySet = true; } base.OnMouseWheel(e); } }