Source/AdvTree/SelectedNodesCollection.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Text;
namespace DevComponents.AdvTree
{
/// <summary>
/// Represents the selected nodes collection.
/// </summary>
public class SelectedNodesCollection : NodeCollection
{
#region Internal Implementation
internal AdvTree TreeSelectionControl = null;
internal bool SuspendEvents = false;
/// <summary>
/// Initializes a new instance of the SelectedNodesCollection class.
/// </summary>
public SelectedNodesCollection()
{
PassiveCollection = true;
}
/// <summary>
/// Adds new object to the collection and provides information about the source of the command
/// </summary>
/// <param name="node">Node to add</param>
/// <param name="action">Source action</param>
/// <returns></returns>
public override int Add(Node node, eTreeAction action)
{
if (this.List.Contains(node)) return -1;
if (TreeSelectionControl.MultiSelect)
{
if (TreeSelectionControl.MultiSelectRule == eMultiSelectRule.SameParent && this.Count>0)
{
if (this[0].Parent != node.Parent)
throw new InvalidOperationException("Node being added does not belong to the same parent as currently selected nodes. See AdvTree.MultiSelectRule property");
}
if (!SuspendEvents)
{
AdvTreeNodeCancelEventArgs cancelArgs = new AdvTreeNodeCancelEventArgs(action, node);
TreeSelectionControl.InvokeOnBeforeNodeSelect(cancelArgs);
if (cancelArgs.Cancel)
return -1;
}
}
return base.Add(node, action);
}
protected override void OnInsertComplete(int index, object value)
{
if (TreeSelectionControl.MultiSelect)
{
Node node = value as Node;
TreeSelectionControl.InvalidateNode(node);
if (node.SelectedCell == null)
node.Cells[0].SetSelected(true);
AdvTreeNodeEventArgs args = new AdvTreeNodeEventArgs(SourceAction, node);
TreeSelectionControl.InvokeOnAfterNodeSelect(args);
}
base.OnInsertComplete(index, value);
后面还有 35 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。