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