added control over maxitems
This commit is contained in:
parent
9712646a16
commit
c0c5216d95
@ -37,7 +37,8 @@ namespace Volian.Controls.Library
|
|||||||
// Insert it in the first place in the list
|
// Insert it in the first place in the list
|
||||||
Insert(0, myMRI);
|
Insert(0, myMRI);
|
||||||
// If more than MaxItems exist remove the items beyond MaxItems
|
// If more than MaxItems exist remove the items beyond MaxItems
|
||||||
while (Count > MaxItems) RemoveAt(MaxItems);
|
if (MaxItems > 0)
|
||||||
|
while (Count > MaxItems) RemoveAt(MaxItems);
|
||||||
myMRI.MyItemInfo.BeforeDelete += new ItemInfoEvent(MyItemInfo_BeforeDelete);
|
myMRI.MyItemInfo.BeforeDelete += new ItemInfoEvent(MyItemInfo_BeforeDelete);
|
||||||
return myMRI;
|
return myMRI;
|
||||||
}
|
}
|
||||||
@ -88,8 +89,14 @@ namespace Volian.Controls.Library
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list)
|
public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list)
|
||||||
|
{
|
||||||
|
return GetMRILst(list, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MostRecentItemList GetMRILst(System.Collections.Specialized.StringCollection list, int maxItems)
|
||||||
{
|
{
|
||||||
MostRecentItemList mril = new MostRecentItemList();
|
MostRecentItemList mril = new MostRecentItemList();
|
||||||
|
mril.MaxItems = maxItems;
|
||||||
if (list != null)
|
if (list != null)
|
||||||
for (int i = list.Count - 1; i >= 0;i-- )// Add in reverse order so first is last and last is first
|
for (int i = list.Count - 1; i >= 0;i-- )// Add in reverse order so first is last and last is first
|
||||||
mril.Add(list[i]);
|
mril.Add(list[i]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user