/// <summary>
        /// Default ctor
        /// </summary>
        public EditModuleControl()
        {
            InitializeComponent();
            tvItems.SelectionManager    = selectionManager;
            viewEditor.SelectionManager = selectionManager;
            selectionManager.Changed   += OnSelectionChanged;
            moduleTree = new ModuleTree(tvItems.Nodes);

            splitContainer.Panel1MinSize = 200;
            splitContainer.Panel2MinSize = 300;
        }
        /// <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();
            }
        }