本文整理汇总了C#中Dynamo.Nodes.List.All方法的典型用法代码示例。如果您正苦于以下问题:C# List.All方法的具体用法?C# List.All怎么用?C# List.All使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamo.Nodes.List
的用法示例。
在下文中一共展示了List.All方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Collapse
//.........这里部分代码省略.........
//if (curriedNode == null)
//{
ConnectorModel.Make(node, inputReceiverNode, 0, inputReceiverData);
//}
//else
//{
// //Connect it to the applier
// newNodeWorkspace.AddConnection(node, curriedNode.InnerNode, 0, 0);
// //Connect applier to the inner input receive
// newNodeWorkspace.AddConnection(
// curriedNode.InnerNode,
// inputReceiverNode,
// 0,
// inputReceiverData);
//}
}
#endregion
#region Process outputs
//List of all inner nodes to connect an output. Unique.
var outportList = new List<Tuple<NodeModel, int>>();
var outConnectors = new List<Tuple<NodeModel, int, int>>();
int i = 0;
if (outputs.Any())
{
foreach (var output in outputs)
{
if (outportList.All(x => !(x.Item1 == output.Item1 && x.Item2 == output.Item2)))
{
NodeModel outputSenderNode = output.Item1;
int outputSenderData = output.Item2;
//NodeModel outputReceiverNode = output.Item3.Item2;
//if (curriedNodeArgs.Any(x => x.OuterNode == outputReceiverNode))
// continue;
outportList.Add(Tuple.Create(outputSenderNode, outputSenderData));
//Create Symbol Node
var node = new Output
{
Symbol = outputSenderNode.OutPortData[outputSenderData].NickName,
X = rightMost + 75 - leftShift
};
node.Y = i*(50 + node.Height);
node.SetNickNameFromAttribute();
newNodes.Add(node);
ConnectorModel.Make(outputSenderNode, node, outputSenderData, 0);
i++;
}
}
//Connect outputs to new node
outConnectors.AddRange(
from output in outputs
示例2: Collapse
//.........这里部分代码省略.........
node.SetNickNameFromAttribute();
node.DisableReporting();
node.X = outerNode.X;
node.Y = outerNode.Y;
//Fetch all input ports
// in order
// that have inputs
// and whose input comes from an inner node
List<int> inPortsConnected =
Enumerable.Range(0, outerNode.InPortData.Count)
.Where(
x =>
outerNode.HasInput(x)
&& selectedNodeSet.Contains(
outerNode.Inputs[x].Item2))
.ToList();
var nodeInputs =
outputs.Where(output => output.Item3.Item2 == outerNode)
.Select(
output =>
new
{
InnerNodeInputSender = output.Item1,
OuterNodeInPortData = output.Item3.Item1
})
.ToList();
nodeInputs.ForEach(_ => node.AddInput());
node.RegisterAllPorts();
return
new
{
OuterNode = outerNode,
InnerNode = node,
Outputs =
inputs.Where(
input => input.Item3.Item2 == outerNode)
.Select(input => input.Item3.Item1),
Inputs = nodeInputs,
OuterNodePortDataList = inPortsConnected
};
}).ToList();
#endregion
#region UI Positioning Calculations
double avgX = selectedNodeSet.Average(node => node.X);
double avgY = selectedNodeSet.Average(node => node.Y);
double leftMost = selectedNodeSet.Min(node => node.X);
double topMost = selectedNodeSet.Min(node => node.Y);
double rightMost = selectedNodeSet.Max(node => node.X + node.Width);
#endregion
#region Handle full selected connectors
// Step 2: Determine all the connectors whose start/end owners are
// both in the selection set, and then move them from the current
示例3: Collapse
//.........这里部分代码省略.........
node.DisableReporting();
dynSettings.Bench.WorkBench.Children.Add(nodeUI);
//Place it in an appropriate spot
Canvas.SetLeft(nodeUI, Canvas.GetLeft(outerNode.NodeUI));
Canvas.SetTop(nodeUI, Canvas.GetTop(outerNode.NodeUI));
//Fetch all input ports
// in order
// that have inputs
// and whose input comes from an inner node
List<int> inPortsConnected = Enumerable.Range(0, outerNode.InPortData.Count)
.Where(
x =>
outerNode.HasInput(x) &&
selectedNodeSet.Contains(
outerNode.Inputs[x].Item2))
.ToList();
var nodeInputs = outputs
.Where(output => output.Item3.Item2 == outerNode)
.Select(
output =>
new
{
InnerNodeInputSender = output.Item1,
OuterNodeInPortData = output.Item3.Item1
}).ToList();
nodeInputs.ForEach(_ => node.AddInput());
node.NodeUI.RegisterAllPorts();
dynSettings.Bench.WorkBench.UpdateLayout();
return new
{
OuterNode = outerNode,
InnerNode = node,
Outputs = inputs.Where(input => input.Item3.Item2 == outerNode)
.Select(input => input.Item3.Item1),
Inputs = nodeInputs,
OuterNodePortDataList = inPortsConnected
};
}).ToList();
#endregion
#region UI Positioning Calculations
double avgX = selectedNodeSet.Average(node => Canvas.GetLeft(node.NodeUI));
double avgY = selectedNodeSet.Average(node => Canvas.GetTop(node.NodeUI));
double leftMost = selectedNodeSet.Min(node => Canvas.GetLeft(node.NodeUI)) + 24;
double topMost = selectedNodeSet.Min(node => Canvas.GetTop(node.NodeUI));
double rightMost = selectedNodeSet.Max(node => Canvas.GetLeft(node.NodeUI) + node.NodeUI.Width);
#endregion
#region Move selection to new workspace
var connectors = new HashSet<dynConnector>(
currentWorkspace.Connectors.Where(
conn => selectedNodeSet.Contains(conn.Start.Owner.NodeLogic)
示例4: Collapse
//.........这里部分代码省略.........
//dynSettings.Bench.WorkBench.Children.Add(nodeUI);
//Place it in an appropriate spot
//Canvas.SetLeft(nodeUI, Canvas.GetLeft(outerNode.NodeUI));
//Canvas.SetTop(nodeUI, Canvas.GetTop(outerNode.NodeUI));
node.X = outerNode.X;
node.Y = outerNode.Y;
//Fetch all input ports
// in order
// that have inputs
// and whose input comes from an inner node
List<int> inPortsConnected = Enumerable.Range(0, outerNode.InPortData.Count)
.Where(
x =>
outerNode.HasInput(x) &&
selectedNodeSet.Contains(
outerNode.Inputs[x].Item2))
.ToList();
var nodeInputs = outputs
.Where(output => output.Item3.Item2 == outerNode)
.Select(
output =>
new
{
InnerNodeInputSender = output.Item1,
OuterNodeInPortData = output.Item3.Item1
}).ToList();
nodeInputs.ForEach(_ => node.AddInput());
node.RegisterAllPorts();
return new
{
OuterNode = outerNode,
InnerNode = node,
Outputs = inputs.Where(input => input.Item3.Item2 == outerNode)
.Select(input => input.Item3.Item1),
Inputs = nodeInputs,
OuterNodePortDataList = inPortsConnected
};
}).ToList();
#endregion
#region UI Positioning Calculations
double avgX = selectedNodeSet.Average(node => node.X);
double avgY = selectedNodeSet.Average(node => node.Y);
double leftMost = selectedNodeSet.Min(node => node.X);
double topMost = selectedNodeSet.Min(node => node.Y);
double rightMost = selectedNodeSet.Max(node => node.X + node.Width);
#endregion
#region Move selection to new workspace
var connectors = new HashSet<ConnectorModel>(currentWorkspace.Connectors.Where(
conn => selectedNodeSet.Contains(conn.Start.Owner)
&& selectedNodeSet.Contains(conn.End.Owner)));
//Step 2: move all nodes to new workspace
示例5: NodeFromSelection
//.........这里部分代码省略.........
//store the element in the elements list
newNodeWorkspace.Nodes.Add(node);
node.WorkSpace = newNodeWorkspace;
node.DisableReporting();
Bench.WorkBench.Children.Add(nodeUI);
//Place it in an appropriate spot
Canvas.SetLeft(nodeUI, Canvas.GetLeft(outerNode.NodeUI));
Canvas.SetTop(nodeUI, Canvas.GetTop(outerNode.NodeUI));
//Fetch all input ports
// in order
// that have inputs
// and whose input comes from an inner node
var inPortsConnected = Enumerable.Range(0, outerNode.InPortData.Count)
.Where(x => outerNode.HasInput(x) && selectedNodeSet.Contains(outerNode.Inputs[x].Item2))
.ToList();
var nodeInputs = outputs
.Where(output => output.Item3.Item2 == outerNode)
.Select(
output =>
new
{
InnerNodeInputSender = output.Item1,
OuterNodeInPortData = output.Item3.Item1
}).ToList();
nodeInputs.ForEach(_ => node.AddInput());
node.NodeUI.RegisterAllPorts();
Bench.WorkBench.UpdateLayout();
return new
{
OuterNode = outerNode,
InnerNode = node,
Outputs = inputs.Where(input => input.Item3.Item2 == outerNode)
.Select(input => input.Item3.Item1),
Inputs = nodeInputs,
OuterNodePortDataList = inPortsConnected
};
}).ToList();
#endregion
#region Move selection to new workspace
var connectors = new HashSet<dynConnector>(
CurrentSpace.Connectors.Where(
conn => selectedNodeSet.Contains(conn.Start.Owner.NodeLogic)
&& selectedNodeSet.Contains(conn.End.Owner.NodeLogic)));
//Step 2: move all nodes to new workspace
// remove from old
CurrentSpace.Nodes.RemoveAll(selectedNodeSet.Contains);
CurrentSpace.Connectors.RemoveAll(connectors.Contains);
// add to new
newNodeWorkspace.Nodes.AddRange(selectedNodeSet);
newNodeWorkspace.Connectors.AddRange(connectors);
var leftShift = leftMost - 250;
foreach (var node in newNodeWorkspace.Nodes.Select(x => x.NodeUI))
{