.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

@ -1,34 +0,0 @@
[*.cs]
# CA1835: Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes
dotnet_diagnostic.CA1835.severity = silent
# CA1868: Unnecessary call to 'Contains' for sets
dotnet_diagnostic.CA1868.severity = silent
# CsWinRT1028: Class is not marked partial
dotnet_diagnostic.CsWinRT1028.severity = silent
# CsWinRT1030: Project does not enable unsafe blocks
dotnet_diagnostic.CsWinRT1030.severity = silent
# IDE0063: Use simple 'using' statement
dotnet_diagnostic.IDE0063.severity = silent
# IDE0074: Use compound assignment
dotnet_diagnostic.IDE0074.severity = silent
# IDE0090: Simplify 'new' expression
dotnet_diagnostic.IDE0090.severity = silent
# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = silent
# IDE030X: Use collection expression
dotnet_diagnostic.IDE0300.severity = silent
dotnet_diagnostic.IDE0301.severity = silent
dotnet_diagnostic.IDE0302.severity = silent
dotnet_diagnostic.IDE0303.severity = silent
dotnet_diagnostic.IDE0304.severity = silent
dotnet_diagnostic.IDE0305.severity = silent
dotnet_diagnostic.IDE0306.severity = silent

View file

@ -11,8 +11,8 @@
<ItemGroup>
<PackageReference Include="FileDb.Standard" Version="7.4.4" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.9" />
</ItemGroup>
</Project>

View file

@ -10,9 +10,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.9" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
</ItemGroup>
</Project>

View file

@ -3,7 +3,7 @@
<Product>XAML Map Control</Product>
<Authors>Clemens Fischer</Authors>
<Copyright>Copyright © 2025 Clemens Fischer</Copyright>
<Version>13.6.0</Version>
<Version>14.0.0</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl.MBTiles</RootNamespace>
<AssemblyTitle>XAML Map Control MBTiles Library for Avalonia UI</AssemblyTitle>
@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.5" />
<PackageReference Include="Avalonia" Version="11.3.6" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
</ItemGroup>
</Project>

View file

@ -1,81 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapControl.MBTiles</RootNamespace>
<AssemblyName>MBTiles.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.26100.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\MBTileLayer.cs">
<Link>MBTileLayer.cs</Link>
</Compile>
<Compile Include="..\Shared\MBTileSource.cs">
<Link>MBTileSource.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\MBTiles.UWP.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="System.Data.SQLite.Core">
<Version>1.0.119</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk">
<Link>MapControl.snk</Link>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj">
<Project>{9545f73c-9c35-4cf6-baae-19a0baebd344}</Project>
<Name>MapControl.UWP</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
<DefaultLanguage>en-US</DefaultLanguage>
<DefineConstants>UWP</DefineConstants>
<RootNamespace>MapControl.MBTiles</RootNamespace>
<AssemblyTitle>XAML Map Control MBTiles Library for UWP</AssemblyTitle>
<GeneratePackageOnBuild>$(GeneratePackage)</GeneratePackageOnBuild>
<PackageId>XAML.MapControl.MBTiles.UWP</PackageId>
<Title>$(AssemblyTitle)</Title>
<Description>MBTiles library for XAML Map Control</Description>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
</ItemGroup>
</Project>

View file

