Ejemplo n.º 1
0
 private int AddStackOperations(TreeNodeCollection nodes, IEnumerable<IOperation> operations) {
   int count = 0;
   foreach (IOperation op in operations) {
     if (op is IAtomicOperation) {
       IAtomicOperation atom = op as IAtomicOperation;
       TreeNode node = nodes.Add(atom.Operator.Name ?? atom.Operator.ItemName);
       node.Tag = atom;
       node.ToolTipText = string.Format("{0}{1}{1}{2}",
         Utils.TypeName(atom.Operator), Environment.NewLine,
         Utils.Wrap(atom.Operator.Description ?? atom.Operator.ItemDescription, 60));
       if (atom.Operator.Breakpoint) {
         node.ForeColor = Color.Red;
         node.ImageIndex = 2;
         node.SelectedImageIndex = 2;
       } else {
         node.ImageIndex = 0;
         node.SelectedImageIndex = 0;
       }
       count++;
     } else if (op is OperationCollection) {
       OperationCollection ops = op as OperationCollection;
       TreeNode node = nodes.Add(
         string.Format("{0} {2}Operation{1}",
         ops.Count,
         ops.Count == 1 ? string.Empty : "s",
         ops.Parallel ? "Parallel " : string.Empty
         ));
       node.Tag = op;
       node.ToolTipText = Utils.TypeName(ops);
       node.ImageIndex = 1;
       node.SelectedImageIndex = 1;
       count += AddStackOperations(node.Nodes, ops);
     }
   }
   return count;
 }