.NET 9, including UWP

This commit is contained in:
ClemensFischer 2025-09-14 21:02:21 +02:00
parent 3526438f58
commit cf0f4645d4
56 changed files with 484 additions and 1206 deletions

View file

@ -34,10 +34,9 @@ namespace MapControl
if (File.Exists(path))
{
using (var stream = File.OpenRead(path))
{
image = LoadImage(stream);
}
using var stream = File.OpenRead(path);
image = LoadImage(stream);
}
return image;

View file

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-windows;net462</TargetFrameworks>
<LangVersion Condition="'$(TargetFramework)'=='net462'">8.0</LangVersion>
<UseWPF>true</UseWPF>
<DefineConstants>WPF</DefineConstants>
<RootNamespace>MapControl</RootNamespace>
@ -25,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.9" />
</ItemGroup>
</Project>

View file

@ -54,29 +54,27 @@ namespace MapControl
protected void UpdateData(IEnumerable<Location> locations, bool closed)
{
using (var context = ((StreamGeometry)Data).Open())
{
if (ParentMap != null && locations != null)
{
var longitudeOffset = GetLongitudeOffset(Location ?? locations.FirstOrDefault());
using var context = ((StreamGeometry)Data).Open();
AddPolylinePoints(context, locations, longitudeOffset, closed);
}
if (ParentMap != null && locations != null)
{
var longitudeOffset = GetLongitudeOffset(Location ?? locations.FirstOrDefault());
AddPolylinePoints(context, locations, longitudeOffset, closed);
}
}
protected void UpdateData(IEnumerable<IEnumerable<Location>> polygons)
{
using (var context = ((StreamGeometry)Data).Open())
{
if (ParentMap != null && polygons != null)
{
var longitudeOffset = GetLongitudeOffset(Location);
using var context = ((StreamGeometry)Data).Open();
foreach (var locations in polygons)
{
AddPolylinePoints(context, locations, longitudeOffset, true);
}
if (ParentMap != null && polygons != null)
{
var longitudeOffset = GetLongitudeOffset(Location);
foreach (var locations in polygons)
{
AddPolylinePoints(context, locations, longitudeOffset, true);
}
}
}