Esempio n. 1
0
        private void LoadDefinedRegion()
        {
            _tree.Nodes.Clear();
            DefinedRegionParse defineRegion = new DefinedRegionParse();
            BlockDefined       blockDefined = defineRegion.BlockDefined;

            if (blockDefined == null || blockDefined.BlockItemGroups == null || blockDefined.BlockItemGroups.Length == 0)
            {
                return;
            }
            foreach (BlockItemGroup group in blockDefined.BlockItemGroups)
            {
                PrjEnvelopeItem[] envs = group.BlockItems;
                RadTreeNode       node = new RadTreeNode(string.Format("{0}[{1}]({2})", group.Name, group.Description, envs.Length));
                node.Tag       = group;
                node.CheckType = CheckType.CheckBox;
                foreach (PrjEnvelopeItem env in envs)
                {
                    RadTreeNode item = new RadTreeNode(env.Name);
                    item.CheckType = CheckType.CheckBox;
                    item.Tag       = env;
                    node.Nodes.Add(item);
                }
                _tree.Nodes.Add(node);
            }
        }
Esempio n. 2
0
        private void LoadUserDefinedRegion()
        {
            _groups = new List <BlockItemGroup>();
            _tree.Nodes.Clear();
            DefinedRegionParse p = new DefinedRegionParse();

            _blockRef = p.BlockDefined;
            BlockItemGroup[] blockGroup = _blockRef.UserDefineRegion;
            if (blockGroup == null || blockGroup.Length == 0)
            {
                return;
            }
            for (int i = 0; i < blockGroup.Length; i++)
            {
                BlockItemGroup group = blockGroup[i];
                _groups.Add(group);
                AddGroupToTree(group);
            }
            if (_tree.Nodes.Count > 0)
            {
                _tree.SelectedNode = _tree.Nodes[_tree.Nodes.Count - 1];
                _tree.SelectedNode.ExpandAll();
            }
            //_tree.ExpandAll();
        }
Esempio n. 3
0
        public static void Save(BlockDefined blockDefined)
        {
            var xml = new XElement("Root",
                                   from item in blockDefined.BlockItemGroups
                                   select new XElement("EnvelopeGroup",
                                                       new XAttribute("name", item.Name),
                                                       new XAttribute("description", item.Description == null ? "" : item.Description),
                                                       new XAttribute("identify", item.Identify == null ? "" : item.Identify),
                                                       from block in item.BlockItems
                                                       select new XElement("EnvelopeItem",
                                                                           new XAttribute("name", block.Name),
                                                                           new XAttribute("identify", block.Identify == null ? "" : block.Identify),
                                                                           new XAttribute("minLongitude", block.PrjEnvelope.MinX),
                                                                           new XAttribute("minLatitude", block.PrjEnvelope.MinY),
                                                                           new XAttribute("maxLongitude", block.PrjEnvelope.MaxX),
                                                                           new XAttribute("maxLatitude", block.PrjEnvelope.MaxY))));

            string file = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, config);

            if (!Directory.Exists(Path.GetDirectoryName(file)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(file));
            }
            xml.Save(file);
        }