本文整理汇总了C#中System.Windows.Forms.TreeNode.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.Equals方法的具体用法?C# TreeNode.Equals怎么用?C# TreeNode.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TreeNode
的用法示例。
在下文中一共展示了TreeNode.Equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanDrag
/// <summary>
/// 判断源节点是否可以拖拽到目标节点
/// </summary>
/// <param name="draggedNode"></param>
/// <param name="targetNode"></param>
/// <returns></returns>
public static bool CanDrag(TreeNode draggedNode, TreeNode targetNode)
{
if (targetNode.Tag != null
|| (targetNode.FullPath.IndexOf("\\") == -1 && draggedNode.Tag != null)
|| draggedNode.Parent == targetNode
|| draggedNode.Equals(targetNode)
|| ContainNode(draggedNode, targetNode)
|| targetNode.Nodes.ContainsKey(draggedNode.Name))
{
return false;
}
return true;
}
示例2: TreeNodeCanMoveTo
/// <summary>
/// 当前节点是否允许转移到目标节点
/// </summary>
/// <param name="currentTreeNode">当前节点</param>
/// <param name="targetTreeNode">目标节点</param>
/// <returns>允许</returns>
public static bool TreeNodeCanMoveTo(TreeNode currentTreeNode, TreeNode targetTreeNode)
{
if (currentTreeNode != null)
{
// 当前节点不能移动到当前节点上
if (currentTreeNode.Equals(targetTreeNode))
{
return false;
}
// 当前节点的父节点也不用移动了
//if (currentTreeNode.Parent == targetTreeNode)
//{
// return false;
//}
// 季俊武 20110219 当前节点为顶级节点的也不用移动
// 吉日嘎拉 20110319,顶级节点也能拖动才对
// if (currentTreeNode.Parent == null)
// {
// return false;
// }
// 有相同名字的,不能移动
for (int i = 0; i < targetTreeNode.Nodes.Count; i++)
{
if (currentTreeNode.Text.Equals(targetTreeNode.Nodes[i].Text))
{
return false;
// break;
}
}
// 当前节点不能移动到自己的子节点上去
while (targetTreeNode.Parent != null)
{
targetTreeNode = targetTreeNode.Parent;
if (currentTreeNode.Equals(targetTreeNode))
{
return false;
}
}
}
return true;
}
示例3: HandleNestedTransactionGroups
/// <summary>
/// Commit or rollback nested transaction groups
/// </summary>
/// <param name="operationType">The operation type determines whether to commit or to rollback transaction groups</param>
private void HandleNestedTransactionGroups(OperationType operationType)
{
while (m_transactionGroup != null)
{
if (operationType.Equals(OperationType.CommitTransactionGroup))
{
m_transactionGroup.Commit();
}
else
{
m_transactionGroup.RollBack();
}
if (m_transactionGroup.HasEnded())
{
m_transGroupNode = m_transGroupNode.Parent;
if (m_transGroupNode.Equals(m_rootNode))
{
m_transactionGroup = null;
}
else
{
m_transactionGroup = m_transGroupNode.Tag as TransactionGroup;
}
}
else
{
throw new System.ApplicationException("Could not end a transaction group");
}
}
}
示例4: recursiveRunTest
private void recursiveRunTest(TreeNode treeNode, SeleniumActions seleniumHandle)
{
runStepNum++;
if (treeNode.Equals(startNode))
{
runsteps = true;
}
if (runsteps)
{
//stepBrowser.SelectedNode = treeNode;
Steps curStep = (Steps)treeNode.Tag;
Steps tempStep = new Steps();
tempStep.Keyword = curStep.Keyword;
tempStep.Value = curStep.Value;
tempStep.Element = curStep.Element;
foreach (Variables curVar in runStepVars)
{
tempStep.Value = tempStep.Value.Replace(curVar.Searchstr, curVar.Calculatedvalue);
tempStep.Element = tempStep.Element.Replace(curVar.Searchstr, curVar.Calculatedvalue);
}
RunLog log = seleniumHandle.ParseAction(tempStep);
log.Stepnum = runStepNum;
log.Step = curStep;
if (!log.Pass)
{
runsteps = false;
log.Message = "Step Failed, Aborting Run\n\n" + log.Message;
}
testCaseWorker.ReportProgress(2, log);
}
foreach (TreeNode tn in treeNode.Nodes)
{
recursiveRunTest(tn, seleniumHandle);
}
}
示例5: RefreshNode
bool RefreshNode(TreeNode Node)
{
if (Node.Equals(LoadingNode))
return true;
RegistryNodeData data = (RegistryNodeData)Node.Tag;
if (!data.LoadedNodes)
{
if (IsLoading) return true;
IsLoading = true;
if(Node.Nodes.Count > 0)
Node.Nodes.Remove(Node.FirstNode);
Node.Nodes.Add(LoadingNode);
UpdatingNode = Node;
TreeNode rootNode = GetRootNode(Node);
RegistryKeyType key = keyFromNode(rootNode);
Console.WriteLine("Root Node: {0}", rootNode.Text);
string path = data.Path;
Console.WriteLine("Node path: {0}", path);
Client.Send((byte)NetworkCommand.RegistryEdit, (byte)RegistryCommand.UpdateNodes, (byte)key, path);
}
return false;
}
示例6: keyFromNode
RegistryKeyType keyFromNode(TreeNode node)
{
if (node.Equals(CurrentUser)) return RegistryKeyType.CurrentUser;
if (node.Equals(LocalMachine)) return RegistryKeyType.LocalMachine;
// if (node.Equals(ClassesRoot)) return RegistryKeyType.ClassesRoot;
if (node.Equals(CurrentConfig)) return RegistryKeyType.CurrentConfig;
if (node.Equals(UsersRoot)) return RegistryKeyType.UserRoot;
return RegistryKeyType.None;
}