go to last cursor location

This commit is contained in:
MountainFlash
2021-10-06 21:24:43 +05:30
parent e73e1c7de9
commit 7c118a43c6
4 changed files with 81 additions and 7 deletions

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
namespace FModel.Framework
{
public class NavigationList<T> : List<T>
{
private int _currentIndex = 0;
public int CurrentIndex
{
get
{
if (_currentIndex > Count - 1) { _currentIndex = Count - 1; }
if (_currentIndex < 0) { _currentIndex = 0; }
return _currentIndex;
}
set { _currentIndex = value; }
}
public T MoveNext
{
get { _currentIndex++; return this[CurrentIndex]; }
}
public T MovePrevious
{
get { _currentIndex--; return this[CurrentIndex]; }
}
public T Current
{
get { return this[CurrentIndex]; }
}
}
}