This commit is contained in:
CortexCore
2023-10-29 15:27:13 +08:00
parent c5f638d9d2
commit c7b6ddbf70
73 changed files with 2158 additions and 494 deletions

View File

@@ -87,30 +87,30 @@ namespace BITKit
{
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))
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;