Skip to content

Commit 8671282

Browse files
committed
add CSharpMarkup.WinUI.Mapsui with Mapsui 5.0 support, incl generated code
1 parent e0b98c3 commit 8671282

20 files changed

+1697
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<Project Sdk="Uno.Sdk">
2+
<PropertyGroup>
3+
<Configurations>Debug;Release;Generate</Configurations>
4+
<IsUno>true</IsUno>
5+
6+
<!-- Workaround for PRI resource build errors and dotnet build support, from https://github.com/dotnet/maui/issues/5886#issuecomment-1123106200 -->
7+
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
8+
<GenerateLibraryLayout>true</GenerateLibraryLayout>
9+
10+
<!-- Because we are using Uno.Sdk -->
11+
<EnableDefaultPageItems>false</EnableDefaultPageItems>
12+
<UnoSingleProject>true</UnoSingleProject>
13+
<OutputType>Library</OutputType>
14+
<UnoFeatures>
15+
SkiaRenderer;
16+
</UnoFeatures>
17+
</PropertyGroup>
18+
19+
<PropertyGroup>
20+
<PackageId>CSharpMarkup.WinUI.Mapsui</PackageId>
21+
<Title>CSharpMarkup.WinUI.Mapsui</Title>
22+
<Summary>Build .NET browser / native UI in declarative C#</Summary>
23+
<Description>Enjoy a Flutter-like UI development experience with .NET Hot Reload and WinUI 3, using Windows App SDK and/or Uno Platform. Build .NET applications fully in C#. Target browsers and native desktop / mobile. No XAML / HTML / JavaScript / CSS required</Description>
24+
<PackageReadmeFile>Readme.md</PackageReadmeFile>
25+
<PackageTags>csharpformarkup,csharpmarkup,markup,csharp,ui,winui,windowsappsdk,uno,webassembly,windows,desktop,flutter</PackageTags>
26+
<Copyright>Copyright © VincentH.NET</Copyright>
27+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
28+
<Authors>VincentH.NET</Authors>
29+
<Owners>VincentH.NET</Owners>
30+
<RepositoryUrl>https://github.com/VincentH-Net/CSharpForMarkup</RepositoryUrl>
31+
<PackageProjectUrl>https://github.com/VincentH-Net/CSharpForMarkup</PackageProjectUrl>
32+
<PackageReleaseNotes>See source repository for release notes</PackageReleaseNotes>
33+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
34+
<RepositoryType>git</RepositoryType>
35+
<Product>$(AssemblyName) ($(TargetFramework))</Product>
36+
<Version>$(CSharpMarkupVersion)-beta.18</Version> <!-- Keep the beta version suffix equal to Mapsui 5.0.0-beta.<nr>, remove when out of beta -->
37+
<NeutralLanguage>en</NeutralLanguage>
38+
39+
<NoWarn>CS1591;CS1573;Uno0001</NoWarn>
40+
41+
<GenerateDocumentationFile Condition=" '$(Configuration)' == 'Release' ">true</GenerateDocumentationFile>
42+
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
43+
44+
<!-- Enable Source Link -->
45+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
46+
<IncludeSymbols>true</IncludeSymbols>
47+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
48+
49+
<DebugType>portable</DebugType>
50+
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb;.xml</AllowedOutputExtensionsInPackageBuildOutputFolder>
51+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
52+
</PropertyGroup>
53+
54+
<PropertyGroup>
55+
<TargetFrameworks>net8.0;net8.0-ios;net8.0-maccatalyst;net8.0-android;net8.0-windows10.0.19041;net8.0-browserwasm;net8.0-desktop;net9.0;net9.0-ios;net9.0-maccatalyst;net9.0-android;net9.0-browserwasm;net9.0-windows10.0.19041;net9.0-desktop</TargetFrameworks>
56+
<!-- Identical to Mapsui.Uno.WinUI 5 target frameworks, see https://github.com/Mapsui/Mapsui/blob/main/Mapsui.UI.Uno.WinUI/Mapsui.UI.Uno.WinUI.csproj -->
57+
<RootNamespace>CSharpMarkup.WinUI.Mapsui</RootNamespace>
58+
<EnableDefaultPageItems>false</EnableDefaultPageItems>
59+
</PropertyGroup>
60+
61+
<PropertyGroup Condition="$(IsUno)==false">
62+
<UseWinUI>true</UseWinUI>
63+
</PropertyGroup>
64+
65+
<ItemGroup>
66+
<PackageReference Include="Mapsui.Uno.WinUI" />
67+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
68+
<PackageReference Include="CSharpMarkup.WinUI" />
69+
<PackageReference Include="SkiaSharp.Views.Uno.WinUI" />
70+
<PackageReference Include="SkiaSharp.Skottie" />
71+
</ItemGroup>
72+
73+
<ItemGroup>
74+
<ProjectReference Include="..\..\..\CSharpMarkup.Generators\WinUI\SourceGenerators\SourceGenerators.csproj" Condition=" '$(Configuration)' == 'Generate' ">
75+
<OutputItemType>Analyzer</OutputItemType>
76+
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
77+
</ProjectReference>
78+
</ItemGroup>
79+
80+
<Import Project="..\..\..\CSharpMarkup.Generators\WinUI\Attributes\Attributes.projitems" Label="Shared" Condition=" '$(Configuration)' == 'Generate' " />
81+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Start of generated C# Markup API for Uno.WinUI
2+
#if NET8_0 && __ANDROID__
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using CSharpMarkup.WinUI.GeneratedCodeUtilities;
7+
using Xaml = Microsoft.UI.Xaml;
8+
using MuiCore = Mapsui;
9+
using Mui = Mapsui.UI.WinUI;
10+
11+
namespace CSharpMarkup.WinUI.Mapsui // MapControl
12+
{
13+
public static partial class Helpers
14+
{
15+
/// <summary>Create a <see cref="Mui.MapControl"/></summary>
16+
public static MapControl MapControl(params Xaml.UIElement[] Children)
17+
{
18+
var ui = new Mui.MapControl();
19+
for (int i = 0; i < Children.Length; i++)
20+
{
21+
var child = Children[i];
22+
if (child == null) continue;
23+
24+
var subChildren = Spreader<Xaml.UIElement>.ExtractChildren(child);
25+
if (subChildren is not null)
26+
for (int j = 0; j < subChildren.Length; j++)
27+
ui.Children.Add(subChildren[j]);
28+
else
29+
ui.Children.Add(child);
30+
}
31+
return CSharpMarkup.WinUI.Mapsui.MapControl.StartChain(ui);
32+
}
33+
34+
/// <summary>Create a <see cref="Mui.MapControl"/></summary>
35+
public static MapControl MapControl()
36+
{
37+
var ui = new Mui.MapControl();
38+
return CSharpMarkup.WinUI.Mapsui.MapControl.StartChain(ui);
39+
}
40+
}
41+
42+
public partial class MapControl : Grid, IUI<Mui.MapControl>
43+
{
44+
static MapControl instance;
45+
46+
internal static MapControl StartChain(Mui.MapControl ui)
47+
{
48+
if (instance == null) instance = new MapControl();
49+
instance.UI = ui;
50+
return instance;
51+
}
52+
53+
Mui.MapControl ui;
54+
55+
public new Mui.MapControl UI
56+
{
57+
get => ui;
58+
protected set => base.UI = ui = value;
59+
}
60+
61+
public static implicit operator Xaml.UIElement(MapControl view) => view?.UI;
62+
63+
public static implicit operator Mui.MapControl(MapControl view) => view?.UI;
64+
65+
public static implicit operator MapControl(Mui.MapControl ui) => MapControl.StartChain(ui);
66+
67+
public MapControl Invoke(Action<Mui.MapControl> action) { action?.Invoke(UI); return this; }
68+
69+
protected MapControl() { }
70+
}
71+
72+
public static partial class MapControlExtensions
73+
{
74+
/// <summary>Set <see cref="Mui.MapControl.Map"/></summary>
75+
public static TView Map<TView>(this TView view, MuiCore.Map value) where TView : MapControl { view.UI.Map = value; return view; }
76+
77+
/// <summary>Set <see cref="Mui.MapControl.MaxTapGestureMovement"/></summary>
78+
public static TView MaxTapGestureMovement<TView>(this TView view, int value) where TView : MapControl { view.UI.MaxTapGestureMovement = value; return view; }
79+
80+
/// <summary>Set <see cref="Mui.MapControl.UseFling"/></summary>
81+
public static TView UseFling<TView>(this TView view, bool value) where TView : MapControl { view.UI.UseFling = value; return view; }
82+
}
83+
}
84+
85+
86+
#endif
87+
// End of generated C# Markup API for Uno.WinUI
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Start of generated C# Markup API for Uno.WinUI
2+
#if NET8_0 && BROWSERWASM
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using CSharpMarkup.WinUI.GeneratedCodeUtilities;
7+
using Xaml = Microsoft.UI.Xaml;
8+
using MuiCore = Mapsui;
9+
using Mui = Mapsui.UI.WinUI;
10+
11+
namespace CSharpMarkup.WinUI.Mapsui // MapControl
12+
{
13+
public static partial class Helpers
14+
{
15+
/// <summary>Create a <see cref="Mui.MapControl"/></summary>
16+
public static MapControl MapControl(params Xaml.UIElement[] Children)
17+
{
18+
var ui = new Mui.MapControl();
19+
for (int i = 0; i < Children.Length; i++)
20+
{
21+
var child = Children[i];
22+
if (child == null) continue;
23+
24+
var subChildren = Spreader<Xaml.UIElement>.ExtractChildren(child);
25+
if (subChildren is not null)
26+
for (int j = 0; j < subChildren.Length; j++)
27+
ui.Children.Add(subChildren[j]);
28+
else
29+
ui.Children.Add(child);
30+
}
31+
return CSharpMarkup.WinUI.Mapsui.MapControl.StartChain(ui);
32+
}
33+
34+
/// <summary>Create a <see cref="Mui.MapControl"/></summary>
35+
public static MapControl MapControl()
36+
{
37+
var ui = new Mui.MapControl();
38+
return CSharpMarkup.WinUI.Mapsui.MapControl.StartChain(ui);
39+
}
40+
}
41+
42+
public partial class MapControl : Grid, IUI<Mui.MapControl>
43+
{
44+
static MapControl instance;
45+
46+
internal static MapControl StartChain(Mui.MapControl ui)
47+
{
48+
if (instance == null) instance = new MapControl();
49+
instance.UI = ui;
50+
return instance;
51+
}
52+
53+
Mui.MapControl ui;
54+
55+
public new Mui.MapControl UI
56+
{
57+
get => ui;
58+
protected set => base.UI = ui = value;
59+
}
60+
61+
public static implicit operator Xaml.UIElement(MapControl view) => view?.UI;
62+
63+
public static implicit operator Mui.MapControl(MapControl view) => view?.UI;
64+
65+
public static implicit operator MapControl(Mui.MapControl ui) => MapControl.StartChain(ui);
66+
67+
public MapControl Invoke(Action<Mui.MapControl> action) { action?.Invoke(UI); return this; }
68+
69+
protected MapControl() { }
70+
}
71+
72+
public static partial class MapControlExtensions
73+
{
74+
/// <summary>Set <see cref="Mui.MapControl.Map"/></summary>
75+
public static TView Map<TView>(this TView view, MuiCore.Map value) where TView : MapControl { view.UI.Map = value; return view; }
76+
77+
/// <summary>Set <see cref="Mui.MapControl.MaxTapGestureMovement"/></summary>
78+
public static TView MaxTapGestureMovement<TView>(this TView view, int value) where TView : MapControl { view.UI.MaxTapGestureMovement = value; return view; }
79+
80+
/// <summary>Set <see cref="Mui.MapControl.UseFling"/></summary>
81+
public static TView UseFling<TView>(this TView view, bool value) where TView : MapControl { view.UI.UseFling = value; return view; }
82+
}
83+
}
84+
85+
86+
#endif
87+
// End of generated C# Markup API for Uno.WinUI
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// Start of generated C# Markup API for Uno.WinUI
2+
#if NET8_0 && DESKTOP
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using CSharpMarkup.WinUI.GeneratedCodeUtilities;
7+
using Xaml = Microsoft.UI.Xaml;
8+
using MuiCore = Mapsui;
9+
using Mui = Mapsui.UI.WinUI;
10+
11+
namespace CSharpMarkup.WinUI.Mapsui // MapControl
12+
{
13+
public static partial class Helpers
14+
{
15+
/// <summary>Create a <see cref="Mui.MapControl"/></summary>
16+
public static MapControl MapControl(params Xaml.UIElement[] Children)
17+
{
18+
var ui = new Mui.MapControl();
19+
for (int i = 0; i < Children.Length; i++)
20+
{
21+
var child = Children[i];
22+
if (child == null) continue;
23+
24+
var subChildren = Spreader<Xaml.UIElement>.ExtractChildren(child);
25+
if (subChildren is not null)
26+
for (int j = 0; j < subChildren.Length; j++)
27+
ui.Children.Add(subChildren[j]);
28+
else
29+
ui.Children.Add(child);
30+
}
31+
return CSharpMarkup.WinUI.Mapsui.MapControl.StartChain(ui);
32+
}
33+
34+
/// <summary>Create a <see cref="Mui.MapControl"/></summary>
35+
public static MapControl MapControl()
36+
{
37+
var ui = new Mui.MapControl();
38+
return CSharpMarkup.WinUI.Mapsui.MapControl.StartChain(ui);
39+
}
40+
}
41+
42+
public partial class MapControl : Grid, IUI<Mui.MapControl>
43+
{
44+
static MapControl instance;
45+
46+
internal static MapControl StartChain(Mui.MapControl ui)
47+
{
48+
if (instance == null) instance = new MapControl();
49+
instance.UI = ui;
50+
return instance;
51+
}
52+
53+
Mui.MapControl ui;
54+
55+
public new Mui.MapControl UI
56+
{
57+
get => ui;
58+
protected set => base.UI = ui = value;
59+
}
60+
61+
public static implicit operator Xaml.UIElement(MapControl view) => view?.UI;
62+
63+
public static implicit operator Mui.MapControl(MapControl view) => view?.UI;
64+
65+
public static implicit operator MapControl(Mui.MapControl ui) => MapControl.StartChain(ui);
66+
67+
public MapControl Invoke(Action<Mui.MapControl> action) { action?.Invoke(UI); return this; }
68+
69+
protected MapControl() { }
70+
}
71+
72+
public static partial class MapControlExtensions
73+
{
74+
/// <summary>Set <see cref="Mui.MapControl.Map"/></summary>
75+
public static TView Map<TView>(this TView view, MuiCore.Map value) where TView : MapControl { view.UI.Map = value; return view; }
76+
77+
/// <summary>Set <see cref="Mui.MapControl.MaxTapGestureMovement"/></summary>
78+
public static TView MaxTapGestureMovement<TView>(this TView view, int value) where TView : MapControl { view.UI.MaxTapGestureMovement = value; return view; }
79+
80+
/// <summary>Set <see cref="Mui.MapControl.UseFling"/></summary>
81+
public static TView UseFling<TView>(this TView view, bool value) where TView : MapControl { view.UI.UseFling = value; return view; }
82+
}
83+
}
84+
85+
86+
#endif
87+
// End of generated C# Markup API for Uno.WinUI

0 commit comments

Comments
 (0)