2017-08-04 21:38:58 +02:00
|
|
|
|
using MapControl;
|
|
|
|
|
|
using MapControl.Caching;
|
|
|
|
|
|
using ViewModel;
|
2018-08-14 23:13:58 +02:00
|
|
|
|
using Windows.UI;
|
2015-08-09 20:04:44 +02:00
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
using Windows.UI.Xaml.Controls;
|
|
|
|
|
|
using Windows.UI.Xaml.Controls.Primitives;
|
2018-08-14 23:13:58 +02:00
|
|
|
|
using Windows.UI.Xaml.Media;
|
2015-08-09 20:04:44 +02:00
|
|
|
|
|
|
|
|
|
|
namespace UniversalApp
|
|
|
|
|
|
{
|
|
|
|
|
|
public sealed partial class MainPage : Page
|
|
|
|
|
|
{
|
2017-06-25 23:05:48 +02:00
|
|
|
|
public MapViewModel ViewModel { get; } = new MapViewModel();
|
|
|
|
|
|
|
2015-08-09 20:04:44 +02:00
|
|
|
|
public MainPage()
|
|
|
|
|
|
{
|
2018-08-14 23:13:58 +02:00
|
|
|
|
TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
2017-08-04 21:38:58 +02:00
|
|
|
|
//TileImageLoader.Cache = new FileDbCache(TileImageLoader.DefaultCacheFolder);
|
2015-08-09 20:04:44 +02:00
|
|
|
|
|
2016-08-08 20:36:02 +02:00
|
|
|
|
InitializeComponent();
|
2017-06-25 23:05:48 +02:00
|
|
|
|
DataContext = ViewModel;
|
2018-08-14 23:13:58 +02:00
|
|
|
|
|
|
|
|
|
|
for (var x = -180d; x < 180d; x += 15d)
|
|
|
|
|
|
{
|
|
|
|
|
|
var location = new Location(0d, x);
|
|
|
|
|
|
|
|
|
|
|
|
var locations = new LocationCollection
|
|
|
|
|
|
{
|
|
|
|
|
|
new Location(0, x - 5),
|
|
|
|
|
|
new Location(5, x),
|
|
|
|
|
|
new Location(0, x + 5),
|
|
|
|
|
|
new Location(-5, x)
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
map.Children.Add(new MapPolygon
|
|
|
|
|
|
{
|
|
|
|
|
|
Fill = new SolidColorBrush(Colors.Red) { Opacity = 0.25 },
|
|
|
|
|
|
Stroke = new SolidColorBrush(Colors.Red),
|
|
|
|
|
|
StrokeThickness = 2,
|
|
|
|
|
|
StrokeLineJoin = PenLineJoin.Round,
|
|
|
|
|
|
Locations = locations,
|
|
|
|
|
|
Location = location,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
map.Children.Add(new Pushpin
|
|
|
|
|
|
{
|
|
|
|
|
|
Content = x,
|
|
|
|
|
|
Location = location,
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2015-08-09 20:04:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (mapImage != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
mapImage.Opacity = e.NewValue / 100;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2017-06-25 23:05:48 +02:00
|
|
|
|
map.Children.Insert(map.Children.IndexOf(mapGraticule), ViewModel.MapLayers.SeamarksLayer);
|
2015-08-09 20:04:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2017-06-25 23:05:48 +02:00
|
|
|
|
map.Children.Remove(ViewModel.MapLayers.SeamarksLayer);
|
2015-08-09 20:04:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|