@ -1,13 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control MBTiles Library for UWP")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2024 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("13.0.0")]
[assembly: AssemblyFileVersion("13.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="MBTiles.UWP">
</Library>
</Directives>

View file

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl.MBTiles</RootNamespace>
@ -21,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.250907003" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4948" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
</ItemGroup>

View file

@ -5,19 +5,11 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapControl", "MapControl", "{52AECE49-F314-4F76-98F2-FA800F07824B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{8F2103C2-78AF-4810-8FB9-67572F50C8FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalApp", "SampleApps\UniversalApp\UniversalApp.csproj", "{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.UWP", "MapControl\UWP\MapControl.UWP.csproj", "{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WPF", "MapControl\WPF\MapControl.WPF.csproj", "{62F1726B-3144-49F4-8BCC-94160A3B2186}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WinUI", "MapControl\WinUI\MapControl.WinUI.csproj", "{92894476-02E1-47CB-936E-4154023456F0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinUiApp", "SampleApps\WinUiApp\WinUiApp.csproj", "{579B29D7-91CA-44F3-A96D-5D9BC957BADA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.UWP", "MapControl\UWP\MapControl.UWP.csproj", "{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapUiTools", "MapUiTools", "{ABFA5526-FCE4-47C9-94F4-84D5F59EECA8}"
EndProject
@ -25,11 +17,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.WPF", "MapUiTool
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.WinUI", "MapUiTools\WinUI\MapUiTools.WinUI.csproj", "{A877A741-9FF5-453D-89C8-3BE7A94D74C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapUiTools.UWP", "MapUiTools\UWP\MapUiTools.UWP.csproj", "{DFFE8E49-AA07-457E-A459-99326B44F828}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.UWP", "MapUiTools\UWP\MapUiTools.UWP.csproj", "{DFFE8E49-AA07-457E-A459-99326B44F828}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{8F2103C2-78AF-4810-8FB9-67572F50C8FC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinUiApp", "SampleApps\WinUiApp\WinUiApp.csproj", "{579B29D7-91CA-44F3-A96D-5D9BC957BADA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversalApp", "SampleApps\UniversalApp\UniversalApp.csproj", "{D90514BC-38EC-7FB4-BF26-2FC775815D46}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2F7354B4-786D-4113-866C-E731276C6777}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
@ -39,12 +38,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.ActiveCfg = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Build.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Deploy.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.ActiveCfg = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Build.0 = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Deploy.0 = Release|x64
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -79,12 +72,17 @@ Global
{DFFE8E49-AA07-457E-A459-99326B44F828}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFFE8E49-AA07-457E-A459-99326B44F828}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFFE8E49-AA07-457E-A459-99326B44F828}.Release|Any CPU.Build.0 = Release|Any CPU
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Debug|Any CPU.ActiveCfg = Debug|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Debug|Any CPU.Build.0 = Debug|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Debug|Any CPU.Deploy.0 = Debug|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Release|Any CPU.ActiveCfg = Release|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Release|Any CPU.Build.0 = Release|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Release|Any CPU.Deploy.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{62F1726B-3144-49F4-8BCC-94160A3B2186} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{CA60DFDB-0BE1-40F6-B575-CDC797A40E2E} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
@ -93,6 +91,7 @@ Global
{9B2886B0-D2A8-479B-B52E-1C7B63CAB97E} = {ABFA5526-FCE4-47C9-94F4-84D5F59EECA8}
{A877A741-9FF5-453D-89C8-3BE7A94D74C1} = {ABFA5526-FCE4-47C9-94F4-84D5F59EECA8}
{DFFE8E49-AA07-457E-A459-99326B44F828} = {ABFA5526-FCE4-47C9-94F4-84D5F59EECA8}
{D90514BC-38EC-7FB4-BF26-2FC775815D46} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB}

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl</RootNamespace>
@ -16,8 +16,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.5" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.8" />
<PackageReference Include="Avalonia" Version="11.3.6" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.9" />
</ItemGroup>
</Project>

View file

@ -63,7 +63,7 @@ namespace MapControl
private static string QueryString(ushort tag) => $"/ifd/{{ushort={tag}}}";
private static ILogger logger;
private static ILogger Logger => logger ?? (logger = ImageLoader.LoggerFactory?.CreateLogger(nameof(GeoImage)));
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>();
public static readonly DependencyProperty SourcePathProperty =
DependencyPropertyHelper.RegisterAttached<string>("SourcePath", typeof(GeoImage), null,
@ -158,33 +158,32 @@ namespace MapControl
private static async Task<Matrix> ReadWorldFileMatrix(string worldFilePath)
{
using (var fileStream = File.OpenRead(worldFilePath))
using (var streamReader = new StreamReader(fileStream))
using var fileStream = File.OpenRead(worldFilePath);
using var streamReader = new StreamReader(fileStream);
var parameters = new double[6];
var index = 0;
string line;
while (index < 6 &&
(line = await streamReader.ReadLineAsync()) != null &&
double.TryParse(line, NumberStyles.Float, CultureInfo.InvariantCulture, out double parameter))
{
var parameters = new double[6];
var index = 0;
string line;
while (index < 6 &&
(line = await streamReader.ReadLineAsync()) != null &&
double.TryParse(line, NumberStyles.Float, CultureInfo.InvariantCulture, out double parameter))
{
parameters[index++] = parameter;
}
if (index != 6)
{
throw new ArgumentException($"Insufficient number of parameters in world file {worldFilePath}.");
}
return new Matrix(
parameters[0], // line 1: A or M11
parameters[1], // line 2: D or M12
parameters[2], // line 3: B or M21
parameters[3], // line 4: E or M22
parameters[4], // line 5: C or OffsetX
parameters[5]); // line 6: F or OffsetY
parameters[index++] = parameter;
}
if (index != 6)
{
throw new ArgumentException($"Insufficient number of parameters in world file {worldFilePath}.");
}
return new Matrix(
parameters[0], // line 1: A or M11
parameters[1], // line 2: D or M12
parameters[2], // line 3: B or M21
parameters[3], // line 4: E or M22
parameters[4], // line 5: C or OffsetX
parameters[5]); // line 6: F or OffsetY
}
private static MapProjection GetProjection(short[] geoKeyDirectory)

View file

@ -52,23 +52,22 @@ namespace MapControl
if (entry != null)
{
using (var memoryStream = new MemoryStream((int)entry.Length))
using var memoryStream = new MemoryStream((int)entry.Length);
using (var zipStream = entry.Open())
{
using (var zipStream = entry.Open())
{
zipStream.CopyTo(memoryStream); // can't use CopyToAsync with ZipArchive
}
memoryStream.Seek(0, SeekOrigin.Begin);
Image.Source = await ImageLoader.LoadImageAsync(memoryStream);
zipStream.CopyTo(memoryStream); // can't use CopyToAsync with ZipArchive
}
memoryStream.Seek(0, SeekOrigin.Begin);
Image.Source = await ImageLoader.LoadImageAsync(memoryStream);
}
}
}
private static ILogger logger;
private static ILogger Logger => logger ?? (logger = ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>());
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>();
public static readonly DependencyProperty SourcePathProperty =
DependencyPropertyHelper.Register<GroundOverlay, string>(nameof(SourcePath), null,
@ -127,20 +126,19 @@ namespace MapControl
private static async Task<List<ImageOverlay>> LoadImageOverlaysFromArchive(string archiveFilePath)
{
using (var archive = ZipFile.OpenRead(archiveFilePath))
using var archive = ZipFile.OpenRead(archiveFilePath);
var docEntry = archive.GetEntry("doc.kml") ??
archive.Entries.FirstOrDefault(e => e.Name.EndsWith(".kml")) ??
throw new ArgumentException($"No KML entry found in {archiveFilePath}.");
XDocument document;
using (var docStream = docEntry.Open())
{
var docEntry = archive.GetEntry("doc.kml") ??
archive.Entries.FirstOrDefault(e => e.Name.EndsWith(".kml")) ??
throw new ArgumentException($"No KML entry found in {archiveFilePath}.");
XDocument document;
using (var docStream = docEntry.Open())
{
document = await LoadXDocument(docStream);
}
return await LoadImageOverlays(document, imageOverlay => imageOverlay.LoadImage(archive));
document = await LoadXDocument(docStream);
}
return await LoadImageOverlays(document, imageOverlay => imageOverlay.LoadImage(archive));
}
private static async Task<List<ImageOverlay>> LoadImageOverlaysFromFile(string docFilePath)

View file

@ -326,34 +326,30 @@ namespace MapControl.Caching
private static byte[] ReadAllBytes(FileInfo file)
{
using (var stream = file.OpenRead())
using var stream = file.OpenRead();
var buffer = new byte[stream.Length];
var offset = 0;
while (offset < buffer.Length)
{
var buffer = new byte[stream.Length];
var offset = 0;
while (offset < buffer.Length)
{
offset += stream.Read(buffer, offset, buffer.Length - offset);
}
return buffer;
offset += stream.Read(buffer, offset, buffer.Length - offset);
}
return buffer;
}
private static async Task<byte[]> ReadAllBytes(FileInfo file, CancellationToken token)
{
using (var stream = file.OpenRead())
using var stream = file.OpenRead();
var buffer = new byte[stream.Length];
var offset = 0;
while (offset < buffer.Length)
{
var buffer = new byte[stream.Length];
var offset = 0;
while (offset < buffer.Length)
{
offset += await stream.ReadAsync(buffer, offset, buffer.Length - offset, token).ConfigureAwait(false);
}
return buffer;
offset += await stream.ReadAsync(buffer, offset, buffer.Length - offset, token).ConfigureAwait(false);
}
return buffer;
}
private static void SetExpiration(FileInfo file, DistributedCacheEntryOptions options)

View file

@ -16,7 +16,7 @@ namespace MapControl
public static partial class ImageLoader
{
private static ILogger logger;
private static ILogger Logger => logger ?? (logger = LoggerFactory?.CreateLogger(typeof(ImageLoader)));
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>();
public static ILoggerFactory LoggerFactory { get; set; }
@ -33,10 +33,9 @@ namespace MapControl
public static async Task<ImageSource> LoadImageAsync(byte[] buffer)
{
using (var stream = new MemoryStream(buffer))
{
return await LoadImageAsync(stream);
}
using var stream = new MemoryStream(buffer);
return await LoadImageAsync(stream);
}
public static async Task<ImageSource> LoadImageAsync(Uri uri, IProgress<double> progress = null)
@ -84,25 +83,24 @@ namespace MapControl
{
var completionOptions = progress != null ? HttpCompletionOption.ResponseHeadersRead : HttpCompletionOption.ResponseContentRead;
using (var responseMessage = await HttpClient.GetAsync(uri, completionOptions).ConfigureAwait(false))
{
if (responseMessage.IsSuccessStatusCode)
{
if (progress != null && responseMessage.Content.Headers.ContentLength.HasValue)
{
buffer = await ReadAsByteArray(responseMessage.Content, progress).ConfigureAwait(false);
}
else
{
buffer = await responseMessage.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
}
using var responseMessage = await HttpClient.GetAsync(uri, completionOptions).ConfigureAwait(false);
maxAge = responseMessage.Headers.CacheControl?.MaxAge;
if (responseMessage.IsSuccessStatusCode)
{
if (progress != null && responseMessage.Content.Headers.ContentLength.HasValue)
{
buffer = await ReadAsByteArray(responseMessage.Content, progress).ConfigureAwait(false);
}
else
{
Logger?.LogWarning("{status} ({reason}) from {uri}", (int)responseMessage.StatusCode, responseMessage.ReasonPhrase, uri);
buffer = await responseMessage.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
}
maxAge = responseMessage.Headers.CacheControl?.MaxAge;
}
else
{
Logger?.LogWarning("{status} ({reason}) from {uri}", (int)responseMessage.StatusCode, responseMessage.ReasonPhrase, uri);
}
}
catch (TaskCanceledException)

View file

@ -23,7 +23,7 @@ namespace MapControl
public class TileImageLoader : ITileImageLoader
{
private static ILogger logger;
private static ILogger Logger => logger ?? (logger = ImageLoader.LoggerFactory?.CreateLogger<TileImageLoader>());
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>();
/// <summary>
/// Default folder path where a persistent cache implementation may save data, i.e. "C:\ProgramData\MapControl\TileCache".

View file

@ -26,7 +26,7 @@ namespace MapControl
public class WmsImageLayer : MapImageLayer
{
private static ILogger logger;
private static ILogger Logger => logger ?? (logger = ImageLoader.LoggerFactory?.CreateLogger<WmsImageLayer>());
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>();
public static readonly DependencyProperty ServiceUriProperty =
DependencyPropertyHelper.Register<WmsImageLayer, Uri>(nameof(ServiceUri), null,
@ -112,10 +112,9 @@ namespace MapControl
{
try
{
using (var stream = await ImageLoader.HttpClient.GetStreamAsync(uri))
{
element = XDocument.Load(stream).Root;
}
using var stream = await ImageLoader.HttpClient.GetStreamAsync(uri);
element = XDocument.Load(stream).Root;
}
catch (Exception ex)
{

View file

@ -31,10 +31,9 @@ namespace MapControl
if (capabilitiesUri.IsAbsoluteUri && (capabilitiesUri.Scheme == "http" || capabilitiesUri.Scheme == "https"))
{
using (var stream = await ImageLoader.HttpClient.GetStreamAsync(capabilitiesUri))
{
capabilities = ReadCapabilities(XDocument.Load(stream).Root, layer, capabilitiesUri.ToString());
}
using var stream = await ImageLoader.HttpClient.GetStreamAsync(capabilitiesUri);
capabilities = ReadCapabilities(XDocument.Load(stream).Root, layer, capabilitiesUri.ToString());
}
else
{
@ -46,12 +45,8 @@ namespace MapControl
public static WmtsCapabilities ReadCapabilities(XElement capabilitiesElement, string layer, string capabilitiesUrl)
{
var contentsElement = capabilitiesElement.Element(wmts + "Contents");
if (contentsElement == null)
{
throw new ArgumentException("Contents element not found.");
}
var contentsElement = capabilitiesElement.Element(wmts + "Contents")
?? throw new ArgumentException("Contents element not found.");
XElement layerElement;
@ -102,12 +97,8 @@ namespace MapControl
{
var tileMatrixSetElement = contentsElement
.Elements(wmts + "TileMatrixSet")
.FirstOrDefault(s => s.Element(ows + "Identifier")?.Value == tileMatrixSetId);
if (tileMatrixSetElement == null)
{
throw new ArgumentException($"Linked TileMatrixSet element not found in Layer \"{layer}\".");
}
.FirstOrDefault(s => s.Element(ows + "Identifier")?.Value == tileMatrixSetId)
?? throw new ArgumentException($"Linked TileMatrixSet element not found in Layer \"{layer}\".");
tileMatrixSets.Add(ReadTileMatrixSet(tileMatrixSetElement));
}
@ -134,7 +125,7 @@ namespace MapControl
.ToLookup(r => r.Attribute("format").Value,
r => r.Attribute("template").Value);
if (resourceUrls.Any())
if (resourceUrls.Count != 0)
{
var urlTemplates = resourceUrls.Contains(formatPng) ? resourceUrls[formatPng]
: resourceUrls.Contains(formatJpg) ? resourceUrls[formatJpg]

View file

@ -23,7 +23,7 @@ namespace MapControl
public class WmtsTileLayer : MapTileLayerBase
{
private static ILogger logger;
private static ILogger Logger => logger ?? (logger = ImageLoader.LoggerFactory?.CreateLogger<WmtsTileLayer>());
private static ILogger Logger => logger ??= ImageLoader.LoggerFactory?.CreateLogger<GroundOverlay>();
public static readonly DependencyProperty CapabilitiesUriProperty =
DependencyPropertyHelper.Register<WmtsTileLayer, Uri>(nameof(CapabilitiesUri), null,

View file

@ -6,7 +6,7 @@ namespace MapControl
{
public WmtsTileMatrixSet TileMatrixSet { get; set; }
public override Uri GetUri(int column, int row, int zoomLevel)
public override Uri GetUri(int zoomLevel, int column, int row)
{
Uri uri = null;

View file

@ -1,320 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapControl</RootNamespace>
<AssemblyName>MapControl.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.26100.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateLibraryLayout>true</GenerateLibraryLayout>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\AutoEquirectangularProjection.cs">
<Link>AutoEquirectangularProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\AzimuthalEquidistantProjection.cs">
<Link>AzimuthalEquidistantProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\AzimuthalProjection.cs">
<Link>AzimuthalProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\BoundingBox.cs">
<Link>BoundingBox.cs</Link>
</Compile>
<Compile Include="..\Shared\BoundingBoxTileSource.cs">
<Link>BoundingBoxTileSource.cs</Link>
</Compile>
<Compile Include="..\Shared\CenteredBoundingBox.cs">
<Link>CenteredBoundingBox.cs</Link>
</Compile>
<Compile Include="..\Shared\DispatcherTimerExtensions.cs">
<Link>DispatcherTimerExtensions.cs</Link>
</Compile>
<Compile Include="..\Shared\EquirectangularProjection.cs">
<Link>EquirectangularProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Etrs89UtmProjection.cs">
<Link>Etrs89UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\FilePath.cs">
<Link>FilePath.cs</Link>
</Compile>
<Compile Include="..\Shared\GeoImage.cs">
<Link>GeoImage.cs</Link>
</Compile>
<Compile Include="..\Shared\GnomonicProjection.cs">
<Link>GnomonicProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\GroundOverlay.cs">
<Link>GroundOverlay.cs</Link>
</Compile>
<Compile Include="..\Shared\ImageFileCache.cs">
<Link>ImageFileCache.cs</Link>
</Compile>
<Compile Include="..\Shared\ImageLoader.cs">
<Link>ImageLoader.cs</Link>
</Compile>
<Compile Include="..\Shared\LatLonBox.cs">
<Link>LatLonBox.cs</Link>
</Compile>
<Compile Include="..\Shared\Location.cs">
<Link>Location.cs</Link>
</Compile>
<Compile Include="..\Shared\LocationCollection.cs">
<Link>LocationCollection.cs</Link>
</Compile>
<Compile Include="..\Shared\Map.cs">
<Link>Map.cs</Link>
</Compile>
<Compile Include="..\Shared\MapBase.cs">
<Link>MapBase.cs</Link>
</Compile>
<Compile Include="..\Shared\MapBase.MapLayer.cs">
<Link>MapBase.MapLayer.cs</Link>
</Compile>
<Compile Include="..\Shared\MapBorderPanel.cs">
<Link>MapBorderPanel.cs</Link>
</Compile>
<Compile Include="..\Shared\MapGraticule.cs">
<Link>MapGraticule.cs</Link>
</Compile>
<Compile Include="..\Shared\MapImageLayer.cs">
<Link>MapImageLayer.cs</Link>
</Compile>
<Compile Include="..\Shared\MapItem.cs">
<Link>MapItem.cs</Link>
</Compile>
<Compile Include="..\Shared\MapItemsControl.cs">
<Link>MapItemsControl.cs</Link>
</Compile>
<Compile Include="..\Shared\MapMultiPolygon.cs">
<Link>MapMultiPolygon.cs</Link>
</Compile>
<Compile Include="..\Shared\MapPanel.cs">
<Link>MapPanel.cs</Link>
</Compile>
<Compile Include="..\Shared\MapPath.cs">
<Link>MapPath.cs</Link>
</Compile>
<Compile Include="..\Shared\MapPolygon.cs">
<Link>MapPolygon.cs</Link>
</Compile>
<Compile Include="..\Shared\MapPolyline.cs">
<Link>MapPolyline.cs</Link>
</Compile>
<Compile Include="..\Shared\MapProjection.cs">
<Link>MapProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\MapProjectionFactory.cs">
<Link>MapProjectionFactory.cs</Link>
</Compile>
<Compile Include="..\Shared\MapScale.cs">
<Link>MapScale.cs</Link>
</Compile>
<Compile Include="..\Shared\MapTileLayer.cs">
<Link>MapTileLayer.cs</Link>
</Compile>
<Compile Include="..\Shared\MapTileLayerBase.cs">
<Link>MapTileLayerBase.cs</Link>
</Compile>
<Compile Include="..\Shared\Nad27UtmProjection.cs">
<Link>Nad27UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Nad83UtmProjection.cs">
<Link>Nad83UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\OrthographicProjection.cs">
<Link>OrthographicProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\PolarStereographicProjection.cs">
<Link>PolarStereographicProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\PolygonCollection.cs">
<Link>PolygonCollection.cs</Link>
</Compile>
<Compile Include="..\Shared\PushpinBorder.cs">
<Link>PushpinBorder.cs</Link>
</Compile>
<Compile Include="..\Shared\StereographicProjection.cs">
<Link>StereographicProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Tile.cs">
<Link>Tile.cs</Link>
</Compile>
<Compile Include="..\Shared\TileCollection.cs">
<Link>TileCollection.cs</Link>
</Compile>
<Compile Include="..\Shared\TileImageLoader.cs">
<Link>TileImageLoader.cs</Link>
</Compile>
<Compile Include="..\Shared\TileMatrix.cs">
<Link>TileMatrix.cs</Link>
</Compile>
<Compile Include="..\Shared\TileSource.cs">
<Link>TileSource.cs</Link>
</Compile>
<Compile Include="..\Shared\TransverseMercatorProjection.cs">
<Link>TransverseMercatorProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\TypeConverters.cs">
<Link>TypeConverters.cs</Link>
</Compile>
<Compile Include="..\Shared\ViewportChangedEventArgs.cs">
<Link>ViewportChangedEventArgs.cs</Link>
</Compile>
<Compile Include="..\Shared\ViewTransform.cs">
<Link>ViewTransform.cs</Link>
</Compile>
<Compile Include="..\Shared\WebMercatorProjection.cs">
<Link>WebMercatorProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Wgs84UtmProjection.cs">
<Link>Wgs84UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\WmsImageLayer.cs">
<Link>WmsImageLayer.cs</Link>
</Compile>
<Compile Include="..\Shared\WmtsCapabilities.cs">
<Link>WmtsCapabilities.cs</Link>
</Compile>
<Compile Include="..\Shared\WmtsTileLayer.cs">
<Link>WmtsTileLayer.cs</Link>
</Compile>
<Compile Include="..\Shared\WmtsTileMatrix.cs">
<Link>WmtsTileMatrix.cs</Link>
</Compile>
<Compile Include="..\Shared\WmtsTileMatrixLayer.cs">
<Link>WmtsTileMatrixLayer.cs</Link>
</Compile>
<Compile Include="..\Shared\WmtsTileMatrixSet.cs">
<Link>WmtsTileMatrixSet.cs</Link>
</Compile>
<Compile Include="..\Shared\WmtsTileSource.cs">
<Link>WmtsTileSource.cs</Link>
</Compile>
<Compile Include="..\Shared\WorldMercatorProjection.cs">
<Link>WorldMercatorProjection.cs</Link>
</Compile>
<Compile Include="..\WinUI\DependencyPropertyHelper.WinUI.cs">
<Link>DependencyPropertyHelper.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\GeoImage.WinUI.cs">
<Link>GeoImage.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\ImageLoader.WinUI.cs">
<Link>ImageLoader.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\Map.WinUI.cs">
<Link>Map.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapBase.WinUI.cs">
<Link>MapBase.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapContentControl.WinUI.cs">
<Link>MapContentControl.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapGraticule.WinUI.cs">
<Link>MapGraticule.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapImageLayer.WinUI.cs">
<Link>MapImageLayer.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapItem.WinUI.cs">
<Link>MapItem.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapItemsControl.WinUI.cs">
<Link>MapItemsControl.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapPanel.WinUI.cs">
<Link>MapPanel.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapPath.WinUI.cs">
<Link>MapPath.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapPolypoint.WinUI.cs">
<Link>MapPolypoint.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\Matrix.WinUI.cs">
<Link>Matrix.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\Point.WinUI.cs">
<Link>Point.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\PushpinBorder.WinUI.cs">
<Link>PushpinBorder.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\Rect.WinUI.cs">
<Link>Rect.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\Tile.WinUI.cs">
<Link>Tile.WinUI.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\MapControl.UWP.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions">
<Version>9.0.8</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory">
<Version>9.0.8</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk">
<Link>MapControl.snk</Link>
</None>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
<DefaultLanguage>en-US</DefaultLanguage>
<DefineConstants>UWP</DefineConstants>
<RootNamespace>MapControl</RootNamespace>
<AssemblyTitle>XAML Map Control Library for UWP</AssemblyTitle>
<GeneratePackageOnBuild>$(GeneratePackage)</GeneratePackageOnBuild>
<PackageId>XAML.MapControl.UWP</PackageId>
<Title>$(AssemblyTitle)</Title>
<Description>A set of UWP controls for rendering raster maps from different providers like OpenStreetMap and various types of map overlays</Description>
</PropertyGroup>
<ItemGroup>
<Folder Include="Themes\" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs" />
<Compile Include="..\WinUI\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.9" />
</ItemGroup>
</Project>

View file

@ -1,13 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control Library for UWP")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2024 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("13.0.0")]
[assembly: AssemblyFileVersion("13.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="MapControl.UWP">
</Library>
</Directives>

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);
}
}
}

View file

@ -20,52 +20,51 @@ namespace MapControl
var file = await StorageFile.GetFileFromPathAsync(FilePath.GetFullPath(sourcePath));
using (var stream = await file.OpenReadAsync())
using var stream = await file.OpenReadAsync();
var decoder = await BitmapDecoder.CreateAsync(stream);
bitmap = await ImageLoader.LoadWriteableBitmapAsync(decoder);
var geoKeyDirectoryQuery = QueryString(GeoKeyDirectoryTag);
var pixelScaleQuery = QueryString(ModelPixelScaleTag);
var tiePointQuery = QueryString(ModelTiePointTag);
var transformationQuery = QueryString(ModelTransformationTag);
var metadata = await decoder.BitmapProperties.GetPropertiesAsync(
new string[]
{
pixelScaleQuery,
tiePointQuery,
transformationQuery,
geoKeyDirectoryQuery
});
if (metadata.TryGetValue(pixelScaleQuery, out BitmapTypedValue pixelScaleValue) &&
pixelScaleValue.Value is double[] pixelScale &&
pixelScale.Length == 3 &&
metadata.TryGetValue(tiePointQuery, out BitmapTypedValue tiePointValue) &&
tiePointValue.Value is double[] tiePoint &&
tiePoint.Length >= 6)
{
var decoder = await BitmapDecoder.CreateAsync(stream);
transform = new Matrix(pixelScale[0], 0d, 0d, -pixelScale[1], tiePoint[3], tiePoint[4]);
}
else if (metadata.TryGetValue(transformationQuery, out BitmapTypedValue transformValue) &&
transformValue.Value is double[] transformValues &&
transformValues.Length == 16)
{
transform = new Matrix(transformValues[0], transformValues[1],
transformValues[4], transformValues[5],
transformValues[3], transformValues[7]);
}
else
{
throw new ArgumentException("No coordinate transformation found.");
}
bitmap = await ImageLoader.LoadWriteableBitmapAsync(decoder);
var geoKeyDirectoryQuery = QueryString(GeoKeyDirectoryTag);
var pixelScaleQuery = QueryString(ModelPixelScaleTag);
var tiePointQuery = QueryString(ModelTiePointTag);
var transformationQuery = QueryString(ModelTransformationTag);
var metadata = await decoder.BitmapProperties.GetPropertiesAsync(
new string[]
{
pixelScaleQuery,
tiePointQuery,
transformationQuery,
geoKeyDirectoryQuery
});
if (metadata.TryGetValue(pixelScaleQuery, out BitmapTypedValue pixelScaleValue) &&
pixelScaleValue.Value is double[] pixelScale &&
pixelScale.Length == 3 &&
metadata.TryGetValue(tiePointQuery, out BitmapTypedValue tiePointValue) &&
tiePointValue.Value is double[] tiePoint &&
tiePoint.Length >= 6)
{
transform = new Matrix(pixelScale[0], 0d, 0d, -pixelScale[1], tiePoint[3], tiePoint[4]);
}
else if (metadata.TryGetValue(transformationQuery, out BitmapTypedValue transformValue) &&
transformValue.Value is double[] transformValues &&
transformValues.Length == 16)
{
transform = new Matrix(transformValues[0], transformValues[1],
transformValues[4], transformValues[5],
transformValues[3], transformValues[7]);
}
else
{
throw new ArgumentException("No coordinate transformation found.");
}
if (metadata.TryGetValue(geoKeyDirectoryQuery, out BitmapTypedValue geoKeyDirValue) &&
geoKeyDirValue.Value is short[] geoKeyDirectory)
{
projection = GetProjection(geoKeyDirectory);
}
if (metadata.TryGetValue(geoKeyDirectoryQuery, out BitmapTypedValue geoKeyDirValue) &&
geoKeyDirValue.Value is short[] geoKeyDirectory)
{
projection = GetProjection(geoKeyDirectory);
}
return new GeoBitmap(bitmap, transform, projection);

View file

@ -34,10 +34,9 @@ namespace MapControl
public static async Task<ImageSource> LoadImageAsync(Stream stream)
{
using (var randomAccessStream = stream.AsRandomAccessStream())
{
return await LoadImageAsync(randomAccessStream);
}
using var randomAccessStream = stream.AsRandomAccessStream();
return await LoadImageAsync(randomAccessStream);
}
public static async Task<ImageSource> LoadImageAsync(string path)
@ -50,10 +49,9 @@ namespace MapControl
{
var file = await StorageFile.GetFileFromPathAsync(path);
using (var randomAccessStream = await file.OpenReadAsync())
{
image = await LoadImageAsync(randomAccessStream);
}
using var randomAccessStream = await file.OpenReadAsync();
image = await LoadImageAsync(randomAccessStream);
}
return image;
@ -84,13 +82,12 @@ namespace MapControl
if (buffer != null)
{
using (var memoryStream = new MemoryStream(buffer))
using (var randomAccessStream = memoryStream.AsRandomAccessStream())
{
var decoder = await BitmapDecoder.CreateAsync(randomAccessStream);
using var memoryStream = new MemoryStream(buffer);
using var randomAccessStream = memoryStream.AsRandomAccessStream();
bitmap = await LoadWriteableBitmapAsync(decoder);
}
var decoder = await BitmapDecoder.CreateAsync(randomAccessStream);
bitmap = await LoadWriteableBitmapAsync(decoder);
}
}
catch (Exception ex)

View file

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl</RootNamespace>
<AssemblyTitle>XAML Map Control Library for WinUI</AssemblyTitle>
@ -17,9 +17,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.250907003" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4948" />
<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

@ -7,43 +7,41 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapControl", "MapControl",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WPF", "MapControl\WPF\MapControl.WPF.csproj", "{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{8F2103C2-78AF-4810-8FB9-67572F50C8FC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WinUI", "MapControl\WinUI\MapControl.WinUI.csproj", "{ACA8E56C-0F82-4010-A83E-2DBFF5D16919}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalApp", "SampleApps\UniversalApp\UniversalApp.csproj", "{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.UWP", "MapControl\UWP\MapControl.UWP.csproj", "{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MBTiles", "MBTiles", "{CEAD0EA1-A971-4F5F-9EAE-C72F75D1F737}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MBTiles.WPF", "MBTiles\WPF\MBTiles.WPF.csproj", "{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapControl.UWP", "MapControl\UWP\MapControl.UWP.csproj", "{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MBTiles.UWP", "MBTiles\UWP\MBTiles.UWP.csproj", "{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.Avalonia", "MapControl\Avalonia\MapControl.Avalonia.csproj", "{0D621538-3DAD-4D3A-BB2C-220B6C580E51}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapProjections", "MapProjections", "{7BC11E28-8D3B-4C5B-AC08-AB249CC95F6D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapProjections.WPF", "MapProjections\WPF\MapProjections.WPF.csproj", "{426C21C0-5F14-491F-BCD1-6D2993510420}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{F92DA93D-75DB-4308-A5F9-6B4C3908A675}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapProjections.UWP", "MapProjections\UWP\MapProjections.UWP.csproj", "{9EE69591-5EDC-45E3-893E-2F9A4B82D538}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WinUI", "MapControl\WinUI\MapControl.WinUI.csproj", "{ACA8E56C-0F82-4010-A83E-2DBFF5D16919}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapProjections.WinUI", "MapProjections\WinUI\MapProjections.WinUI.csproj", "{3572F71A-83FE-459D-8370-002CA28827FE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapProjections.UWP", "MapProjections\UWP\MapProjections.UWP.csproj", "{9EE69591-5EDC-45E3-893E-2F9A4B82D538}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapProjections.Avalonia", "MapProjections\Avalonia\MapProjections.Avalonia.csproj", "{DCBE392B-A598-4EEC-8001-30D9FC88A77C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MBTiles", "MBTiles", "{CEAD0EA1-A971-4F5F-9EAE-C72F75D1F737}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MBTiles.WPF", "MBTiles\WPF\MBTiles.WPF.csproj", "{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MBTiles.WinUI", "MBTiles\WinUI\MBTiles.WinUI.csproj", "{817D606F-A22D-485C-89CF-86062C8E97EF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinUiApp", "SampleApps\WinUiApp\WinUiApp.csproj", "{751EF297-7CF4-4879-BA8F-42661FA68668}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MBTiles.UWP", "MBTiles\UWP\MBTiles.UWP.csproj", "{DCC111E9-EC8B-492A-A09D-DF390D83AE8D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectionDemo", "SampleApps\ProjectionDemo\ProjectionDemo.csproj", "{AC8C7BE0-9E72-434B-8BF3-FAEFAC2E859C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MBTiles.Avalonia", "MBTiles\Avalonia\MBTiles.Avalonia.csproj", "{9E247AA8-8A3F-4562-930B-925CE2879B34}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MapUiTools", "MapUiTools", "{90C681E9-12AE-4B5F-932D-7EF5D35D8436}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapUiTools.UWP", "MapUiTools\UWP\MapUiTools.UWP.csproj", "{DFFE8E49-AA07-457E-A459-99326B44F828}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.WPF", "MapUiTools\WPF\MapUiTools.WPF.csproj", "{12430DAE-DC53-4C37-95D5-B8923B5FD3D7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.UWP", "MapUiTools\UWP\MapUiTools.UWP.csproj", "{DFFE8E49-AA07-457E-A459-99326B44F828}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.WinUI", "MapUiTools\WinUI\MapUiTools.WinUI.csproj", "{C412209E-D81D-4ACB-BECD-FEEF52B93468}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.WPF", "MapUiTools\WPF\MapUiTools.WPF.csproj", "{12430DAE-DC53-4C37-95D5-B8923B5FD3D7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.Avalonia", "MapUiTools\Avalonia\MapUiTools.Avalonia.csproj", "{3D61474F-2F72-47E2-87AA-2881AB552D1A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caches", "Caches", "{69E6CD1A-5619-4549-95FF-2FD126F1A5D2}"
EndProject
@ -51,19 +49,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FileDbCache", "Caches\FileD
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SQLiteCache", "Caches\SQLiteCache\SQLiteCache.csproj", "{FDD70FB5-3B6D-43DF-8C2E-04100315C8BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.Avalonia", "MapControl\Avalonia\MapControl.Avalonia.csproj", "{0D621538-3DAD-4D3A-BB2C-220B6C580E51}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{8F2103C2-78AF-4810-8FB9-67572F50C8FC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApplication", "SampleApps\WpfApplication\WpfApplication.csproj", "{F92DA93D-75DB-4308-A5F9-6B4C3908A675}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinUiApp", "SampleApps\WinUiApp\WinUiApp.csproj", "{751EF297-7CF4-4879-BA8F-42661FA68668}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UniversalApp", "SampleApps\UniversalApp\UniversalApp.csproj", "{D90514BC-38EC-7FB4-BF26-2FC775815D46}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvaloniaApp", "SampleApps\AvaloniaApp\AvaloniaApp.csproj", "{68629CA3-4599-4737-B44C-40B513DD1385}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapUiTools.Avalonia", "MapUiTools\Avalonia\MapUiTools.Avalonia.csproj", "{3D61474F-2F72-47E2-87AA-2881AB552D1A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapProjections.Avalonia", "MapProjections\Avalonia\MapProjections.Avalonia.csproj", "{DCBE392B-A598-4EEC-8001-30D9FC88A77C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MBTiles.Avalonia", "MBTiles\Avalonia\MBTiles.Avalonia.csproj", "{9E247AA8-8A3F-4562-930B-925CE2879B34}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectionDemo", "SampleApps\ProjectionDemo\ProjectionDemo.csproj", "{AC8C7BE0-9E72-434B-8BF3-FAEFAC2E859C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F6270D0A-8250-4D3A-A3E3-21B2FF18AF76}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
@ -77,12 +76,6 @@ Global
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D}.Release|Any CPU.Build.0 = Release|Any CPU
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.ActiveCfg = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Build.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|Any CPU.Deploy.0 = Debug|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.ActiveCfg = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Build.0 = Release|x64
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|Any CPU.Deploy.0 = Release|x64
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -169,13 +162,18 @@ Global
{9E247AA8-8A3F-4562-930B-925CE2879B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E247AA8-8A3F-4562-930B-925CE2879B34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E247AA8-8A3F-4562-930B-925CE2879B34}.Release|Any CPU.Build.0 = Release|Any CPU
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Debug|Any CPU.ActiveCfg = Debug|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Debug|Any CPU.Build.0 = Debug|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Debug|Any CPU.Deploy.0 = Debug|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Release|Any CPU.ActiveCfg = Release|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Release|Any CPU.Build.0 = Release|x64
{D90514BC-38EC-7FB4-BF26-2FC775815D46}.Release|Any CPU.Deploy.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A204A102-C745-4D65-AEC8-7B96FAEDEF2D} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
{38B18AB6-6E70-4696-8FB4-E8C8E12BF50C} = {CEAD0EA1-A971-4F5F-9EAE-C72F75D1F737}
{9545F73C-9C35-4CF6-BAAE-19A0BAEBD344} = {52AECE49-F314-4F76-98F2-FA800F07824B}
{DCC111E9-EC8B-492A-A09D-DF390D83AE8D} = {CEAD0EA1-A971-4F5F-9EAE-C72F75D1F737}
@ -197,6 +195,7 @@ Global
{3D61474F-2F72-47E2-87AA-2881AB552D1A} = {90C681E9-12AE-4B5F-932D-7EF5D35D8436}
{DCBE392B-A598-4EEC-8001-30D9FC88A77C} = {7BC11E28-8D3B-4C5B-AC08-AB249CC95F6D}
{9E247AA8-8A3F-4562-930B-925CE2879B34} = {CEAD0EA1-A971-4F5F-9EAE-C72F75D1F737}
{D90514BC-38EC-7FB4-BF26-2FC775815D46} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB}

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl.Projections</RootNamespace>
<AssemblyTitle>XAML Map Control Projections Library for Avalonia UI</AssemblyTitle>
@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.5" />
<PackageReference Include="Avalonia" Version="11.3.6" />
<PackageReference Include="ProjNET4GeoAPI" Version="1.4.1" />
</ItemGroup>
</Project>

View file

@ -1,102 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9EE69591-5EDC-45E3-893E-2F9A4B82D538}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapControl.Projections</RootNamespace>
<AssemblyName>MapProjections.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.26100.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\Ed50UtmProjection.cs">
<Link>Ed50UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Etrs89UtmProjection.cs">
<Link>Etrs89UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\GeoApiProjection.cs">
<Link>GeoApiProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\GeoApiProjectionFactory.cs">
<Link>GeoApiProjectionFactory.cs</Link>
</Compile>
<Compile Include="..\Shared\Nad27UtmProjection.cs">
<Link>Nad27UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Nad83UtmProjection.cs">
<Link>Nad83UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\WebMercatorProjection.cs">
<Link>WebMercatorProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\Wgs84UtmProjection.cs">
<Link>Wgs84UtmProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\WorldMercatorProjection.cs">
<Link>WorldMercatorProjection.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\MapProjections.UWP.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="ProjNET4GeoAPI">
<Version>1.4.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj">
<Project>{9545f73c-9c35-4cf6-baae-19a0baebd344}</Project>
<Name>MapControl.UWP</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk">
<Link>MapControl.snk</Link>
</None>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
<DefaultLanguage>en-US</DefaultLanguage>
<DefineConstants>UWP</DefineConstants>
<RootNamespace>MapControl.Projections</RootNamespace>
<AssemblyTitle>XAML Map Control Projections Library for UWP</AssemblyTitle>
<GeneratePackageOnBuild>$(GeneratePackage)</GeneratePackageOnBuild>
<PackageId>XAML.MapControl.MapProjections.UWP</PackageId>
<Title>$(AssemblyTitle)</Title>
<Description>Map projections library for XAML Map Control, based on ProjNET4GeoAPI</Description>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ProjNET4GeoAPI" Version="1.4.1" />
</ItemGroup>
</Project>

View file

@ -1,13 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control Projections Library for UWP")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2024 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("13.0.0")]
[assembly: AssemblyFileVersion("13.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains Runtime Directives, specifications about types your application accesses
through reflection and other dynamic code patterns. Runtime Directives are used to control the
.NET Native optimizer and ensure that it does not remove code accessed by your library. If your
library does not do any reflection, then you generally do not need to edit this file. However,
if your library reflects over types, especially types passed to it or derived from its types,
then you should write Runtime Directives.
The most common use of reflection in libraries is to discover information about types passed
to the library. Runtime Directives have three ways to express requirements on types passed to
your library.
1. Parameter, GenericParameter, TypeParameter, TypeEnumerableParameter
Use these directives to reflect over types passed as a parameter.
2. SubTypes
Use a SubTypes directive to reflect over types derived from another type.
3. AttributeImplies
Use an AttributeImplies directive to indicate that your library needs to reflect over
types or methods decorated with an attribute.
For more information on writing Runtime Directives for libraries, please visit
https://go.microsoft.com/fwlink/?LinkID=391919
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="MapProjections.UWP">
<!-- add directives for your library here -->
</Library>
</Directives>

View file

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl.Projections</RootNamespace>
@ -21,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.250907003" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4948" />
<PackageReference Include="ProjNET4GeoAPI" Version="1.4.1" />
</ItemGroup>

View file

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<DefineConstants>AVALONIA</DefineConstants>
<RootNamespace>MapControl.UiTools</RootNamespace>
<AssemblyTitle>XAML Map Control UI Tools Library for Avalonia UI</AssemblyTitle>
@ -15,6 +15,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.5" />
<PackageReference Include="Avalonia" Version="11.3.6" />
</ItemGroup>
</Project>

View file

@ -1,94 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DFFE8E49-AA07-457E-A459-99326B44F828}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MapControl.UiTools</RootNamespace>
<AssemblyName>MapUiTools.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.26100.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\MapLayerMenuItem.cs">
<Link>MapLayerMenuItem.cs</Link>
</Compile>
<Compile Include="..\Shared\MapProjectionMenuItem.cs">
<Link>MapProjectionMenuItem.cs</Link>
</Compile>
<Compile Include="..\Shared\MenuButton.cs">
<Link>MenuButton.cs</Link>
</Compile>
<Compile Include="..\WinUI\MapMenuItem.WinUI.cs">
<Link>MapMenuItem.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\MenuButton.WinUI.cs">
<Link>MenuButton.WinUI.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\MapUiTools.UWP.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj">
<Project>{9545f73c-9c35-4cf6-baae-19a0baebd344}</Project>
<Name>MapControl.UWP</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk">
<Link>MapControl.snk</Link>
</None>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
<DefaultLanguage>en-US</DefaultLanguage>
<DefineConstants>UWP</DefineConstants>
<RootNamespace>MapControl.UiTools</RootNamespace>
<AssemblyTitle>XAML Map Control UI Tools Library for UWP</AssemblyTitle>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs" />
<Compile Include="..\WinUI\*.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj" />
</ItemGroup>
</Project>

View file

@ -1,13 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control UI Tools Library for UWP")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2024 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("13.0.0")]
[assembly: AssemblyFileVersion("13.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="MapUiTools.UWP">
</Library>
</Directives>

View file

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<TargetFramework>net9.0-windows10.0.17763.0</TargetFramework>
<UseWinUI>true</UseWinUI>
<DefineConstants>WINUI</DefineConstants>
<RootNamespace>MapControl.UiTools</RootNamespace>
@ -17,7 +16,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.250907003" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4948" />
</ItemGroup>
</Project>

View file

@ -32,12 +32,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.5" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.5" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.5" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.5" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.5" />
<PackageReference Include="Avalonia" Version="11.3.6" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.6" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.6" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.6" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.6" />
<PackageReference Include="Markdown.Avalonia.Tight" Version="11.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
</ItemGroup>
</Project>

View file

@ -2,7 +2,6 @@
x:Class="SampleApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SampleApplication"
RequestedTheme="Light">
xmlns:local="using:SampleApplication">
</Application>

View file

@ -1,49 +1,34 @@
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace SampleApplication
{
sealed partial class App : Application
public sealed partial class App : Application
{
public App()
{
InitializeComponent();
Suspending += OnSuspending;
}
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
if (Window.Current.Content is not Frame rootFrame)
{
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
if (e.PrelaunchActivated == false)
{
rootFrame.Navigate(typeof(MainPage), e.Arguments);
if (rootFrame.Content == null)
{
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
Window.Current.Activate();
}
Window.Current.Activate();
}
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
deferral.Complete();
}
}
}

View file

@ -3,9 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:map="using:MapControl"
xmlns:tools="using:MapControl.UiTools"
xmlns:local="using:SampleApplication">
xmlns:local="using:SampleApplication"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid.Resources>
<DataTemplate x:Key="PolylineItemTemplate">
<map:MapPolyline Locations="{Binding Locations}" Stroke="Red" StrokeThickness="3"/>

View file

@ -1,27 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="XamlMapControl.UniversalApp" Publisher="CN=Clemens" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="6781ec09-e195-49eb-9a20-b25a8dc39b2a" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="754bf288-4015-4398-a193-ddd45b3472af"
Publisher="CN=Clemens"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="754bf288-4015-4398-a193-ddd45b3472af" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>UniversalApp</DisplayName>
<DisplayName>SampleApplication</DisplayName>
<PublisherDisplayName>Clemens</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="SampleApplication.App">
<uap:VisualElements DisplayName="XAML Map Control Test Application" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="SampleApplication" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="SampleApplication.App">
<uap:VisualElements
DisplayName="XAML Map Control UWP Test Application"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="SampleApplication"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>

View file

@ -1,13 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("XAML Map Control UWP Sample Application")]
[assembly: AssemblyProduct("XAML Map Control")]
[assembly: AssemblyCompany("Clemens Fischer")]
[assembly: AssemblyCopyright("Copyright © 2024 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("13.0.0")]
[assembly: AssemblyFileVersion("13.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

View file

@ -1,5 +0,0 @@
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<Assembly Name="*Application*" Dynamic="Required All" />
</Application>
</Directives>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>ARM64</Platform>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x86</Platform>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,7 @@
{
"profiles": {
"UniversalApp": {
"commandName": "MsixPackage"
}
}
}

View file

@ -1,129 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleApplication</RootNamespace>
<AssemblyName>UniversalApp</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.26100.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>UniversalApp_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>5DCEEAF8B009D22AA0D41EA61710C9CB80E66BD4</PackageCertificateThumbprint>
<RuntimeIdentifiers>win10-arm;win10-arm-aot;win10-x86;win10-x86-aot;win10-x64;win10-x64-aot</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<EnableGatekeeperAnalysis>false</EnableGatekeeperAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>none</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>
<EnableGatekeeperAnalysis>false</EnableGatekeeperAnalysis>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\HyperlinkText.cs">
<Link>HyperlinkText.cs</Link>
</Compile>
<Compile Include="..\Shared\MapViewModel.cs">
<Link>MapViewModel.cs</Link>
</Compile>
<Compile Include="..\Shared\ValueConverters.cs">
<Link>ValueConverters.cs</Link>
</Compile>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<Content Include="..\Shared\etna.kml">
<Link>etna.kml</Link>
</Content>
<None Include="UniversalApp_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Shared\10_535_330.jpg">
<Link>10_535_330.jpg</Link>
</Content>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj">
<Project>{951bc5d2-d653-42d9-9a91-21dc50de0182}</Project>
<Name>MapControl.UWP</Name>
</ProjectReference>
<ProjectReference Include="..\..\MapUiTools\UWP\MapUiTools.UWP.csproj">
<Project>{dffe8e49-aa07-457e-a459-99326b44f828}</Project>
<Name>MapUiTools.UWP</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug">
<Version>9.0.8</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<UseUwp>true</UseUwp>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<DefaultLanguage>en-US</DefaultLanguage>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
<EnableMsixTooling>true</EnableMsixTooling>
<DefineConstants>UWP</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Shared\10_535_330.jpg" Link="10_535_330.jpg" />
<Content Include="..\Shared\etna.kml" Link="etna.kml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\UWP\MapControl.UWP.csproj" />
<ProjectReference Include="..\..\MapUiTools\UWP\MapUiTools.UWP.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
</ItemGroup>
</Project>

View file

@ -31,7 +31,7 @@
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="XAML Map Control Test Application"
DisplayName="XAML Map Control WinUI Test Application"
Description="SampleApplication"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"

View file

@ -21,13 +21,6 @@
<ItemGroup>
<Content Include="..\Shared\10_535_330.jpg" Link="10_535_330.jpg" />
<Content Include="..\Shared\etna.kml" Link="etna.kml" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
@ -36,8 +29,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.8" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606001" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.250907003" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.4948" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

View file

@ -30,7 +30,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
</ItemGroup>
<ItemGroup>