using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.VirtualEarth.MapControl;

namespace CustomMapImagery
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            MapTileLayer customTileLayer = new MapTileLayer();
            LocationRect boundingRect = new LocationRect(
                        new Location(49.9915720948007, 14.5791563924893),
                        new Location(50.1252788649904, 14.7184119383853)
                    );

            LocationRectTileSource customTileSource = new LocationRectTileSource();

            customTileSource.UriFormat = "http://localhost:19738/CustomTiles/{0}.png";
            customTileSource.ZoomRange = new Range<double>(11, 16);
            customTileSource.BoundingRectangle = boundingRect;
            customTileLayer.TileSources.Add(customTileSource);
            customTileLayer.Opacity = 0.7;

            _map.Children.Add(customTileLayer);
        }
    }
}
