Little Registry Cleaner/Common Tools/TreeViewAdv/Tree/ListModel.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace Common_Tools.TreeViewAdv.Tree
{
public class ListModel : TreeModelBase
{
private IList _list;
public int Count
{
get { return _list.Count; }
}
public ListModel()
{
_list = new List<object>();
}
public ListModel(IList list)
{
_list = list;
}
public override IEnumerable GetChildren(TreePath treePath)
{
return _list;
}
public override bool IsLeaf(TreePath treePath)
{
return true;
}
public void AddRange(IEnumerable items)
{
foreach (object obj in items)
_list.Add(obj);
OnStructureChanged(new TreePathEventArgs(TreePath.Empty));
}
public void Add(object item)
{
_list.Add(item);
OnNodesInserted(new TreeModelEventArgs(TreePath.Empty, new int[] { _list.Count - 1 }, new object[] { item }));
}
public void Clear()
{
_list.Clear();
OnStructureChanged(new TreePathEventArgs(TreePath.Empty));
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。