2013-11-17 16:52:03 +01:00
|
|
|
|
using MapControl;
|
2012-11-22 21:42:29 +01:00
|
|
|
|
using Windows.UI.Xaml;
|
|
|
|
|
|
using Windows.UI.Xaml.Controls;
|
2013-04-12 19:59:16 +02:00
|
|
|
|
using Windows.UI.Xaml.Controls.Primitives;
|
2012-05-04 12:52:20 +02:00
|
|
|
|
|
2012-11-22 21:42:29 +01:00
|
|
|
|
namespace StoreApplication
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
2012-11-22 21:42:29 +01:00
|
|
|
|
public sealed partial class MainPage : Page
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
2014-10-19 21:50:23 +02:00
|
|
|
|
private TileLayerCollection tileLayers;
|
|
|
|
|
|
|
2012-11-22 21:42:29 +01:00
|
|
|
|
public MainPage()
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
2014-07-09 21:27:28 +02:00
|
|
|
|
TileImageLoader.Cache = new ImageFileCache();
|
2014-10-19 21:50:23 +02:00
|
|
|
|
//BingMapsTileLayer.ApiKey = ...
|
2014-07-09 21:27:28 +02:00
|
|
|
|
|
2012-11-22 21:42:29 +01:00
|
|
|
|
this.InitializeComponent();
|
2014-07-09 21:27:28 +02:00
|
|
|
|
|
2014-10-19 21:50:23 +02:00
|
|
|
|
tileLayers = (TileLayerCollection)Resources["TileLayers"];
|
|
|
|
|
|
tileLayerComboBox.SelectedIndex = 0;
|
2012-05-04 12:52:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-04-12 19:59:16 +02:00
|
|
|
|
private void ImageOpacitySliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
2013-04-12 19:59:16 +02:00
|
|
|
|
if (mapImage != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
mapImage.Opacity = e.NewValue / 100;
|
|
|
|
|
|
}
|
2012-05-04 12:52:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-06-11 23:03:13 +02:00
|
|
|
|
private void TileLayerSelectionChanged(object sender, SelectionChangedEventArgs e)
|
2012-05-04 12:52:20 +02:00
|
|
|
|
{
|
2014-10-19 21:50:23 +02:00
|
|
|
|
var selectedItem = (ComboBoxItem)tileLayerComboBox.SelectedItem;
|
|
|
|
|
|
|
|
|
|
|
|
map.TileLayer = tileLayers[(string)selectedItem.Tag];
|
|
|
|
|
|
|
|
|
|
|
|
mapLegend.Inlines.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var inline in map.TileLayer.DescriptionInlines)
|
|
|
|
|
|
{
|
|
|
|
|
|
mapLegend.Inlines.Add(inline);
|
|
|
|
|
|
}
|
2014-06-11 23:03:13 +02:00
|
|
|
|
}
|
2012-05-04 12:52:20 +02:00
|
|
|
|
|
2014-06-11 23:03:13 +02:00
|
|
|
|
private void SeamarksChecked(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
2014-10-19 21:50:23 +02:00
|
|
|
|
map.TileLayers.Add(tileLayers["Seamarks"]);
|
2012-11-22 21:42:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-06-11 23:03:13 +02:00
|
|
|
|
private void SeamarksUnchecked(object sender, RoutedEventArgs e)
|
2012-11-22 21:42:29 +01:00
|
|
|
|
{
|
2014-10-19 21:50:23 +02:00
|
|
|
|
map.TileLayers.Remove(tileLayers["Seamarks"]);
|
2012-05-04 12:52:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|