Skip to content

Commit 5fc7dbd

Browse files
committed
Cleaned up the code generation logic
Added more generated bindings
1 parent 333d3a9 commit 5fc7dbd

File tree

9 files changed

+2482
-2303
lines changed

9 files changed

+2482
-2303
lines changed

sample/MauiSample/Features/Main/MainPageViewModel.cs

Lines changed: 135 additions & 223 deletions
Large diffs are not rendered by default.

src/ShieldMVVM/ActionSheet/ActionSheetItemCell.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<base:ViewCellBase
33
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
44
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5-
x:Class="CoreBTS.Maui.ShieldMVVM.ActionSheet.ActionSheetItemCell"
65
xmlns:base="clr-namespace:CoreBTS.Maui.ShieldMVVM.DataTemplates;assembly=CoreBTS.Maui.ShieldMVVM"
6+
x:Class="CoreBTS.Maui.ShieldMVVM.ActionSheet.ActionSheetItemCell"
77
xmlns:m="clr-namespace:CoreBTS.Maui.ShieldMVVM.ActionSheet"
88
xmlns:self="clr-namespace:CoreBTS.Maui.ShieldMVVM.ActionSheet"
99
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
@@ -18,7 +18,7 @@
1818
</ResourceDictionary.MergedDictionaries>
1919
</ResourceDictionary>
2020
</toolkit:Popup.Resources>
21-
21+
2222
<Button
2323
x:Name="ActionButton"
2424
Style="{StaticResource ActionSheetButtonStyle}"

src/ShieldMVVM/ActionSheet/ActionSheetPage.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<base:DialogPageBase xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
2+
<base:DialogPageBase
3+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
34
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
45
xmlns:base="clr-namespace:CoreBTS.Maui.ShieldMVVM.Pages;assembly=CoreBTS.Maui.ShieldMVVM"
56
x:Class="CoreBTS.Maui.ShieldMVVM.ActionSheet.ActionSheetPage"
@@ -9,7 +10,6 @@
910
Color="{OnPlatform iOS=Transparent, Default={StaticResource Black60Pct}}"
1011
HorizontalOptions="Fill"
1112
VerticalOptions="Fill"
12-
x:Name="popup"
1313
>
1414

1515
<toolkit:Popup.Resources>
@@ -78,6 +78,9 @@
7878
Grid.Row="1"
7979
CornerRadius="10"
8080
Style="{StaticResource ActionSheetCancelButtonStyle}" />
81+
8182
</Grid>
83+
8284
</Grid>
85+
8386
</base:DialogPageBase>

src/ShieldMVVM/Configuration/MauiAppBuilderExtensionMethods.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using CoreBTS.Maui.ShieldMVVM.ViewModel;
44
using System.Collections.Concurrent;
55
using System.Reflection;
6-
using System.Runtime.CompilerServices;
76

87
namespace CoreBTS.Maui.ShieldMVVM.Configuration;
98

src/ShieldMVVM/Converters/Converter.Bool.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,4 @@ public static IValueConverter<bool, bool> ConvertToInverse(this BindingConverter
3131
public static IValueConverter<bool?, bool> ConvertToBool(this BindingConverter<bool?, bool> _, bool defaultValue = false) =>
3232
Create(_,
3333
value => value ?? defaultValue);
34-
35-
/// <summary>
36-
/// A converter that converts the given string's length to a bool value.
37-
/// </summary>
38-
/// <param name="_">Extension parameter.</param>
39-
/// <returns>An IValueConverter.</returns>
40-
public static IValueConverter<string?, bool> ConvertToNullableHasLength(this BindingConverter<string?, bool> _) =>
41-
Create(_,
42-
value => !string.IsNullOrEmpty(value));
43-
44-
/// <summary>
45-
/// A converter that converts the given string's length to a bool value.
46-
/// </summary>
47-
/// <param name="_">Extension parameter.</param>
48-
/// <returns>An IValueConverter.</returns>
49-
public static IValueConverter<string, bool> ConvertToHasLength(this BindingConverter<string, bool> _) =>
50-
Create(_,
51-
value => !string.IsNullOrEmpty(value));
5234
}

src/ShieldMVVM/Converters/Converter.String.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,22 @@ public static IValueConverter<string, string> ConvertToUpperCase(this BindingCon
3737
public static IValueConverter<string?, string> ConvertToNonNullString(this BindingConverter<string?, string> _) =>
3838
Create(_,
3939
value => value ?? string.Empty);
40+
41+
/// <summary>
42+
/// A converter that converts the given string's length to a bool value.
43+
/// </summary>
44+
/// <param name="_">Extension parameter.</param>
45+
/// <returns>An IValueConverter.</returns>
46+
public static IValueConverter<string?, bool> ConvertToNullableHasLength(this BindingConverter<string?, bool> _) =>
47+
Create(_,
48+
value => !string.IsNullOrEmpty(value));
49+
50+
/// <summary>
51+
/// A converter that converts the given string's length to a bool value.
52+
/// </summary>
53+
/// <param name="_">Extension parameter.</param>
54+
/// <returns>An IValueConverter.</returns>
55+
public static IValueConverter<string, bool> ConvertToHasLength(this BindingConverter<string, bool> _) =>
56+
Create(_,
57+
value => !string.IsNullOrEmpty(value));
4058
}

src/ShieldMVVM/DataTemplates/DataTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class DataTemplate<TModel> : DataTemplate
88
{
99
/// <summary>
10-
/// Constructor tht takes the type of cell being bound to.
10+
/// Constructor that takes the type of cell being bound to.
1111
/// </summary>
1212
/// <param name="cellType">The type of cell being bound to.</param>
1313
public DataTemplate(Type cellType): base(cellType)

0 commit comments

Comments
 (0)