Skip to content

Commit 805296a

Browse files
authored
Merge pull request #163 from FmgLib/v8.8.9
V8.8.9
2 parents f6cc2ad + ce302ba commit 805296a

File tree

12 files changed

+340
-24
lines changed

12 files changed

+340
-24
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
push:
66
branches:
77
- master
8-
- develop
98

109
env:
1110
SOLUTION_PATH: './FmgLib.MauiMarkup.sln'
1211
PROJECT_PATH: 'src\FmgLib.MauiMarkup\FmgLib.MauiMarkup.csproj'
1312
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}\output
13+
NUGET_API_KEY: ${{ secrets.NUGET_AUTH_TOKEN }}
1414

1515
jobs:
1616
deploy:
@@ -34,8 +34,12 @@ jobs:
3434
- name: Build the solution
3535
run: dotnet build ${{ env.SOLUTION_PATH }} -c Release
3636

37-
# - name: 'Restore package'
38-
# run: dotnet restore ${{ env.PROJECT_PATH }}
37+
- name: Pack NuGet package
38+
run: dotnet pack ${{ env.PROJECT_PATH }} -c Release --no-build -o ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
3939

40-
# - name: 'Build project'
41-
# run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release
40+
- name: Push to NuGet
41+
run: |
42+
$nupkgFiles = Get-ChildItem -Path "${{ env.PACKAGE_OUTPUT_DIRECTORY }}" -Filter "*.nupkg"
43+
foreach ($file in $nupkgFiles) {
44+
dotnet nuget push $file.FullName -k ${{ env.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
45+
}

sample/DalluiApp/DalluiApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
<PackageReference Include="CardsView.Maui" Version="0.0.9" />
8585
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.2" />
8686
<PackageReference Include="FmgLib.MauiMarkup" Version="8.*" />
87-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
88-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.70" />
87+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
88+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />
8989
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
9090
<PackageReference Include="SkiaSharp.Extended.UI.Maui" Version="3.0.0-preview.7" />
9191
</ItemGroup>

sample/F1TV/F1TV.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
<ItemGroup>
7676
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.2" />
7777
<PackageReference Include="FmgLib.MauiMarkup" Version="8.*" />
78-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.21" />
79-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.21" />
78+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
79+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />
8080
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
8181
</ItemGroup>
8282

sample/FruitApp/FruitApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
<ItemGroup>
7676
<PackageReference Include="AcrylicView.Maui" Version="2.1.3" />
7777
<PackageReference Include="FmgLib.MauiMarkup" Version="8.*" />
78-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.21" />
79-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.21" />
78+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
79+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />
8080
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
8181
</ItemGroup>
8282

sample/Game2048/Game2048Maui.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.2" />
7676
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
7777
<PackageReference Include="FmgLib.MauiMarkup" Version="8.*" />
78-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.71" />
79-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.71" />
78+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
79+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />
8080
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
8181
<PackageReference Include="Refractored.MvvmHelpers" Version="1.6.2" />
8282
<PackageReference Include="SkiaSharp.Extended.UI.Maui" Version="2.0.0" />

sample/Game2048/MainPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public override void Build()
6565
.Children(
6666
new Label().Style(WhiteLabelStyle).Text("Score"),
6767
new Grid().Children(
68-
new Label().Style(WhiteLabelStyle).Text(e => e.Path("Score")),
68+
new Label().Style(WhiteLabelStyle)/*.Text(e => e.Path("Score"))*/.Bind(Label.TextProperty, getter: static (MainPageViewModel vm) => vm.Score),
6969
new Label().Assign(out AddedScoreLabel).IsVisible(false).Style(WhiteLabelStyle).Text(e => e.Path("AddedScore"))
7070
)
7171
),

sample/MatchingImage/MatchingImage.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878

7979
<ItemGroup>
8080
<PackageReference Include="FmgLib.MauiMarkup" Version="8.*" />
81-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.21" />
82-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.21" />
81+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
82+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />
8383
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
8484
</ItemGroup>
8585

sample/MyMauiMarkupApp/MyMauiMarkupApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
</ItemGroup>
7272

7373
<ItemGroup>
74-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.82" />
75-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.80" />
74+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
75+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />
7676
</ItemGroup>
7777

7878
<ItemGroup>

sample/MyOrderApp/MyOrderApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
<PackageReference Include="AutoMapper" Version="13.0.1" />
7676
<PackageReference Include="LiteDB" Version="5.0.20" />
7777
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.*" Condition="'$(Configuration)' == 'Debug'" />
78-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
79-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
78+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.100" />
79+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.100" />
8080
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.1" />
8181
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
8282
<PackageReference Include="SkiaSharp.Extended.UI.Maui" Version="2.0.0" />
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
using System.Linq.Expressions;
2+
3+
namespace FmgLib.MauiMarkup;
4+
5+
public static partial class TypedBindingExtensions
6+
{
7+
8+
public static TBindable Bind<TBindable, TBindingContext, TSource>(
9+
this TBindable bindable,
10+
BindableProperty targetProperty,
11+
Expression<Func<TBindingContext, TSource>> getter,
12+
Action<TBindingContext, TSource>? setter = null,
13+
BindingMode mode = BindingMode.Default,
14+
string? stringFormat = null,
15+
TBindingContext? source = default) where TBindable : BindableObject
16+
{
17+
return Bind<TBindable, TBindingContext, TSource, object?, object?>(
18+
bindable,
19+
targetProperty,
20+
getter,
21+
setter,
22+
mode,
23+
null,
24+
null,
25+
null,
26+
stringFormat,
27+
source,
28+
null,
29+
null);
30+
}
31+
32+
public static TBindable Bind<TBindable, TBindingContext, TSource, TDest>(
33+
this TBindable bindable,
34+
BindableProperty targetProperty,
35+
Expression<Func<TBindingContext, TSource>> getter,
36+
Action<TBindingContext, TSource>? setter = null,
37+
BindingMode mode = BindingMode.Default,
38+
Func<TSource?, TDest>? convert = null,
39+
Func<TDest?, TSource>? convertBack = null,
40+
string? stringFormat = null,
41+
TBindingContext? source = default,
42+
TDest? targetNullValue = default,
43+
TDest? fallbackValue = default) where TBindable : BindableObject
44+
{
45+
return Bind<TBindable, TBindingContext, TSource, object?, TDest>(
46+
bindable,
47+
targetProperty,
48+
getter,
49+
setter,
50+
mode,
51+
convert is null ? null : (source, _) => convert(source),
52+
convertBack is null ? null : (dest, _) => convertBack(dest),
53+
null,
54+
stringFormat,
55+
source,
56+
targetNullValue,
57+
fallbackValue);
58+
}
59+
60+
public static TBindable Bind<TBindable, TBindingContext, TSource, TDest>(
61+
this TBindable bindable,
62+
BindableProperty targetProperty,
63+
Expression<Func<TBindingContext, TSource>> getter,
64+
Action<TBindingContext, TSource>? setter = null,
65+
BindingMode mode = BindingMode.Default,
66+
IValueConverter? converter = null,
67+
string? stringFormat = null,
68+
TBindingContext? source = default,
69+
TDest? targetNullValue = default,
70+
TDest? fallbackValue = default) where TBindable : BindableObject
71+
{
72+
return Bind<TBindable, TBindingContext, TSource, object?, TDest>(
73+
bindable,
74+
targetProperty,
75+
getter,
76+
setter,
77+
mode,
78+
converter,
79+
null,
80+
stringFormat,
81+
source,
82+
targetNullValue,
83+
fallbackValue);
84+
}
85+
86+
public static TBindable Bind<TBindable, TBindingContext, TSource, TDest>(
87+
this TBindable bindable,
88+
BindableProperty targetProperty,
89+
Func<TBindingContext, TSource> getter,
90+
(Func<TBindingContext, object?>, string)[] handlers,
91+
Action<TBindingContext, TSource>? setter = null,
92+
BindingMode mode = BindingMode.Default,
93+
IValueConverter? converter = null,
94+
string? stringFormat = null,
95+
TBindingContext? source = default,
96+
TDest? targetNullValue = default,
97+
TDest? fallbackValue = default) where TBindable : BindableObject
98+
{
99+
return Bind<TBindable, TBindingContext, TSource, object?, TDest>(
100+
bindable,
101+
targetProperty,
102+
getter,
103+
handlers,
104+
setter,
105+
mode,
106+
converter,
107+
null,
108+
stringFormat,
109+
source,
110+
targetNullValue,
111+
fallbackValue);
112+
}
113+
114+
public static TBindable Bind<TBindable, TBindingContext, TSource, TParam, TDest>(
115+
this TBindable bindable,
116+
BindableProperty targetProperty,
117+
Expression<Func<TBindingContext, TSource>> getter,
118+
Action<TBindingContext, TSource>? setter = null,
119+
BindingMode mode = BindingMode.Default,
120+
Func<TSource?, TParam?, TDest>? convert = null,
121+
Func<TDest?, TParam?, TSource>? convertBack = null,
122+
TParam? converterParameter = default,
123+
string? stringFormat = null,
124+
TBindingContext? source = default,
125+
TDest? targetNullValue = default,
126+
TDest? fallbackValue = default) where TBindable : BindableObject
127+
{
128+
var getterFunc = ConvertExpressionToFunc(getter);
129+
130+
return Bind(
131+
bindable,
132+
targetProperty,
133+
getterFunc,
134+
new (Func<TBindingContext, object?>, string)[] { ((TBindingContext b) => b, GetMemberName(getter)) },
135+
setter,
136+
mode,
137+
convert,
138+
convertBack,
139+
converterParameter,
140+
stringFormat,
141+
source,
142+
targetNullValue,
143+
fallbackValue);
144+
}
145+
146+
public static TBindable Bind<TBindable, TBindingContext, TSource, TParam, TDest>(
147+
this TBindable bindable,
148+
BindableProperty targetProperty,
149+
Expression<Func<TBindingContext, TSource>> getter,
150+
Action<TBindingContext, TSource>? setter = null,
151+
BindingMode mode = BindingMode.Default,
152+
IValueConverter? converter = null,
153+
TParam? converterParameter = default,
154+
string? stringFormat = null,
155+
TBindingContext? source = default,
156+
TDest? targetNullValue = default,
157+
TDest? fallbackValue = default) where TBindable : BindableObject
158+
{
159+
var getterFunc = ConvertExpressionToFunc(getter);
160+
161+
return Bind(
162+
bindable,
163+
targetProperty,
164+
getterFunc,
165+
new (Func<TBindingContext, object?>, string)[] { ((TBindingContext b) => b, GetMemberName(getter)) },
166+
setter,
167+
mode,
168+
converter,
169+
converterParameter,
170+
stringFormat,
171+
source,
172+
targetNullValue,
173+
fallbackValue);
174+
}
175+
176+
static Func<TBindingContext, TSource> ConvertExpressionToFunc<TBindingContext, TSource>(in Expression<Func<TBindingContext, TSource>> expression) => expression.Compile();
177+
178+
static string GetMemberName<T>(in Expression<T> expression) => expression.Body switch
179+
{
180+
MemberExpression m => m.Member.Name,
181+
UnaryExpression u when u.Operand is MemberExpression m => m.Member.Name,
182+
_ => throw new InvalidOperationException("Could not retreive member name")
183+
};
184+
}

0 commit comments

Comments
 (0)