/// <summary> /// Stops the property updates worker. You will need to call this method when the platform-specific /// implementation of the control is disposed or removed. /// </summary> private void StopPropertyUpdatesWorker() { lock (PropertyUpdatesLock) { PropertyUpdatesWorker?.Stop(); PropertyUpdatesWorker = null; } }
/// <summary> /// Stops the property updates worker. You will need to call this method when the platform-specific /// implementation of the control is disposed or removed. /// </summary> private void StopPropertyUpdatesWorker() { lock (PropertyUpdatesLock) { PropertyUpdatesWorker?.Stop(); PropertyUpdatesWorker = null; } // Ensure one last update UpdateStateProperties(); }
public ObservableQuery(IDataService db) { _db = db; H <ObservableQuery <T> > .Initialize(this); _timer = NotifyHelper.EventHandlerService.GetTimer(); _timer.Tick += async(a, b) => await _timer_TickAsync(a, b); _timer.Interval = TimeSpan.FromMilliseconds(300); Suspender = new Suspender(() => _timer.Stop(), () => _timer.Start()); _token = Suspender.Get(); }
/// <summary> /// Starts the property updates worker. You will need to call this method in the constructor of /// the platform-specific MediaElement implementation to continuously pull values from the media state. /// </summary> /// <exception cref="KeyNotFoundException">MediaElement does not have minimum set of MediaProperties.</exception> private void StartPropertyUpdatesWorker() { lock (PropertyUpdatesLock) { // Check that we are not already started if (PropertyUpdatesWorker != null) { return; } // Check that all properties map back to the media state if (PropertyMapper.MissingPropertyMappings.Count > 0) { throw new KeyNotFoundException($"{nameof(MediaElement)} is missing properties exposed by {nameof(IMediaEngineState)}. " + $"Missing properties are: {string.Join(", ", PropertyMapper.MissingPropertyMappings)}. " + $"Please add these properties to the {nameof(MediaElement)} class."); } // Properties Worker Logic PropertyUpdatesWorker = Library.GuiContext.CreateTimer(Constants.PropertyUpdatesInterval, UpdateStateProperties); } }