/// <summary> /// Starts the timer. /// </summary> public void Start() { if (!IsEnabled) { IPlatformThreadingInterface threading = PerspexLocator.Current.GetService <IPlatformThreadingInterface>(); _timer = threading.StartTimer(Interval, InternalTick); } }
public void Start() { if (!this.IsEnabled) { IPlatformThreadingInterface threading = Locator.Current.GetService <IPlatformThreadingInterface>(); this.timer = threading.StartTimer(this.Interval, this.InternalTick); } }
/// <summary> /// Provides the implementation of starting the timer. /// </summary> /// <param name="tick">The method to call on each tick.</param> /// <remarks> /// This can be overridden by platform implementations to use a specialized timer /// implementation. /// </remarks> protected virtual IDisposable StartCore(Action tick) { if (_threading == null) { _threading = AvaloniaLocator.Current.GetService <IPlatformThreadingInterface>(); } return(_threading.StartTimer(TimeSpan.FromSeconds(1.0 / FramesPerSecond), tick)); }
/// <summary> /// Starts the timer. /// </summary> public void Start() { if (!IsEnabled) { IPlatformThreadingInterface threading = AvaloniaLocator.Current.GetService <IPlatformThreadingInterface>(); if (threading == null) { throw new Exception("Could not start timer: IPlatformThreadingInterface is not registered."); } _timer = threading.StartTimer(Interval, InternalTick); } }