mirror of
https://github.com/4sval/FModel.git
synced 2026-09-27 19:48:04 -05:00
go to last cursor location
This commit is contained in:
34
FModel/Framework/NavigationList.cs
Normal file
34
FModel/Framework/NavigationList.cs
Normal 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]; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user