Skip to content

Commit

Permalink
Reducing memory allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
adospace committed Jan 2, 2024
1 parent 1dda6c7 commit 335d8ad
Show file tree
Hide file tree
Showing 93 changed files with 1,367 additions and 1,704 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
env:
Solution_Name: ./src/MauiReactor.Build.sln
TemplatePack_Name: ./src/MauiReactor.TemplatePack/MauiReactor.TemplatePack.csproj
Version: 2.0.12-beta
Version: 2.0.13-beta

steps:
- name: Checkout
Expand Down
65 changes: 0 additions & 65 deletions src/MauiReactor.Canvas/DropShadow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,71 +16,6 @@ namespace MauiReactor.Canvas;
public partial class DropShadow { }


//public partial interface IDropShadow : ICanvasNode
//{
// PropertyValue<Color>? Color { get; set; }
// PropertyValue<SizeF>? Size { get; set; }
// PropertyValue<float>? Blur { get; set; }
//}

//public partial class DropShadow<T> : CanvasNode<T>, IDropShadow where T : Internals.DropShadow, new()
//{

// public DropShadow()
// {

// }

// public DropShadow(Action<T?> componentRefAction)
// : base(componentRefAction)
// {

// }

// PropertyValue<Color>? IDropShadow.Color { get; set; }
// PropertyValue<SizeF>? IDropShadow.Size { get; set; }
// PropertyValue<float>? IDropShadow.Blur { get; set; }


// protected override void OnUpdate()
// {
// Validate.EnsureNotNull(NativeControl);
// var thisAsIBorder = (IDropShadow)this;

// SetPropertyValue(NativeControl, Internals.DropShadow.ColorProperty, thisAsIBorder.Color);
// SetPropertyValue(NativeControl, Internals.DropShadow.SizeProperty, thisAsIBorder.Size);
// SetPropertyValue(NativeControl, Internals.DropShadow.BlurProperty, thisAsIBorder.Blur);

// base.OnUpdate();
// }

// protected override void OnAnimate()
// {
// Validate.EnsureNotNull(NativeControl);
// var thisAsIBorder = (IDropShadow)this;

// SetPropertyValue(NativeControl, Internals.DropShadow.ColorProperty, thisAsIBorder.Color);
// SetPropertyValue(NativeControl, Internals.DropShadow.SizeProperty, thisAsIBorder.Size);
// SetPropertyValue(NativeControl, Internals.DropShadow.BlurProperty, thisAsIBorder.Blur);

// base.OnAnimate();
// }
//}

//public partial class DropShadow : DropShadow<Internals.DropShadow>
//{
// public DropShadow()
// {

// }

// public DropShadow(Action<Internals.DropShadow?> componentRefAction)
// : base(componentRefAction)
// {

// }
//}

