using WPFluent.Extensions;
namespace WPFluent.Controls;
///
/// Class used to create identifiers of threads or tasks that can be performed multiple times within one instance. represents roughly the time in microseconds at which it was taken.
///
internal class EventIdentifier
{
///
/// Creates and assigns a random value with an extra time code if possible.
///
private void UpdateIdentifier() => Current = DateTime.Now.GetMicroTimestamp();
///
/// Creates and gets the next identifier.
///
public long GetNext()
{
UpdateIdentifier();
return Current;
}
///
/// Checks if the identifiers are the same.
///
public bool IsEqual(long storedId) => Current == storedId;
///
/// Gets or sets the current identifier.
///
public long Current { get; internal set; } = 0;
}