コード例 #1
0
        public WindowShapeFileTest(ShapeFileInfo shapeFileInfo)
        {
            Areas = new List <string>();
            try
            {
                _sf = new ShapeFile(shapeFileInfo.Filename);
                if (_sf.Initialize(shapeFileInfo.TableName,
                                   (ShapeFile.CoordType)Enum.Parse(typeof(ShapeFile.CoordType), shapeFileInfo.TCoord),
                                   (AreaType)Enum.Parse(typeof(AreaType), shapeFileInfo.TArea),
                                   shapeFileInfo.Prefix ?? "",
                                   shapeFileInfo.Encoding))
                {
                    var ail = _sf.AreaInfos;
                    Areas = (from a in ail orderby a.Name select a.Name).ToList();
                }
            }
            catch
            {
            }
            InitializeComponent();
            _browser = new UIControls.WebBrowserControl();
            this.webBrowser.Children.Add(_browser);
            DataContext = this;

            this.Closed += WindowShapeFileTest_Closed;
        }
コード例 #2
0
        public bool Initialize()
        {
            Clear();

            var items = Settings.Settings.Default.GetShapeFileItems();
            foreach (var item in items)
            {
                try
                {
                    if (item.Enabled != 0)
                    {
                        if (System.IO.File.Exists(item.FileName))
                        {
                            ShapeFile sf = new ShapeFile(item.FileName);
                            if (sf.Initialize(item.TableName,
                                (ShapeFile.CoordType)Enum.Parse(typeof(ShapeFile.CoordType), item.CoordType),
                                (AreaType)Enum.Parse(typeof(AreaType), item.AreaType),
                                item.NamePrefix??"",
                                item.Encoding))
                            {
                                _shapeFiles.Add(sf);
                            }
                        }
                    }
                }
                catch
                {
                }
            }

            if (PropertyChanged!=null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(""));
            }

            return true;
        }