优化更新代码,添加界面功能并整合
This commit is contained in:
38
WPFluent/Controls/Scroll/EventIdentifier.cs
Normal file
38
WPFluent/Controls/Scroll/EventIdentifier.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
|
||||
using WPFluent.Extensions;
|
||||
|
||||
namespace WPFluent.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Class used to create identifiers of threads or tasks that can be performed multiple times within one instance. <see
|
||||
/// cref="Current"/> represents roughly the time in microseconds at which it was taken.
|
||||
/// </summary>
|
||||
internal class EventIdentifier
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates and assigns a random value with an extra time code if possible.
|
||||
/// </summary>
|
||||
private void UpdateIdentifier() => Current = DateTime.Now.GetMicroTimestamp();
|
||||
|
||||
/// <summary>
|
||||
/// Creates and gets the next identifier.
|
||||
/// </summary>
|
||||
public long GetNext()
|
||||
{
|
||||
UpdateIdentifier();
|
||||
|
||||
return Current;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the identifiers are the same.
|
||||
/// </summary>
|
||||
public bool IsEqual(long storedId) => Current == storedId;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current identifier.
|
||||
/// </summary>
|
||||
public long Current { get; internal set; } = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user