This commit is contained in:
CortexCore
2023-11-06 01:17:23 +08:00
parent bd40165ade
commit 5446067f91
114 changed files with 2023 additions and 414 deletions

View File

@@ -65,9 +65,9 @@ namespace BITKit
public bool TryGetEntried(out T value)
{
EnsureConfiguration();
if (index is not -1)
if (m_index is not -1)
{
value = list[index];
value = list[m_index];
return true;
}
value = default;
@@ -86,31 +86,30 @@ namespace BITKit
else
{
var currentIndex = m_index;
m_index = index;
if (currentIndex is not -1 && list.TryGetElementAt(currentIndex, out var element))
if (currentIndex is not -1 && list.TryGetElementAt(currentIndex, out var currentElement))
{
element.Exit();
currentElement.Exit();
try
{
await element.ExitAsync();
await currentElement.ExitAsync();
}
catch (OperationCanceledException)
{
}
element.IsEntered = false;
OnExit?.Invoke(element);
currentElement.IsEntered = false;
OnExit?.Invoke(currentElement);
}
if (index is not -1 && list.TryGetElementAt(index, out element))
m_index = index;
if (index is not -1 && list.TryGetElementAt(index, out var nextElement))
{
element.IsEntered = true;
element.Entry();
nextElement.IsEntered = true;
nextElement.Entry();
try
{
await element.EntryAsync();
await nextElement.EntryAsync();
}
catch (OperationCanceledException){}
OnEntry?.Invoke(element);
OnEntry?.Invoke(nextElement);
}
}
completed = true;