本文整理汇总了C#中ICSharpCode.TreeView.SharpTreeNode类的典型用法代码示例。如果您正苦于以下问题:C# SharpTreeNode类的具体用法?C# SharpTreeNode怎么用?C# SharpTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SharpTreeNode类属于ICSharpCode.TreeView命名空间,在下文中一共展示了SharpTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearDescendants
void ClearDescendants(SharpTreeNode node)
{
var index = List.IndexOf(node);
while (index + 1 < List.Count && List[index + 1].Level > node.Level) {
RemoveAt(index + 1);
}
}
示例2: GetNodeByVisibleIndex
internal static SharpTreeNode GetNodeByVisibleIndex(SharpTreeNode root, int index)
{
root.GetTotalListLength(); // ensure all list lengths are calculated
Debug.Assert(index >= 0);
Debug.Assert(index < root.totalListLength);
SharpTreeNode node = root;
Debug.Assert(node != null);
while (true) {
if (node.left != null && index < node.left.totalListLength) {
Debug.Assert(node.left != null);
node = node.left;
} else {
if (node.left != null) {
index -= node.left.totalListLength;
}
if (node.isVisible) {
if (index == 0)
return node;
index--;
}
Debug.Assert(node.right != null);
node = node.right;
}
}
}
示例3: Copy
public override IDataObject Copy(SharpTreeNode[] nodes)
{
var data = new DataObject();
var paths = SharpTreeNode.ActiveNodes.Cast<FileSystemNode>().Select(n => n.FullPath).ToArray();
data.SetData(typeof(string[]), paths);
return data;
}
示例4: Execute
public void Execute(SharpTreeNode[] selectedNodes)
{
//Cast
var node = (ILSpyTreeNode)selectedNodes[0];
//Checks if the selected node is an assembly
if (node is AssemblyTreeNode)
{
//Forces lazy-loading
node.EnsureLazyChildren();
//Checks if it's a multi-module assembly
if (node.Children.Count > 1)
{
MessageBox.Show("In a multi-module assembly select a specific module", "Select module", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
//Takes the first (and only) module
node = (ILSpyTreeNode)node.Children[0];
}
//Shows the injection window
new Injection.InjectWindow(node, 0, new InjectExistingEntry().IsVisible(selectedNodes)).ShowDialog();
}
示例5: DeleteCore
public override void DeleteCore(SharpTreeNode[] nodes)
{
foreach (var node in nodes.ToArray())
{
node.Parent.Children.Remove(node);
}
}
示例6: Delete
public override void Delete(SharpTreeNode[] nodes)
{
if (MessageBox.Show("Sure?", "Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
DeleteCore(nodes);
}
}
示例7: Execute
public void Execute(SharpTreeNode[] selectedNodes)
{
// TODO: figure out when equivalent nodes are already present
// and focus those instead.
foreach (IMemberTreeNode node in selectedNodes) {
Analyze(node.Member);
}
}
示例8: IsEnabled
public bool IsEnabled(SharpTreeNode[] selectedNodes)
{
foreach (IMemberTreeNode node in selectedNodes) {
if (!(node.Member is FieldDefinition || node.Member is MethodDefinition))
return false;
}
return true;
}
示例9: TreeFlattener
public TreeFlattener(SharpTreeNode modelRoot, bool includeRoot)
{
this.root = modelRoot;
while (root.listParent != null)
root = root.listParent;
root.treeFlattener = this;
this.includeRoot = includeRoot;
}
示例10: ImportCore
protected override IMetadataTokenProvider ImportCore(MemberImportingOptions options, SharpTreeNode node)
{
//Checks that the task hasn't been canceled
options.CancellationToken.ThrowIfCancellationRequested();
//Imports and returns
return Session.DestinationModule.Import((TypeReference)Member);
}
示例11: Insert
void Insert(int index, SharpTreeNode node)
{
List.Insert(index, node);
node.PropertyChanged += node_PropertyChanged;
if (node.IsExpanded) {
node.Children.CollectionChanged += node_ChildrenChanged;
}
}
示例12: GoForward
public SharpTreeNode GoForward(SharpTreeNode oldNode)
{
if (oldNode != null)
back.Add(oldNode);
SharpTreeNode node = forward[forward.Count - 1];
forward.RemoveAt(forward.Count - 1);
return node;
}
示例13: GoBack
public SharpTreeNode GoBack(SharpTreeNode oldNode)
{
if (oldNode != null)
forward.Add(oldNode);
SharpTreeNode node = back[back.Count - 1];
back.RemoveAt(back.Count - 1);
return node;
}
示例14: Execute
public void Execute(SharpTreeNode[] selectedNodes)
{
var types = selectedNodes
.OfType<TypeTreeNode>()
.Select(n => HAL.Converter.Type(n.TypeDefinition))
.ToArray();
Services.BrowseInteractions(types, true);
}
示例15: IsVisible
protected override bool IsVisible(SharpTreeNode node)
{
return node is EventTreeNode
|| node is FieldTreeNode
|| node is MethodTreeNode
|| node is PropertyTreeNode
|| node is TypeTreeNode
|| node is AssemblyReferenceTreeNode
|| node is ResourceTreeNode;
}