Ejemplo n.º 1
0
        /// <summary>
        /// Create a new group of nodes with the given name.
        /// If name is already active, then return FALSE.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="net"></param>
        /// <returns></returns>
        public bool createGroup(String name, Network net)
        {
            Debug.Assert(net == network);

            name = name.Trim();
            if (name == "")
                return false;

            GroupRecord gr;
            if (groups.TryGetValue(name, out gr))
                return false; // Named group already exists

            gr = recordAllocator(net, name);

            groups.Add(name, gr);

            EditorWindow editor = net.getEditor();
            if (editor != null)
            {
                editor.setGroup(gr, this.groupID);
                net.setFileDirty();
                net.changeExistanceWork(null, true);
            }
            return true;
        }