コード例 #1
0
        private async Task FilePropertyChanged(string file)
        {
            (TileSource as MBTileSource)?.Dispose();

            ClearValue(TileSourceProperty);
            ClearValue(SourceNameProperty);
            ClearValue(DescriptionProperty);
            ClearValue(MinZoomLevelProperty);
            ClearValue(MaxZoomLevelProperty);

            if (file != null)
            {
                var tileData = await MBTileData.CreateAsync(file);

                int    minZoom;
                int    maxZoom;
                string s;

                if (tileData.Metadata.TryGetValue("name", out s))
                {
                    SourceName = s;
                }

                if (tileData.Metadata.TryGetValue("description", out s))
                {
                    Description = s;
                }

                if (tileData.Metadata.TryGetValue("minzoom", out s) && int.TryParse(s, out minZoom))
                {
                    MinZoomLevel = minZoom;
                }

                if (tileData.Metadata.TryGetValue("maxzoom", out s) && int.TryParse(s, out maxZoom))
                {
                    MaxZoomLevel = maxZoom;
                }

                TileSource = CreateTileSource(tileData);
            }
        }
コード例 #2
0
        public static async Task <MBTileSource> CreateAsync(string file)
        {
            var tileData = await MBTileData.CreateAsync(file);

            return(new MBTileSource(tileData, await tileData.ReadMetaDataAsync()));
        }