public static partial class DropShadowExtensions
{
public static T Size<T>(this T node, float x, float y, RxSizeFAnimation? customAnimation = null) where T : IDropShadow
Expand Down
185 changes: 26 additions & 159 deletions src/MauiReactor.Scaffold/TypeGenerator.cs

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions src/MauiReactor.Scaffold/TypeGenerator.tt

Large diffs are not rendered by default.

294 changes: 42 additions & 252 deletions src/MauiReactor.ScaffoldGenerator/ScaffoldTypeGenerator.cs

Large diffs are not rendered by default.

62 changes: 31 additions & 31 deletions src/MauiReactor.ScaffoldGenerator/ScaffoldTypeGenerator.tt

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/MauiReactor/ActivityIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
namespace MauiReactor;
public partial interface IActivityIndicator : IView
{
PropertyValue<bool>? IsRunning { get; set; }
object? IsRunning { get; set; }

PropertyValue<Microsoft.Maui.Graphics.Color>? Color { get; set; }
object? Color { get; set; }
}

public partial class ActivityIndicator<T> : View<T>, IActivityIndicator where T : Microsoft.Maui.Controls.ActivityIndicator, new()
Expand All @@ -27,9 +27,9 @@ public ActivityIndicator(Action<T?> componentRefAction) : base(componentRefActio
{
}

PropertyValue<bool>? IActivityIndicator.IsRunning { get; set; }
object? IActivityIndicator.IsRunning { get; set; }

PropertyValue<Microsoft.Maui.Graphics.Color>? IActivityIndicator.Color { get; set; }
object? IActivityIndicator.Color { get; set; }

internal override void Reset()
{
Expand Down Expand Up @@ -74,7 +74,7 @@ public static partial class ActivityIndicatorExtensions
public static T IsRunning<T>(this T activityIndicator, bool isRunning)
where T : IActivityIndicator
{
activityIndicator.IsRunning = new PropertyValue<bool>(isRunning);
activityIndicator.IsRunning = isRunning;
return activityIndicator;
}

Expand All @@ -88,7 +88,7 @@ public static T IsRunning<T>(this T activityIndicator, Func<bool> isRunningFunc)
public static T Color<T>(this T activityIndicator, Microsoft.Maui.Graphics.Color color)
where T : IActivityIndicator
{
activityIndicator.Color = new PropertyValue<Microsoft.Maui.Graphics.Color>(color);
activityIndicator.Color = color;
return activityIndicator;
}

Expand Down
60 changes: 35 additions & 25 deletions src/MauiReactor/BaseShellItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
namespace MauiReactor;
public partial interface IBaseShellItem : INavigableElement
{
PropertyValue<Microsoft.Maui.Controls.ImageSource>? FlyoutIcon { get; set; }
object? FlyoutIcon { get; set; }

PropertyValue<Microsoft.Maui.Controls.ImageSource>? Icon { get; set; }
object? Icon { get; set; }

PropertyValue<bool>? IsEnabled { get; set; }
object? IsEnabled { get; set; }

PropertyValue<string>? Title { get; set; }
object? Title { get; set; }

PropertyValue<bool>? IsVisible { get; set; }
object? IsVisible { get; set; }

Action? AppearingAction { get; set; }

Expand All @@ -41,15 +41,15 @@ public BaseShellItem(Action<T?> componentRefAction) : base(componentRefAction)
{
}

PropertyValue<Microsoft.Maui.Controls.ImageSource>? IBaseShellItem.FlyoutIcon { get; set; }
object? IBaseShellItem.FlyoutIcon { get; set; }

PropertyValue<Microsoft.Maui.Controls.ImageSource>? IBaseShellItem.Icon { get; set; }
object? IBaseShellItem.Icon { get; set; }

PropertyValue<bool>? IBaseShellItem.IsEnabled { get; set; }
object? IBaseShellItem.IsEnabled { get; set; }

PropertyValue<string>? IBaseShellItem.Title { get; set; }
object? IBaseShellItem.Title { get; set; }

PropertyValue<bool>? IBaseShellItem.IsVisible { get; set; }
object? IBaseShellItem.IsVisible { get; set; }

Action? IBaseShellItem.AppearingAction { get; set; }

Expand Down Expand Up @@ -153,7 +153,7 @@ public static partial class BaseShellItemExtensions
public static T FlyoutIcon<T>(this T baseShellItem, Microsoft.Maui.Controls.ImageSource flyoutIcon)
where T : IBaseShellItem
{
baseShellItem.FlyoutIcon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(flyoutIcon);
baseShellItem.FlyoutIcon = flyoutIcon;
return baseShellItem;
}

Expand All @@ -167,7 +167,7 @@ public static T FlyoutIcon<T>(this T baseShellItem, Func<Microsoft.Maui.Controls
public static T FlyoutIcon<T>(this T baseShellItem, string file)
where T : IBaseShellItem
{
baseShellItem.FlyoutIcon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromFile(file));
baseShellItem.FlyoutIcon = Microsoft.Maui.Controls.ImageSource.FromFile(file);
return baseShellItem;
}

Expand All @@ -181,35 +181,40 @@ public static T FlyoutIcon<T>(this T baseShellItem, Func<string> action)
public static T FlyoutIcon<T>(this T baseShellItem, string resourceName, Assembly sourceAssembly)
where T : IBaseShellItem
{
baseShellItem.FlyoutIcon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromResource(resourceName, sourceAssembly));
baseShellItem.FlyoutIcon = Microsoft.Maui.Controls.ImageSource.FromResource(resourceName, sourceAssembly);
return baseShellItem;
}

public static T FlyoutIcon<T>(this T baseShellItem, Uri imageUri)
where T : IBaseShellItem
{
baseShellItem.FlyoutIcon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromUri(imageUri));
baseShellItem.FlyoutIcon = Microsoft.Maui.Controls.ImageSource.FromUri(imageUri);
return baseShellItem;
}

public static T FlyoutIcon<T>(this T baseShellItem, Uri imageUri, bool cachingEnabled, TimeSpan cacheValidity)
where T : IBaseShellItem
{
baseShellItem.FlyoutIcon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(new UriImageSource { Uri = imageUri, CachingEnabled = cachingEnabled, CacheValidity = cacheValidity });
baseShellItem.FlyoutIcon = new UriImageSource
{
Uri = imageUri,
CachingEnabled = cachingEnabled,
CacheValidity = cacheValidity
};
return baseShellItem;
}

public static T FlyoutIcon<T>(this T baseShellItem, Func<Stream> imageStream)
where T : IBaseShellItem
{
baseShellItem.FlyoutIcon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromStream(imageStream));
baseShellItem.FlyoutIcon = Microsoft.Maui.Controls.ImageSource.FromStream(imageStream);
return baseShellItem;
}

public static T Icon<T>(this T baseShellItem, Microsoft.Maui.Controls.ImageSource icon)
where T : IBaseShellItem
{
baseShellItem.Icon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(icon);
baseShellItem.Icon = icon;
return baseShellItem;
}

Expand All @@ -223,7 +228,7 @@ public static T Icon<T>(this T baseShellItem, Func<Microsoft.Maui.Controls.Image
public static T Icon<T>(this T baseShellItem, string file)
where T : IBaseShellItem
{
baseShellItem.Icon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromFile(file));
baseShellItem.Icon = Microsoft.Maui.Controls.ImageSource.FromFile(file);
return baseShellItem;
}

Expand All @@ -237,35 +242,40 @@ public static T Icon<T>(this T baseShellItem, Func<string> action)
public static T Icon<T>(this T baseShellItem, string resourceName, Assembly sourceAssembly)
where T : IBaseShellItem
{
baseShellItem.Icon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromResource(resourceName, sourceAssembly));
baseShellItem.Icon = Microsoft.Maui.Controls.ImageSource.FromResource(resourceName, sourceAssembly);
return baseShellItem;
}

