Exemplo n.º 1
0
        /// <summary>
        /// Fill command tree
        /// </summary>
        /// <param name="node"></param>
        /// <param name="cmd"></param>
        private TreeNode FillCommandsTreeSubNode(DeviceCommandBase cmd)
        {
            TreeNode nd = new TreeNode();

            nd.Tag = cmd;
            if (cmd is DeviceCommandsGroup)
            {
                DeviceCommandsGroup g = (DeviceCommandsGroup)cmd;
                nd.Text = g.ToString();
                if (g.Commands != null)
                {
                    foreach (DeviceCommandBase c in g.Commands)
                    {
                        nd.Nodes.Add(FillCommandsTreeSubNode(c));
                    }
                }
            }
            else if (cmd is DeviceCommand)
            {
                nd.Text = cmd.ToString();
            }
            else if (cmd is DeviceGUICommand)
            {
                nd.Text = cmd.ToString();
            }
            return(nd);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Fill command tree 
 /// </summary>
 /// <param name="node"></param>
 /// <param name="cmd"></param>
 private TreeNode FillCommandsTreeSubNode( DeviceCommandBase cmd)
 {
     TreeNode nd = new TreeNode();
     nd.Tag = cmd;
     if (cmd is DeviceCommandsGroup)
     {
         DeviceCommandsGroup g = (DeviceCommandsGroup)cmd;
         nd.Text = g.ToString();
         if (g.Commands != null)
         {
             foreach (DeviceCommandBase c in g.Commands)
             {
                 nd.Nodes.Add(FillCommandsTreeSubNode(c));
             }
         }
     }
     else if (cmd is DeviceCommand)
     {
         nd.Text = cmd.ToString();
     }
     else if (cmd is DeviceGUICommand)
     {
         nd.Text = cmd.ToString();
     }
     return nd;
 }