/// <summary> /// Handles the needed event-calls before updating. /// </summary> private void OnUpdating(IUpdateTrigger trigger, CustomUpdateData customData) { try { double deltaTime = _deltaTimeCounter.Elapsed.TotalSeconds; _deltaTimeCounter.Restart(); Updating?.Invoke(new UpdatingEventArgs(deltaTime, trigger, customData)); } catch { /* Well ... that's not my fault */ } }
/// <summary> /// Event handler for the <see cref="IUpdateTrigger.Update"/>-event. /// </summary> /// <param name="sender">The <see cref="IUpdateTrigger"/> causing this update.</param> /// <param name="customData"><see cref="CustomUpdateData"/> provided by the trigger.</param> protected virtual void OnUpdate(object sender, CustomUpdateData customData) { Dictionary <TIdentifier, TData> dataSet; lock (_dataLock) { dataSet = _currentDataSet; _currentDataSet = null; } if ((dataSet != null) && (dataSet.Count != 0)) { Update(dataSet); } }
/// <summary> /// Event handler for the <see cref="IUpdateTrigger.Starting"/>-event. /// </summary> /// <param name="sender">The starting <see cref="IUpdateTrigger"/>.</param> /// <param name="customData"><see cref="CustomUpdateData"/> provided by the trigger.</param> protected virtual void OnStartup(object sender, CustomUpdateData customData) { }
/// <summary> /// Invokes the <see cref="Update"/>-event. /// </summary> /// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Update"/>.event.</param> protected virtual void OnUpdate(CustomUpdateData updateData = null) => Update?.Invoke(this, updateData);
/// <summary> /// Invokes the <see cref="Starting"/>-event. /// </summary> /// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Starting"/>.event.</param> protected virtual void OnStartup(CustomUpdateData updateData = null) => Starting?.Invoke(this, updateData);
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:RGB.NET.Core.UpdatingEventArgs" /> class. /// </summary> /// <param name="deltaTime">The elapsed time (in seconds) since the last update.</param> /// <param name="trigger">The trigger causing this update.</param> /// <param name="customData">The custom-data provided by the trigger for this update.</param> public UpdatingEventArgs(double deltaTime, IUpdateTrigger trigger, CustomUpdateData customData) { this.DeltaTime = deltaTime; this.Trigger = trigger; this.CustomData = customData; }