本文整理汇总了C#中NBTExplorer.Model.DataNode.Collapse方法的典型用法代码示例。如果您正苦于以下问题:C# DataNode.Collapse方法的具体用法?C# DataNode.Collapse怎么用?C# DataNode.Collapse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBTExplorer.Model.DataNode
的用法示例。
在下文中一共展示了DataNode.Collapse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindNode
private IEnumerable<DataNode> FindNode(DataNode node)
{
lock (_lock) {
if (_cancel)
yield break;
}
if (node == null)
yield break;
bool searchExpanded = false;
if (!node.IsExpanded) {
node.Expand();
searchExpanded = true;
}
TagDataNode tagNode = node as TagDataNode;
if (tagNode != null) {
bool mName = _state.SearchName == null;
bool mValue = _state.SearchValue == null;
if (_state.SearchName != null) {
string tagName = node.NodeName;
if (tagName != null)
mName = tagName.Contains(_state.SearchName);
}
if (_state.SearchValue != null) {
string tagValue = node.NodeDisplay;
if (tagValue != null)
mValue = tagValue.Contains(_state.SearchValue);
}
if (mName && mValue) {
InvokeDiscoverCallback(node);
yield return node;
}
}
foreach (DataNode sub in node.Nodes) {
foreach (DataNode s in FindNode(sub))
yield return s;
}
if (searchExpanded) {
if (!node.IsModified) {
node.Collapse();
InvokeCollapseCallback(node);
}
}
}
示例2: FindNode
private IEnumerable<DataNode> FindNode(DataNode node)
{
lock (_lock) {
if (_cancel)
yield break;
}
if (node == null)
yield break;
bool searchExpanded = false;
if (!node.IsExpanded) {
node.Expand();
searchExpanded = true;
}
TagDataNode tagNode = node as TagDataNode;
if (tagNode != null) {
float currentSampleTime = (float)_progressWatch.Elapsed.TotalSeconds;
_progressTime += (currentSampleTime - _lastSampleTime);
_lastSampleTime = currentSampleTime;
if (_progressTime > _state.ProgressRate) {
InvokeProgressCallback(node);
_progressTime -= _state.ProgressRate;
}
if (_state.TestNode(tagNode)) {
InvokeDiscoverCallback(node);
if (_state.TerminateOnDiscover)
yield return node;
}
/*bool mName = _state.SearchName == null;
bool mValue = _state.SearchValue == null;
if (_state.SearchName != null) {
string tagName = node.NodeName;
if (tagName != null)
mName = tagName.Contains(_state.SearchName);
}
if (_state.SearchValue != null) {
string tagValue = node.NodeDisplay;
if (tagValue != null)
mValue = tagValue.Contains(_state.SearchValue);
}
if (mName && mValue) {
InvokeDiscoverCallback(node);
yield return node;
}*/
}
using (node.Nodes.Snapshot()) {
foreach (DataNode sub in node.Nodes) {
foreach (DataNode s in FindNode(sub))
yield return s;
}
}
/*IList<DataNode> nodeList = node.Nodes;
for (int i = 0; i < nodeList.Count; i++) {
int changeset = node.Nodes.ChangeCount;
foreach (DataNode s in FindNode(nodeList[i])) {
}
}
foreach (DataNode sub in node.Nodes) {
foreach (DataNode s in FindNode(sub))
yield return s;
}*/
if (searchExpanded) {
if (!node.IsModified) {
node.Collapse();
InvokeCollapseCallback(node);
}
}
}