mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-01-01 06:10:02 +01:00
Removed cache cleaning from MainWindow
This commit is contained in:
parent
cdb7d4af15
commit
2f3c704fd7
|
|
@ -1,5 +1,4 @@
|
|||
using MapControl;
|
||||
using MapControl.Caching;
|
||||
using MapControl.UiTools;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Input;
|
||||
|
|
@ -11,7 +10,6 @@ using System.Diagnostics;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.System;
|
||||
|
||||
namespace SampleApplication
|
||||
|
|
@ -20,9 +18,14 @@ namespace SampleApplication
|
|||
{
|
||||
static MainWindow()
|
||||
{
|
||||
//TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new FileDbCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new SQLiteCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new MapControl.Caching.ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new MapControl.Caching.FileDbCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new MapControl.Caching.SQLiteCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new RedisCache(Options.Create(new RedisCacheOptions
|
||||
//{
|
||||
// Configuration = "localhost:6379",
|
||||
// InstanceName = "MapTileCache/"
|
||||
//}));
|
||||
|
||||
var bingMapsApiKeyPath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "BingMapsApiKey.txt");
|
||||
|
|
@ -80,23 +83,10 @@ namespace SampleApplication
|
|||
}
|
||||
|
||||
AddTestLayers();
|
||||
|
||||
if (TileImageLoader.Cache is ImageFileCache)
|
||||
{
|
||||
Activated += WindowActivated;
|
||||
}
|
||||
}
|
||||
|
||||
partial void AddTestLayers();
|
||||
|
||||
private async void WindowActivated(object sender, WindowActivatedEventArgs e)
|
||||
{
|
||||
Activated -= WindowActivated;
|
||||
|
||||
await Task.Delay(2000);
|
||||
await ((ImageFileCache)TileImageLoader.Cache).CleanAsync();
|
||||
}
|
||||
|
||||
private void ResetHeadingButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
map.TargetHeading = 0d;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
using MapControl;
|
||||
using MapControl.Caching;
|
||||
using MapControl.UiTools;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
|
|
@ -19,6 +17,11 @@ namespace SampleApplication
|
|||
//TileImageLoader.Cache = new ImageFileCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new FileDbCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new SQLiteCache(TileImageLoader.DefaultCacheFolder);
|
||||
//TileImageLoader.Cache = new RedisCache(Options.Create(new RedisCacheOptions
|
||||
//{
|
||||
// Configuration = "localhost:6379",
|
||||
// InstanceName = "MapTileCache/"
|
||||
//}));
|
||||
|
||||
var bingMapsApiKeyPath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "BingMapsApiKey.txt");
|
||||
|
|
@ -55,15 +58,6 @@ namespace SampleApplication
|
|||
}
|
||||
|
||||
AddTestLayers();
|
||||
|
||||
if (TileImageLoader.Cache is ImageFileCache cache)
|
||||
{
|
||||
Loaded += async (s, e) =>
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
await cache.CleanAsync();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
partial void AddTestLayers();
|
||||
|
|
|
|||
Loading…
Reference in a new issue