diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..b5846dea --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +[*.cs] +csharp_style_var_when_type_is_apparent=true:silent +csharp_style_var_for_built_in_types=true:silent +csharp_style_var_elsewhere=true:silent +csharp_prefer_simple_using_statement=false:suggestion +csharp_style_expression_bodied_properties=false:silent +csharp_style_expression_bodied_indexers=false:silent +csharp_style_expression_bodied_accessors=false:silent +csharp_style_expression_bodied_lambdas=false:silent diff --git a/MapControl.sln b/MapControl.sln index 0837cfbe..b573da99 100644 --- a/MapControl.sln +++ b/MapControl.sln @@ -15,90 +15,83 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MapControl.WPF", "MapContro 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("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{47E434EE-BB49-4171-A24A-8FFF55EE0C2F}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinUiApp", "SampleApps\WinUiApp\WinUiApp.csproj", "{D52D7ECE-9979-4287-9118-93DE23DD8F69}" +EndProject +Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "WinUiApp (Package)", "SampleApps\WinUiApp (Package)\WinUiApp (Package).wapproj", "{2DB6959F-1768-495C-8EED-4830EF185584}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM Release|x64 = Release|x64 - Release|x86 = Release|x86 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}.Debug|ARM.ActiveCfg = Debug|ARM - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Build.0 = Debug|ARM - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|ARM.Deploy.0 = Debug|ARM {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.ActiveCfg = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Build.0 = Debug|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x64.Deploy.0 = Debug|x64 - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x86.ActiveCfg = Debug|x86 - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x86.Build.0 = Debug|x86 - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Debug|x86.Deploy.0 = Debug|x86 {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 - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.ActiveCfg = Release|ARM - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.Build.0 = Release|ARM - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|ARM.Deploy.0 = Release|ARM {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.ActiveCfg = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Build.0 = Release|x64 {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x64.Deploy.0 = Release|x64 - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.ActiveCfg = Release|x86 - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.Build.0 = Release|x86 - {AA62B4AA-1CA3-4C20-BEB7-B824D0FC4BD1}.Release|x86.Deploy.0 = Release|x86 {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}.Debug|ARM.ActiveCfg = Debug|Any CPU - {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|ARM.Build.0 = Debug|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.ActiveCfg = Debug|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x64.Build.0 = Debug|Any CPU - {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x86.ActiveCfg = Debug|Any CPU - {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Debug|x86.Build.0 = Debug|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.ActiveCfg = Release|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|Any CPU.Build.0 = Release|Any CPU - {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM.ActiveCfg = Release|Any CPU - {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|ARM.Build.0 = Release|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.ActiveCfg = Release|Any CPU {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x64.Build.0 = Release|Any CPU - {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x86.ActiveCfg = Release|Any CPU - {9545F73C-9C35-4CF6-BAAE-19A0BAEBD344}.Release|x86.Build.0 = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|Any CPU.Build.0 = Debug|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|ARM.ActiveCfg = Debug|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|ARM.Build.0 = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x64.ActiveCfg = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x64.Build.0 = Debug|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x86.ActiveCfg = Debug|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Debug|x86.Build.0 = Debug|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|Any CPU.ActiveCfg = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|Any CPU.Build.0 = Release|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|ARM.ActiveCfg = Release|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|ARM.Build.0 = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x64.ActiveCfg = Release|Any CPU {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x64.Build.0 = Release|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x86.ActiveCfg = Release|Any CPU - {62F1726B-3144-49F4-8BCC-94160A3B2186}.Release|x86.Build.0 = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|ARM.ActiveCfg = Debug|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|ARM.Build.0 = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x64.ActiveCfg = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x64.Build.0 = Debug|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x86.ActiveCfg = Debug|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Debug|x86.Build.0 = Debug|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|Any CPU.Build.0 = Release|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|ARM.ActiveCfg = Release|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|ARM.Build.0 = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x64.ActiveCfg = Release|Any CPU {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x64.Build.0 = Release|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x86.ActiveCfg = Release|Any CPU - {CA60DFDB-0BE1-40F6-B575-CDC797A40E2E}.Release|x86.Build.0 = Release|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Debug|x64.ActiveCfg = Debug|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Debug|x64.Build.0 = Debug|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Release|Any CPU.Build.0 = Release|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Release|x64.ActiveCfg = Release|Any CPU + {92894476-02E1-47CB-936E-4154023456F0}.Release|x64.Build.0 = Release|Any CPU + {D52D7ECE-9979-4287-9118-93DE23DD8F69}.Debug|Any CPU.ActiveCfg = Debug|x64 + {D52D7ECE-9979-4287-9118-93DE23DD8F69}.Debug|x64.ActiveCfg = Debug|x64 + {D52D7ECE-9979-4287-9118-93DE23DD8F69}.Debug|x64.Build.0 = Debug|x64 + {D52D7ECE-9979-4287-9118-93DE23DD8F69}.Release|Any CPU.ActiveCfg = Release|x64 + {D52D7ECE-9979-4287-9118-93DE23DD8F69}.Release|x64.ActiveCfg = Release|x64 + {D52D7ECE-9979-4287-9118-93DE23DD8F69}.Release|x64.Build.0 = Release|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Debug|Any CPU.ActiveCfg = Debug|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Debug|x64.ActiveCfg = Debug|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Debug|x64.Build.0 = Debug|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Debug|x64.Deploy.0 = Debug|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Release|Any CPU.ActiveCfg = Release|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Release|x64.ActiveCfg = Release|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Release|x64.Build.0 = Release|x64 + {2DB6959F-1768-495C-8EED-4830EF185584}.Release|x64.Deploy.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -108,6 +101,9 @@ Global {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} + {92894476-02E1-47CB-936E-4154023456F0} = {52AECE49-F314-4F76-98F2-FA800F07824B} + {D52D7ECE-9979-4287-9118-93DE23DD8F69} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC} + {2DB6959F-1768-495C-8EED-4830EF185584} = {8F2103C2-78AF-4810-8FB9-67572F50C8FC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {458346DD-B23F-4FDC-8F9D-A10F1882A4DB} diff --git a/SampleApps/Shared/MapLayers.cs b/SampleApps/Shared/MapLayers.cs index fa37febc..d26147b1 100644 --- a/SampleApps/Shared/MapLayers.cs +++ b/SampleApps/Shared/MapLayers.cs @@ -2,8 +2,11 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Globalization; -#if WINDOWS_UWP +#if WINUI +using Microsoft.UI; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Media; +#elif WINDOWS_UWP using Windows.UI; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; @@ -123,10 +126,6 @@ namespace ViewModel ServiceUri = new Uri("http://ows.terrestris.de/osm/service") } }, - { - "SevenCs ChartServer WMS", - new ChartServerLayer() - } }; private string currentMapLayerName = "OpenStreetMap"; @@ -161,7 +160,6 @@ namespace ViewModel "TopPlusOpen WMTS", "TopPlusOpen WMS", "OpenStreetMap WMS", - "SevenCs ChartServer WMS", }; public MapLayers() @@ -179,28 +177,4 @@ namespace ViewModel } } } - - public class ChartServerLayer : WmsImageLayer - { - public ChartServerLayer() - { - Description = "© [SevenCs GmbH](http://www.sevencs.com)"; - ServiceUri = new Uri("http://wms.sevencs.com"); - Layers = "ENC"; - MaxBoundingBoxWidth = 360; - } - - protected override string GetCrsParam(MapProjection projection) - { - switch (projection.CrsId) - { - case "AUTO2:97001": - return string.Format(CultureInfo.InvariantCulture, "CRS=AUTO2:7CS01,1,{0},{1}", projection.Center.Longitude, projection.Center.Latitude); - case "AUTO2:97002": - return string.Format(CultureInfo.InvariantCulture, "CRS=AUTO2:7CS02,1,{0},{1}", projection.Center.Longitude, projection.Center.Latitude); - default: - return base.GetCrsParam(projection); - } - } - } } diff --git a/SampleApps/UniversalApp/MainPage.xaml b/SampleApps/UniversalApp/MainPage.xaml index 4060041c..16e4333e 100644 --- a/SampleApps/UniversalApp/MainPage.xaml +++ b/SampleApps/UniversalApp/MainPage.xaml @@ -2,8 +2,7 @@ x:Class="UniversalApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:map="using:MapControl" - xmlns:local="using:UniversalApp"> + xmlns:map="using:MapControl"> @@ -101,6 +100,7 @@ + false false - - true - bin\x86\Debug\ - TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS - ;2008 - full - x86 - false - prompt - true - false - false - - - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - none - x86 - false - prompt - true - true - false - MapLayers.cs diff --git a/SampleApps/WinUiApp (Package)/Images/LockScreenLogo.scale-200.png b/SampleApps/WinUiApp (Package)/Images/LockScreenLogo.scale-200.png new file mode 100644 index 00000000..7440f0d4 Binary files /dev/null and b/SampleApps/WinUiApp (Package)/Images/LockScreenLogo.scale-200.png differ diff --git a/SampleApps/WinUiApp (Package)/Images/SplashScreen.scale-200.png b/SampleApps/WinUiApp (Package)/Images/SplashScreen.scale-200.png new file mode 100644 index 00000000..32f486a8 Binary files /dev/null and b/SampleApps/WinUiApp (Package)/Images/SplashScreen.scale-200.png differ diff --git a/SampleApps/WinUiApp (Package)/Images/Square150x150Logo.scale-200.png b/SampleApps/WinUiApp (Package)/Images/Square150x150Logo.scale-200.png new file mode 100644 index 00000000..53ee3777 Binary files /dev/null and b/SampleApps/WinUiApp (Package)/Images/Square150x150Logo.scale-200.png differ diff --git a/SampleApps/WinUiApp (Package)/Images/Square44x44Logo.scale-200.png b/SampleApps/WinUiApp (Package)/Images/Square44x44Logo.scale-200.png new file mode 100644 index 00000000..f713bba6 Binary files /dev/null and b/SampleApps/WinUiApp (Package)/Images/Square44x44Logo.scale-200.png differ diff --git a/SampleApps/WinUiApp (Package)/Images/Square44x44Logo.targetsize-24_altform-unplated.png b/SampleApps/WinUiApp (Package)/Images/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 00000000..dc9f5bea Binary files /dev/null and b/SampleApps/WinUiApp (Package)/Images/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/SampleApps/WinUiApp (Package)/Images/StoreLogo.png b/SampleApps/WinUiApp (Package)/Images/StoreLogo.png new file mode 100644 index 00000000..a4586f26 Binary files /dev/null and b/SampleApps/WinUiApp (Package)/Images/StoreLogo.png differ diff --git a/SampleApps/WinUiApp (Package)/Images/Wide310x150Logo.scale-200.png b/SampleApps/WinUiApp (Package)/Images/Wide310x150Logo.scale-200.png new file mode 100644 index 00000000..8b4a5d0d Binary files /dev/null and b/SampleApps/WinUiApp (Package)/Images/Wide310x150Logo.scale-200.png differ diff --git a/SampleApps/WinUiApp (Package)/Package.appxmanifest b/SampleApps/WinUiApp (Package)/Package.appxmanifest new file mode 100644 index 00000000..7076af38 --- /dev/null +++ b/SampleApps/WinUiApp (Package)/Package.appxmanifest @@ -0,0 +1,48 @@ + + + + + + + + WinUiApp (Package) + Clemens + Images\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleApps/WinUiApp (Package)/WinUiApp (Package).assets.cache b/SampleApps/WinUiApp (Package)/WinUiApp (Package).assets.cache new file mode 100644 index 00000000..d6f5cc01 Binary files /dev/null and b/SampleApps/WinUiApp (Package)/WinUiApp (Package).assets.cache differ diff --git a/SampleApps/WinUiApp (Package)/WinUiApp (Package).wapproj b/SampleApps/WinUiApp (Package)/WinUiApp (Package).wapproj new file mode 100644 index 00000000..f1a70795 --- /dev/null +++ b/SampleApps/WinUiApp (Package)/WinUiApp (Package).wapproj @@ -0,0 +1,59 @@ + + + + 15.0 + + + + Debug + x64 + + + Release + x64 + + + + $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\ + WinUiApp\ + + + + 2db6959f-1768-495c-8eed-4830ef185584 + 10.0.19041.0 + 10.0.17763.0 + net5.0-windows$(TargetPlatformVersion);$(AssetTargetFallback) + en-US + false + ..\WinUiApp\WinUiApp.csproj + + + + Designer + + + + + + + + + + + + + + True + Properties\PublishProfiles\win10-$(Platform).pubxml + + + + + build + + + build + + + + \ No newline at end of file diff --git a/SampleApps/WinUiApp (Package)/WinUiApp (Package).wapproj.user b/SampleApps/WinUiApp (Package)/WinUiApp (Package).wapproj.user new file mode 100644 index 00000000..77c565b6 --- /dev/null +++ b/SampleApps/WinUiApp (Package)/WinUiApp (Package).wapproj.user @@ -0,0 +1,7 @@ + + + + AppHostLocalDebugger + False + + \ No newline at end of file diff --git a/SampleApps/WinUiApp/App.xaml b/SampleApps/WinUiApp/App.xaml new file mode 100644 index 00000000..8167ca0c --- /dev/null +++ b/SampleApps/WinUiApp/App.xaml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/SampleApps/WinUiApp/App.xaml.cs b/SampleApps/WinUiApp/App.xaml.cs new file mode 100644 index 00000000..f3dea6a9 --- /dev/null +++ b/SampleApps/WinUiApp/App.xaml.cs @@ -0,0 +1,51 @@ +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using Microsoft.UI.Xaml.Shapes; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace WinUiApp +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : Application + { + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + this.InitializeComponent(); + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// + /// Details about the launch request and process. + protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) + { + m_window = new MainWindow(); + m_window.Activate(); + } + + private Window m_window; + } +} diff --git a/SampleApps/WinUiApp/MainWindow.xaml b/SampleApps/WinUiApp/MainWindow.xaml new file mode 100644 index 00000000..9282f140 --- /dev/null +++ b/SampleApps/WinUiApp/MainWindow.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SampleApps/WinUiApp/MainWindow.xaml.cs b/SampleApps/WinUiApp/MainWindow.xaml.cs new file mode 100644 index 00000000..9dc0f5ae --- /dev/null +++ b/SampleApps/WinUiApp/MainWindow.xaml.cs @@ -0,0 +1,62 @@ +using MapControl; +using MapControl.Caching; +using Microsoft.UI.Xaml; +using System; +using System.Diagnostics; +using System.IO; +using System.Threading.Tasks; +using ViewModel; + +namespace WinUiApp +{ + public sealed partial class MainWindow : Window + { + private readonly MapViewModel viewModel = new(); + + static MainWindow() + { + try + { + ImageLoader.HttpClient.DefaultRequestHeaders.Add("User-Agent", "XAML Map Control Test Application"); + + var appData = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl"); + + TileImageLoader.Cache = new ImageFileCache(Path.Combine(appData, "TileCache")); + BingMapsTileLayer.ApiKey = File.ReadAllText(Path.Combine(appData, "BingMapsApiKey.txt"))?.Trim(); + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message); + } + } + + public MainWindow() + { + InitializeComponent(); + + Title = "XAML Map Control - WinUI Sample Application"; + + root.DataContext = viewModel; + + if (TileImageLoader.Cache is ImageFileCache cache) + { + Activated += async (s, e) => + { + await Task.Delay(2000); + await cache.Clean(); + }; + } + } + + private void SeamarksChecked(object sender, RoutedEventArgs e) + { + map.Children.Insert(map.Children.IndexOf(graticule), viewModel.MapLayers.SeamarksLayer); + } + + private void SeamarksUnchecked(object sender, RoutedEventArgs e) + { + map.Children.Remove(viewModel.MapLayers.SeamarksLayer); + } + } +} diff --git a/SampleApps/WinUiApp/Properties/PublishProfiles/win10-x64.pubxml b/SampleApps/WinUiApp/Properties/PublishProfiles/win10-x64.pubxml new file mode 100644 index 00000000..78bdd7d0 --- /dev/null +++ b/SampleApps/WinUiApp/Properties/PublishProfiles/win10-x64.pubxml @@ -0,0 +1,19 @@ + + + + + FileSystem + x64 + win10-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + True + + + \ No newline at end of file diff --git a/SampleApps/WinUiApp/WinUiApp.csproj b/SampleApps/WinUiApp/WinUiApp.csproj new file mode 100644 index 00000000..fe358a76 --- /dev/null +++ b/SampleApps/WinUiApp/WinUiApp.csproj @@ -0,0 +1,40 @@ + + + WinExe + net5.0-windows10.0.19041 + 10.0.17763.0 + WinUiApp + app.manifest + x64 + win10-x64 + true + XAML Map Control + 6.0.0 + XAML Map Control WinUI Sample Application + Clemens Fischer + Copyright © 2021 Clemens Fischer + none + + + WINUI + + + WINUI + + + + + + + + + + + + + + + + + + diff --git a/SampleApps/WinUiApp/WinUiApp.csproj.user b/SampleApps/WinUiApp/WinUiApp.csproj.user new file mode 100644 index 00000000..75ea56df --- /dev/null +++ b/SampleApps/WinUiApp/WinUiApp.csproj.user @@ -0,0 +1,14 @@ + + + + true + + + + Designer + + + Designer + + + \ No newline at end of file diff --git a/SampleApps/WinUiApp/app.manifest b/SampleApps/WinUiApp/app.manifest new file mode 100644 index 00000000..36fb3b07 --- /dev/null +++ b/SampleApps/WinUiApp/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + +