Exemplo n.º 1
0
 /// <summary>
 /// Reload the package data into this control
 /// </summary>
 private void ReloadModule()
 {
     using (tvItems.BeginUpdate())
     {
         moduleTree.ReloadModule(module, contextMenus, true);
     }
     tvItems.Refresh();
     ValidateModule();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Reload the package data into this control
        /// </summary>
        private void ReloadNodes()
        {
            using (tvItems.BeginUpdate())
            {
                var modulesNodes   = new TreeNode("Modules");
                var locsNodes      = new TreeNode("Locs");
                var locGroupsNodes = new TreeNode("Loc groups");
                tvItems.Nodes.Add(new EntityNode(railway, null));
                tvItems.Nodes.Add(locsNodes);
                tvItems.Nodes.Add(locGroupsNodes);
                tvItems.Nodes.Add(modulesNodes);

                foreach (var locRef in railway.Locs.OrderBy(x => x.ToString()))
                {
                    ILoc loc;
                    if (locRef.TryResolve(out loc))
                    {
                        locsNodes.Nodes.Add(new EntityRefNode <ILoc>(locRef, loc));
                    }
                }
                foreach (var locGroup in railway.LocGroups.OrderBy(x => x.ToString()))
                {
                    locGroupsNodes.Nodes.Add(new EntityNode(locGroup, null));
                }
                foreach (var moduleRef in railway.Modules.OrderBy(x => x.ToString()))
                {
                    IModule module;
                    if (moduleRef.TryResolve(out module))
                    {
                        if (firstModule == null)
                        {
                            firstModule = module;
                        }
                        var moduleNode = new EntityRefNode <IModule>(moduleRef, module);
                        modulesNodes.Nodes.Add(moduleNode);

                        var moduleTree = new ModuleTree(moduleNode.Nodes);
                        moduleTree.ReloadModule(module, null, false);
                        moduleNode.Collapse(false);
                    }
                }

                tvItems.ExpandAll();
            }
        }