Skip to content

Commit

Permalink
ComponentGenerator: generate all elements from assembly (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamescaper authored Aug 13, 2023
1 parent 67f2792 commit bba5949
Show file tree
Hide file tree
Showing 24 changed files with 2,312 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// <auto-generated>
// This code was generated by a BlazorBindings.Maui component generator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>

using BlazorBindings.Core;
using BlazorBindings.Maui.Elements;
using MC = Microsoft.Maui.Controls;
using MCM = Material.Components.Maui;
using Microsoft.AspNetCore.Components;
using System.Threading.Tasks;

#pragma warning disable CA2252

namespace BlazorBindings.Maui.Elements.Material.Components
{
public abstract partial class MDBaseLazyView : BlazorBindings.Maui.Elements.ContentView
{
static MDBaseLazyView()
{
RegisterAdditionalHandlers();
}

public new MCM.BaseLazyView NativeControl => (MCM.BaseLazyView)((BindableObject)this).NativeControl;



static partial void RegisterAdditionalHandlers();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// <auto-generated>
// This code was generated by a BlazorBindings.Maui component generator.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>

using BlazorBindings.Core;
using BlazorBindings.Maui.Elements;
using MC = Microsoft.Maui.Controls;
using MCM = Material.Components.Maui;
using Microsoft.AspNetCore.Components;
using Microsoft.Maui.Graphics;
using System.Threading.Tasks;

#pragma warning disable CA2252

namespace BlazorBindings.Maui.Elements.Material.Components
{
public partial class MDCheckBox : SKTouchCanvasView
{
static MDCheckBox()
{
RegisterAdditionalHandlers();
}

[Parameter] public Color ForegroundColor { get; set; }
[Parameter] public bool? IsChecked { get; set; }
[Parameter] public Color MarkColor { get; set; }
[Parameter] public float? MarkOpacity { get; set; }
[Parameter] public Color OnColor { get; set; }
[Parameter] public float? OnOpacity { get; set; }
[Parameter] public Color OutlineColor { get; set; }
[Parameter] public int? OutlineWidth { get; set; }
[Parameter] public Color RippleColor { get; set; }
[Parameter] public Color StateLayerColor { get; set; }
[Parameter] public EventCallback<bool> IsCheckedChanged { get; set; }

public new MCM.CheckBox NativeControl => (MCM.CheckBox)((BindableObject)this).NativeControl;

protected override MCM.CheckBox CreateNativeElement() => new();

protected override void HandleParameter(string name, object value)
{
switch (name)
{
case nameof(ForegroundColor):
if (!Equals(ForegroundColor, value))
{
ForegroundColor = (Color)value;
NativeControl.ForegroundColor = ForegroundColor;
}
break;
case nameof(IsChecked):
if (!Equals(IsChecked, value))
{
IsChecked = (bool?)value;
NativeControl.IsChecked = IsChecked ?? (bool)MCM.CheckBox.IsCheckedProperty.DefaultValue;
}
break;
case nameof(MarkColor):
if (!Equals(MarkColor, value))
{
MarkColor = (Color)value;
NativeControl.MarkColor = MarkColor;
}
break;
case nameof(MarkOpacity):
if (!Equals(MarkOpacity, value))
{
MarkOpacity = (float?)value;
NativeControl.MarkOpacity = MarkOpacity ?? (float)MCM.CheckBox.MarkOpacityProperty.DefaultValue;
}
break;
case nameof(OnColor):
if (!Equals(OnColor, value))
{
OnColor = (Color)value;
NativeControl.OnColor = OnColor;
}
break;
case nameof(OnOpacity):
if (!Equals(OnOpacity, value))
{
OnOpacity = (float?)value;
NativeControl.OnOpacity = OnOpacity ?? (float)MCM.CheckBox.OnOpacityProperty.DefaultValue;
}
break;
case nameof(OutlineColor):
if (!Equals(OutlineColor, value))
{
OutlineColor = (Color)value;
NativeControl.OutlineColor = OutlineColor;
}
break;
case nameof(OutlineWidth):
if (!Equals(OutlineWidth, value))
{
OutlineWidth = (int?)value;
NativeControl.OutlineWidth = OutlineWidth ?? (int)MCM.CheckBox.OutlineWidthProperty.DefaultValue;
}
break;
case nameof(RippleColor):
if (!Equals(RippleColor, value))
{
RippleColor = (Color)value;
NativeControl.RippleColor = RippleColor;
}
break;
case nameof(StateLayerColor):
if (!Equals(StateLayerColor, value))
{
StateLayerColor = (Color)value;
NativeControl.StateLayerColor = StateLayerColor;
}
break;
case nameof(IsCheckedChanged):
if (!Equals(IsCheckedChanged, value))
{
void NativeControlCheckedChanged(object sender, MC.CheckedChangedEventArgs e)
{
var value = NativeControl.IsChecked;
IsChecked = value;
InvokeEventCallback(IsCheckedChanged, value);
}

IsCheckedChanged = (EventCallback<bool>)value;
NativeControl.CheckedChanged -= NativeControlCheckedChanged;
NativeControl.CheckedChanged += NativeControlCheckedChanged;
}
break;

default:
base.HandleParameter(name, value);
break;
}
}

static partial void RegisterAdditionalHandlers();
}
}
Loading

0 comments on commit bba5949

Please sign in to comment.