public static T Icon<T>(this T baseShellItem, Uri imageUri)
where T : IBaseShellItem
{
baseShellItem.Icon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromUri(imageUri));
baseShellItem.Icon = Microsoft.Maui.Controls.ImageSource.FromUri(imageUri);
return baseShellItem;
}

public static T Icon<T>(this T baseShellItem, Uri imageUri, bool cachingEnabled, TimeSpan cacheValidity)
where T : IBaseShellItem
{
baseShellItem.Icon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(new UriImageSource { Uri = imageUri, CachingEnabled = cachingEnabled, CacheValidity = cacheValidity });
baseShellItem.Icon = new UriImageSource
{
Uri = imageUri,
CachingEnabled = cachingEnabled,
CacheValidity = cacheValidity
};
return baseShellItem;
}

public static T Icon<T>(this T baseShellItem, Func<Stream> imageStream)
where T : IBaseShellItem
{
baseShellItem.Icon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(Microsoft.Maui.Controls.ImageSource.FromStream(imageStream));
baseShellItem.Icon = Microsoft.Maui.Controls.ImageSource.FromStream(imageStream);
return baseShellItem;
}

public static T IsEnabled<T>(this T baseShellItem, bool isEnabled)
where T : IBaseShellItem
{
baseShellItem.IsEnabled = new PropertyValue<bool>(isEnabled);
baseShellItem.IsEnabled = isEnabled;
return baseShellItem;
}

Expand All @@ -279,7 +289,7 @@ public static T IsEnabled<T>(this T baseShellItem, Func<bool> isEnabledFunc)
public static T Title<T>(this T baseShellItem, string title)
where T : IBaseShellItem
{
baseShellItem.Title = new PropertyValue<string>(title);
baseShellItem.Title = title;
return baseShellItem;
}

Expand All @@ -293,7 +303,7 @@ public static T Title<T>(this T baseShellItem, Func<string> titleFunc)
public static T IsVisible<T>(this T baseShellItem, bool isVisible)
where T : IBaseShellItem
{
baseShellItem.IsVisible = new PropertyValue<bool>(isVisible);
baseShellItem.IsVisible = isVisible;
return baseShellItem;
}

Expand Down
Loading

0 comments on commit 335d8ad

Please sign in to comment.