本文整理汇总了C#中System.Windows.Forms.TreeNodeCollection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection.Clear方法的具体用法?C# TreeNodeCollection.Clear怎么用?C# TreeNodeCollection.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNodeCollection
的用法示例。
在下文中一共展示了TreeNodeCollection.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadWorkFlowClass
/// <summary>
/// 递归装载全部流程类型
/// </summary>
/// <param name="key"></param>
/// <param name="startNodes"></param>
public static void LoadWorkFlowClass(string key, TreeNodeCollection startNodes)
{
try
{
DataTable table = WorkFlowClass.GetChildWorkflowClass(key);
startNodes.Clear();
foreach (DataRow row in table.Rows)
{
WorkFlowClassTreeNode tmpNode = new WorkFlowClassTreeNode();
tmpNode.NodeId = row["WFClassId"].ToString();
tmpNode.ImageIndex = 0;
tmpNode.ToolTipText = "分类";
tmpNode.clLevel = Convert.ToInt16(row["clLevel"]);
tmpNode.SelectedImageIndex = 0;
tmpNode.Text = row["Caption"].ToString();
tmpNode.WorkflowFatherClassId = row["FatherId"].ToString();
tmpNode.Description = row["Description"].ToString();
tmpNode.MgrUrl = row["clmgrurl"].ToString();
tmpNode.NodeType = WorkConst.WORKFLOW_CLASS;
startNodes.Add(tmpNode);
LoadWorkFlowClass(tmpNode.NodeId, tmpNode.Nodes);
}
WorkFlowTreeNode.LoadWorkFlowSelectNode(key, startNodes);
}
catch (Exception ex)
{
throw ex;
}
}
示例2: AssignToTreeNodeCollectionTree
public void AssignToTreeNodeCollectionTree(TreeNodeCollection dest)
{
dest.Clear();
foreach (TreeNodeItem item in Nodes)
{
AssignToTreeNodeCollectionTree(dest, item);
}
}
示例3: populateTreeNodeCollectionWithVariables
public static void populateTreeNodeCollectionWithVariables(TreeView targetTreeView, TreeNodeCollection nodes, List<O2MDbgVariable> o2MDbgvariables)
{
targetTreeView.invokeOnThread(
() =>
{
nodes.Clear();
foreach (var o2MDbgvariable in o2MDbgvariables)
{
// var nameLvSubItem = new ListViewItem.ListViewSubItem()
var nodeText =
string.Format("{0} = {1} : {2}", o2MDbgvariable.name, o2MDbgvariable.value,
o2MDbgvariable.type);
var newTreeNode = O2Forms.newTreeNode(nodes, nodeText, 0, o2MDbgvariable);
if (o2MDbgvariable.complexType)
newTreeNode.Nodes.Add("DymmyNode");
}
});
}
开发者ID:o2platform,项目名称:O2.Platform.Projects.Misc_and_Legacy,代码行数:19,代码来源:ascx_Variables.Controllers.cs
示例4: AddNodes
protected void AddNodes(object customizer, TreeNodeCollection nodes, List<IDialogPanelDescriptor> dialogPanelDescriptors)
{
nodes.Clear();
foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors)
{
if (descriptor.DialogPanel != null)
{
descriptor.DialogPanel.CustomizationObject = customizer;
descriptor.DialogPanel.Control.Dock = DockStyle.Fill;
this.OptionPanels.Add(descriptor.DialogPanel);
}
TreeNode node = new TreeNode(descriptor.Label);
node.Tag = descriptor;
node.NodeFont = this.plainFont;
nodes.Add(node);
if (descriptor.ChildDialogPanelDescriptors != null)
{
this.AddNodes(customizer, node.Nodes, descriptor.ChildDialogPanelDescriptors);
}
}
}
示例5: InitCategoryTreeNode
public static void InitCategoryTreeNode(TreeNodeCollection categoryNodes, List<MetaTable> tables)
{
categoryNodes.Clear();
if (tables.Count > 0)
{
List<MetaColumn> columns = new List<MetaColumn>();
foreach (MetaTable table in tables)
{
foreach (MetaColumn column in table.Columns)
{
columns.Add(column);
}
}
foreach (var column in columns.OrderBy(i => i.DisplayOrder))
{
string[] categories = column.Category.Split('/');
TreeNodeCollection nodes = categoryNodes;
TreeNode categoryNode = null;
string path = "";
foreach (var category in categories)
{
Helper.AddValue(ref path, "/", category);
categoryNode = getCategoryTreeNode(nodes, category);
if (categoryNode == null)
{
categoryNode = new TreeNode(category) { Tag = new CategoryFolder() { Name = category, Path = path }, ImageIndex = 2, SelectedImageIndex = 2 };
nodes.Add(categoryNode);
}
nodes = categoryNode.Nodes;
}
var tn = new TreeNode(column.DisplayName) { Tag = column, ImageIndex = 7, SelectedImageIndex = 7 };
categoryNode.Nodes.Add(tn);
}
}
}
示例6: CreateNodeList
static void CreateNodeList(TreeNodeCollection nodes, object target)
{
var treeNodes = CreateNodes(target);
//Tracer.FlaggedLine(treeNodes.Dump());
//Tracer.ConditionalBreak(treeNodes.Length == 20,"");
nodes.Clear();
nodes.AddRange(treeNodes);
}
示例7: PopulateTreeView
private void PopulateTreeView(TreeNodeCollection nodes, string path)
{
try
{
nodes.Clear();
string[] dirs = Directory.GetDirectories(path);
foreach (string dir in dirs)
{
nodes.Add(dir, Path.GetFileName(dir));
}
string[] files = Directory.GetFiles(path);
foreach (string file in files)
{
string extension = Path.GetExtension(file).Replace(".", "");
string filenamepart1 = Path.GetFileNameWithoutExtension(file);
bool b = false;
//string filtertext = this.textBox11.Text;
//if (filtertext == "_Original")
//{
// b = true;
//}
//MessageBox.Show(filtertext);
//enumerateFilters(filenamepart1);
if (radioButton3.Checked)
{
if (extension == textBox4.Text || extension == textBox5.Text || extension == textBox3.Text)
{
string fullPath = Path.GetFullPath(path).TrimEnd(Path.DirectorySeparatorChar);
string projectName = Path.GetFileName(fullPath);
//MessageBox.Show(projectName);
//string filenamepart1 = Path.GetFileNameWithoutExtension(file);
if (extension == textBox3.Text)
{
if (!(filenamepart1 == projectName))
{
b = enumerateFilters(filenamepart1);
if (!(b))
{
nodes.Add(file, Path.GetFileName(file));
}
}
}
else
{
b = enumerateFilters(filenamepart1);
if (!(b))
{
nodes.Add(file, Path.GetFileName(file));
}
}
}
}
else
{
if (extension == textBox4.Text || extension == textBox5.Text)
{
b = enumerateFilters(filenamepart1);
if (!(b))
{
nodes.Add(file, Path.GetFileName(file));
}
}
}
}
foreach (TreeNode node in nodes)
{
PopulateTreeView(node.Nodes, node.Name);
}
treeView1.ExpandAll();
}
catch (UnauthorizedAccessException)
{
return;
}
catch
{
return;
}
}
示例8: Sort
public void Sort(TreeNodeCollection col)
{
CheckDisposed();
if (col.Count == 0)
return;
List<FeatureTreeNode> list = new List<FeatureTreeNode>(col.Count);
foreach (FeatureTreeNode childNode in col)
{
list.Add(childNode);
}
list.Sort();
BeginUpdate();
col.Clear();
foreach (FeatureTreeNode childNode in list)
{
col.Add(childNode);
if (childNode.Nodes.Count > 0)
{
if (childNode.Nodes[0].Nodes.Count > 0)
Sort(childNode.Nodes); // sort all but terminal nodes
else
{ // append "none of the above" node to terminal nodes
FeatureTreeNode noneOfTheAboveNode = new FeatureTreeNode(
// REVIEW: SHOULD THIS STRING BE LOCALIZED?
LexTextControls.ksNoneOfTheAbove,
(int)ImageKind.radio, (int)ImageKind.radio, 0,
FeatureTreeNodeInfo.NodeKind.Other);
InsertNode(noneOfTheAboveNode, childNode);
}
}
}
EndUpdate();
}
示例9: AddRecordingNodes
internal static void AddRecordingNodes(TreeNodeCollection nodes, object groupObject, bool includeNonExisting)
{
List<RecordingSummary> recordings = null;
bool addChannelName = false;
RecordingGroup recordingGroup = groupObject as RecordingGroup;
switch (recordingGroup.RecordingGroupMode)
{
case RecordingGroupMode.GroupBySchedule:
recordings = Proxies.ControlService.GetRecordingsForSchedule(recordingGroup.ScheduleId, includeNonExisting).Result;
addChannelName = true;
break;
case RecordingGroupMode.GroupByChannel:
recordings = Proxies.ControlService.GetRecordingsOnChannel(recordingGroup.ChannelId, includeNonExisting).Result;
break;
case RecordingGroupMode.GroupByProgramTitle:
recordings = Proxies.ControlService.GetRecordingsForProgramTitle(recordingGroup.ChannelType, recordingGroup.ProgramTitle, includeNonExisting).Result;
addChannelName = true;
break;
case RecordingGroupMode.GroupByCategory:
recordings = Proxies.ControlService.GetRecordingsForCategory(recordingGroup.ChannelType, recordingGroup.Category, includeNonExisting).Result;
addChannelName = true;
break;
}
if (recordings != null)
{
nodes.Clear();
foreach (RecordingSummary recording in recordings)
{
AddRecordingNode(nodes, recording, addChannelName);
}
}
}
示例10: CleanupAndRemoveNodes
public void CleanupAndRemoveNodes(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
CleanupAndRemoveNodes(node.Nodes);
ComPtrTreeNode comObjectTreeNode = node as ComPtrTreeNode;
if ((comObjectTreeNode != null) && (comObjectTreeNode.ComPtr.IsInvalid == false))
{
comObjectTreeNode.ComPtr.Dispose();
}
}
nodes.Clear();
}
示例11: addSubNodes
private void addSubNodes(List<FileFindResult> files, TreeNodeCollection nodes)
{
nodes.Clear();
listResult(files, nodes, (result) => { return Path.GetFileName(result.File); });
}
示例12: LoadNodes
/// <summary>
/// Loads an XPathNavigatorTreeNode for each XPathNavigator in the specified XPathNodeIterator, into the
/// specified TreeNodeCollection.
/// </summary>
/// <param name="iterator"></param>
/// <param name="treeNodeCollection"></param>
public virtual void LoadNodes(XPathNodeIterator iterator, TreeNodeCollection treeNodeCollection)
{
// handle null arguments
if (iterator == null)
throw new ArgumentNullException("navigator");
if (treeNodeCollection == null)
throw new ArgumentNullException("parentNodeCollection");
// use the wait cursor, in case this takes a while
this.UseWaitCursor = true;
try
{
treeNodeCollection.Clear();
// create and add a node for each navigator
foreach (XPathNavigator navigator in iterator)
{
XPathNavigatorTreeNode node = new XPathNavigatorTreeNode(navigator.Clone());
treeNodeCollection.Add(node);
}
}
finally
{
this.UseWaitCursor = false;
}
}
示例13: SortTreeview
/// <summary>
/// Sort the treeview by name and child count.
/// </summary>
/// <param name="nodes">All child tree nodes.</param>
public static void SortTreeview(TreeNodeCollection nodes)
{
if (nodes.Count == 0)
return;
List<TreeNode> leaves = new List<TreeNode>();
List<TreeNode> branches = new List<TreeNode>();
foreach (TreeNode node in nodes)
{
if (node.GetNodeCount(false) > 0)
{
branches.Add(node);
SortTreeview(node.Nodes);
}
else
{
leaves.Add(node);
}
}
nodes.Clear();
if (leaves.Count > 0)
{
TreeNode[] leafArray = new TreeNode[leaves.Count];
leaves.CopyTo(leafArray, 0);
Comparison<TreeNode> compare = delegate(TreeNode tx, TreeNode ty)
{
if (tx.Text.Length != ty.Text.Length)
return tx.Text.Length - ty.Text.Length;
return string.Compare(tx.Text, ty.Text);
};
Array.Sort<TreeNode>(leafArray, compare);
nodes.AddRange(leafArray);
}
foreach (TreeNode node in branches)
{
nodes.Add(node);
}
}
示例14: SortNodes
public void SortNodes(TreeNodeCollection nodes, bool recursive)
{
if (!isSorted) {
return;
}
TreeNode[] nodeArray = new TreeNode[nodes.Count];
nodes.CopyTo(nodeArray, 0);
Array.Sort(nodeArray, nodeSorter);
nodes.Clear();
nodes.AddRange(nodeArray);
if (recursive) {
foreach (TreeNode childNode in nodeArray) {
SortNodes(childNode.Nodes, true);
}
}
}
示例15: FillTreeNodes
private void FillTreeNodes(
TemplateNodeInfo parent,
TreeNodeCollection treeNodes
)
{
List<Tuple<TreeNode, ConcreteTemplateNodeDefinition>> pendingUpdateNodes =
new List<Tuple<TreeNode, ConcreteTemplateNodeDefinition>>();
Action action = () =>
{
treeNodes.Clear();
treeNodes.AddRange(parent.Childs.Select(n =>
{
ConcreteTemplateNodeDefinition nodedef;
TreeNode node = this._treeControl.CreateTreeViewNode(n, out nodedef);
pendingUpdateNodes.Add(new Tuple<TreeNode, ConcreteTemplateNodeDefinition>(node, nodedef));
return node;
}).ToArray());
if (parent.ChildrenAreLoadingNow)
{
treeNodes.Add(new TreeNode(this._treeControl._model.LocaleManager.GetLocalizedText(
"common", "NodesQueryingTreeNodeText")
)
{
ImageKey = "NodesQuerying",
SelectedImageKey = "NodesQuerying"
});
}
};
this._treeControl.SafeInvoke(action);
foreach (Tuple<TreeNode, ConcreteTemplateNodeDefinition> pendingNode in pendingUpdateNodes)
{
TreeNode node = pendingNode.Item1;
ConcreteTemplateNodeDefinition nodeDef = pendingNode.Item2;
if (parent.IsDisabled)
{
nodeDef.TemplateNode.IsDisabled = true;
nodeDef.NodeActivated = false;
}
nodeDef.NodeAvailable = nodeDef.IsAvailableForDatabase(Program.Model) ?? true;
if (!nodeDef.NodeAvailable)
{
this._treeControl.SetNotAvailableNode(node);
}
else
{
this._treeControl.SetNodeLoaded(node);
List<TemplateNodeUpdateJob> refreshJobs = nodeDef.TemplateNode.GetRefreshJob(true);
nodeDef.TemplateNode.HasActiveJobs = refreshJobs.Any(
job =>
job != null
&& !job.IsEmpty()
&& job.Enabled
);
UpdateTreeCounts(node, NodeUpdatingSource.LocallyOnly);
}
}
}