mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Added LastUpdateTime to update-triggers
This commit is contained in:
parent
41edda99f0
commit
a1955ec377
@ -7,6 +7,12 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
public abstract class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
public abstract double LastUpdateTime { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -53,6 +53,8 @@ namespace RGB.NET.Core
|
||||
}
|
||||
}
|
||||
|
||||
public override double LastUpdateTime { get; protected set; }
|
||||
|
||||
protected AutoResetEvent HasDataEvent { get; set; } = new(false);
|
||||
|
||||
protected bool IsRunning { get; set; }
|
||||
@ -126,9 +128,11 @@ namespace RGB.NET.Core
|
||||
|
||||
OnUpdate();
|
||||
|
||||
double lastUpdateTime = ((Stopwatch.GetTimestamp() - preUpdateTicks) / 10000.0);
|
||||
LastUpdateTime = lastUpdateTime;
|
||||
|
||||
if (UpdateFrequency > 0)
|
||||
{
|
||||
double lastUpdateTime = ((Stopwatch.GetTimestamp() - preUpdateTicks) / 10000.0);
|
||||
int sleep = (int)((UpdateFrequency * 1000.0) - lastUpdateTime);
|
||||
if (sleep > 0)
|
||||
Thread.Sleep(sleep);
|
||||
|
||||
@ -7,6 +7,8 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
public interface IUpdateTrigger : IDisposable
|
||||
{
|
||||
double LastUpdateTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the trigger is starting up.
|
||||
/// </summary>
|
||||
|
||||
@ -22,7 +22,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Gets the time it took the last update-loop cycle to run.
|
||||
/// </summary>
|
||||
public double LastUpdateTime { get; private set; }
|
||||
public override double LastUpdateTime { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ namespace RGB.NET.Core
|
||||
/// <summary>
|
||||
/// Gets the time it took the last update-loop cycle to run.
|
||||
/// </summary>
|
||||
public double LastUpdateTime { get; private set; }
|
||||
public override double LastUpdateTime { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user