Example #1
0
        /// <summary>
        /// Add a dim node to array node or another dim node, if one is available, it is replaced.
        /// </summary>
        /// <remarks>If parent node is the ArrayNode or DefineTypeNode of ArrayNode, then
        /// the new DimNode will replace the original DimNode which is then indented (demoted as the grandchild.
        /// If the parent node is a DimNode, then its child node is replaced and degraded, or if no child node
        /// exists, the new node is added as the child.</remarks>
        /// <param name="parentNode"></param>
        /// <param name="at"></param>
        public void addDimNode(DataNode parentNode, int at)
        {
            AbstractNode dNode = parentNode.getDataNode();

            if (dNode.GetType().Equals(typeof(DefineTypeNode)))
            {
                dNode = ((DefineTypeNode)dNode).getBaseType();
            }
            FormDim      formDim = new FormDim();
            DialogResult r       = formDim.ShowDialog(view_);

            if (r == DialogResult.OK)
            {
                string  sdname  = formDim.DimName;
                string  scount  = formDim.DimCount;
                DimNode dimNode = new DimNode(sdname, scount);
                ((ComplexNode)dNode).insertChild(dimNode, 0);                   //at irrelevant for array and dim node
                DataNode d   = new DataNode(dimNode);
                DataNode old = (DataNode)parentNode.LastNode;
                if (old != null)
                {
                    parentNode.Nodes.Remove(old);
                    d.Nodes.Add(old);
                }
                parentNode.Nodes.Add(d);
                parentNode.ExpandAll();
            }
        }
Example #2
0
 /// <summary>
 /// Add a dim node to array node or another dim node, if one is available, it is replaced.
 /// </summary>
 /// <remarks>If parent node is the ArrayNode or DefineTypeNode of ArrayNode, then
 /// the new DimNode will replace the original DimNode which is then indented (demoted as the grandchild.
 /// If the parent node is a DimNode, then its child node is replaced and degraded, or if no child node
 /// exists, the new node is added as the child.</remarks>
 /// <param name="parentNode"></param>
 /// <param name="at"></param>
 public void addDimNode(DataNode parentNode, int at)
 {
     AbstractNode dNode = parentNode.getDataNode();
     if (dNode.GetType().Equals(typeof(DefineTypeNode)))
     {
         dNode = ((DefineTypeNode)dNode).getBaseType();
     }
     FormDim formDim = new FormDim();
     DialogResult r = formDim.ShowDialog(view_);
     if (r == DialogResult.OK)
     {
         string sdname = formDim.DimName;
         string scount = formDim.DimCount;
         DimNode dimNode = new DimNode(sdname, scount);
         ((ComplexNode)dNode).insertChild(dimNode, 0);	//at irrelevant for array and dim node
         DataNode d = new DataNode(dimNode);
         DataNode old = (DataNode)parentNode.LastNode;
         if (old != null)
         {
             parentNode.Nodes.Remove(old);
             d.Nodes.Add(old);
         }
         parentNode.Nodes.Add(d);
         parentNode.ExpandAll();
     }
 }