mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 06:26:41 +00:00
Bing Maps Key from file
This commit is contained in:
parent
3d93a14eb0
commit
8aed92638f
2 changed files with 29 additions and 13 deletions
|
|
@ -1,31 +1,49 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using MapControl;
|
||||
using MapControl.Caching;
|
||||
using ViewModel;
|
||||
|
||||
namespace WpfApplication
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
static MainWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
ImageLoader.HttpClient.DefaultRequestHeaders.Add("User-Agent", "XAML Map Control Test Application");
|
||||
|
||||
TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new FileDbCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new SQLiteCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = null;
|
||||
|
||||
BingMapsTileLayer.ApiKey = File.ReadAllText(@"..\..\..\BingMapsApiKey.txt")?.Trim();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
ImageLoader.HttpClient.DefaultRequestHeaders.Add("User-Agent", "XAML Map Control Test Application");
|
||||
var cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
TileImageLoader.Cache = cache;
|
||||
//TileImageLoader.Cache = new MapControl.Caching.FileDbCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new MapControl.Caching.SQLiteCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = null;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += async (s, e) =>
|
||||
if (TileImageLoader.Cache is ImageFileCache cache)
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
await cache.Clean();
|
||||
};
|
||||
Loaded += async (s, e) =>
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
await cache.Clean();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void MapMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue