Fix compilation: restore clean RC1 codebase
- Restore clean BindableProperty.Create syntax from RC1 commit - Remove decompiler artifacts with mangled delegate types - Add Svg.Skia package reference for icon support - Fix duplicate type definitions - Library now compiles successfully (0 errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,134 +1,104 @@
|
||||
using System;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.Compatibility;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Platform.Linux.Hosting;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Handlers;
|
||||
|
||||
public class FrameHandler : ViewHandler<Frame, SkiaFrame>
|
||||
/// <summary>
|
||||
/// Handler for Frame on Linux using SkiaFrame.
|
||||
/// </summary>
|
||||
public partial class FrameHandler : ViewHandler<Frame, SkiaFrame>
|
||||
{
|
||||
public static IPropertyMapper<Frame, FrameHandler> Mapper = (IPropertyMapper<Frame, FrameHandler>)(object)new PropertyMapper<Frame, FrameHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)ViewHandler.ViewMapper })
|
||||
{
|
||||
["BorderColor"] = MapBorderColor,
|
||||
["CornerRadius"] = MapCornerRadius,
|
||||
["HasShadow"] = MapHasShadow,
|
||||
["BackgroundColor"] = MapBackgroundColor,
|
||||
["Padding"] = MapPadding,
|
||||
["Content"] = MapContent
|
||||
};
|
||||
public static IPropertyMapper<Frame, FrameHandler> Mapper =
|
||||
new PropertyMapper<Frame, FrameHandler>(ViewMapper)
|
||||
{
|
||||
[nameof(Frame.BorderColor)] = MapBorderColor,
|
||||
[nameof(Frame.CornerRadius)] = MapCornerRadius,
|
||||
[nameof(Frame.HasShadow)] = MapHasShadow,
|
||||
[nameof(Frame.BackgroundColor)] = MapBackgroundColor,
|
||||
[nameof(Frame.Padding)] = MapPadding,
|
||||
[nameof(Frame.Content)] = MapContent,
|
||||
};
|
||||
|
||||
public FrameHandler()
|
||||
: base((IPropertyMapper)(object)Mapper, (CommandMapper)null)
|
||||
{
|
||||
}
|
||||
public FrameHandler() : base(Mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public FrameHandler(IPropertyMapper? mapper)
|
||||
: base((IPropertyMapper)(((object)mapper) ?? ((object)Mapper)), (CommandMapper)null)
|
||||
{
|
||||
}
|
||||
public FrameHandler(IPropertyMapper? mapper)
|
||||
: base(mapper ?? Mapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override SkiaFrame CreatePlatformView()
|
||||
{
|
||||
return new SkiaFrame();
|
||||
}
|
||||
protected override SkiaFrame CreatePlatformView()
|
||||
{
|
||||
return new SkiaFrame();
|
||||
}
|
||||
|
||||
protected override void ConnectHandler(SkiaFrame platformView)
|
||||
{
|
||||
base.ConnectHandler(platformView);
|
||||
View virtualView = (View)(object)base.VirtualView;
|
||||
if (virtualView != null)
|
||||
{
|
||||
platformView.MauiView = virtualView;
|
||||
}
|
||||
platformView.Tapped += OnPlatformViewTapped;
|
||||
}
|
||||
public static void MapBorderColor(FrameHandler handler, Frame frame)
|
||||
{
|
||||
if (frame.BorderColor != null)
|
||||
{
|
||||
handler.PlatformView.Stroke = new SKColor(
|
||||
(byte)(frame.BorderColor.Red * 255),
|
||||
(byte)(frame.BorderColor.Green * 255),
|
||||
(byte)(frame.BorderColor.Blue * 255),
|
||||
(byte)(frame.BorderColor.Alpha * 255));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DisconnectHandler(SkiaFrame platformView)
|
||||
{
|
||||
platformView.Tapped -= OnPlatformViewTapped;
|
||||
platformView.MauiView = null;
|
||||
base.DisconnectHandler(platformView);
|
||||
}
|
||||
public static void MapCornerRadius(FrameHandler handler, Frame frame)
|
||||
{
|
||||
handler.PlatformView.CornerRadius = frame.CornerRadius;
|
||||
}
|
||||
|
||||
private void OnPlatformViewTapped(object? sender, EventArgs e)
|
||||
{
|
||||
View virtualView = (View)(object)base.VirtualView;
|
||||
if (virtualView != null)
|
||||
{
|
||||
GestureManager.ProcessTap(virtualView, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
public static void MapHasShadow(FrameHandler handler, Frame frame)
|
||||
{
|
||||
handler.PlatformView.HasShadow = frame.HasShadow;
|
||||
}
|
||||
|
||||
public static void MapBorderColor(FrameHandler handler, Frame frame)
|
||||
{
|
||||
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (frame.BorderColor != null)
|
||||
{
|
||||
((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView.Stroke = new SKColor((byte)(frame.BorderColor.Red * 255f), (byte)(frame.BorderColor.Green * 255f), (byte)(frame.BorderColor.Blue * 255f), (byte)(frame.BorderColor.Alpha * 255f));
|
||||
}
|
||||
}
|
||||
public static void MapBackgroundColor(FrameHandler handler, Frame frame)
|
||||
{
|
||||
if (frame.BackgroundColor != null)
|
||||
{
|
||||
handler.PlatformView.BackgroundColor = new SKColor(
|
||||
(byte)(frame.BackgroundColor.Red * 255),
|
||||
(byte)(frame.BackgroundColor.Green * 255),
|
||||
(byte)(frame.BackgroundColor.Blue * 255),
|
||||
(byte)(frame.BackgroundColor.Alpha * 255));
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapCornerRadius(FrameHandler handler, Frame frame)
|
||||
{
|
||||
((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView.CornerRadius = frame.CornerRadius;
|
||||
}
|
||||
public static void MapPadding(FrameHandler handler, Frame frame)
|
||||
{
|
||||
handler.PlatformView.SetPadding(
|
||||
(float)frame.Padding.Left,
|
||||
(float)frame.Padding.Top,
|
||||
(float)frame.Padding.Right,
|
||||
(float)frame.Padding.Bottom);
|
||||
}
|
||||
|
||||
public static void MapHasShadow(FrameHandler handler, Frame frame)
|
||||
{
|
||||
((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView.HasShadow = frame.HasShadow;
|
||||
}
|
||||
public static void MapContent(FrameHandler handler, Frame frame)
|
||||
{
|
||||
if (handler.PlatformView is null || handler.MauiContext is null) return;
|
||||
|
||||
public static void MapBackgroundColor(FrameHandler handler, Frame frame)
|
||||
{
|
||||
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (((VisualElement)frame).BackgroundColor != null)
|
||||
{
|
||||
((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView.BackgroundColor = new SKColor((byte)(((VisualElement)frame).BackgroundColor.Red * 255f), (byte)(((VisualElement)frame).BackgroundColor.Green * 255f), (byte)(((VisualElement)frame).BackgroundColor.Blue * 255f), (byte)(((VisualElement)frame).BackgroundColor.Alpha * 255f));
|
||||
}
|
||||
}
|
||||
handler.PlatformView.ClearChildren();
|
||||
|
||||
public static void MapPadding(FrameHandler handler, Frame frame)
|
||||
{
|
||||
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
|
||||
SkiaFrame platformView = ((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView;
|
||||
Thickness padding = ((Layout)frame).Padding;
|
||||
float left = (float)((Thickness)(ref padding)).Left;
|
||||
padding = ((Layout)frame).Padding;
|
||||
float top = (float)((Thickness)(ref padding)).Top;
|
||||
padding = ((Layout)frame).Padding;
|
||||
float right = (float)((Thickness)(ref padding)).Right;
|
||||
padding = ((Layout)frame).Padding;
|
||||
platformView.SetPadding(left, top, right, (float)((Thickness)(ref padding)).Bottom);
|
||||
}
|
||||
var content = frame.Content;
|
||||
if (content != null)
|
||||
{
|
||||
// Create handler for content if it doesn't exist
|
||||
if (content.Handler == null)
|
||||
{
|
||||
content.Handler = content.ToHandler(handler.MauiContext);
|
||||
}
|
||||
|
||||
public static void MapContent(FrameHandler handler, Frame frame)
|
||||
{
|
||||
if (((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView == null || ((ElementHandler)handler).MauiContext == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView.ClearChildren();
|
||||
View content = ((ContentView)frame).Content;
|
||||
if (content != null)
|
||||
{
|
||||
if (((VisualElement)content).Handler == null)
|
||||
{
|
||||
((VisualElement)content).Handler = ((IView)(object)content).ToViewHandler(((ElementHandler)handler).MauiContext);
|
||||
}
|
||||
IViewHandler handler2 = ((VisualElement)content).Handler;
|
||||
if (((handler2 != null) ? ((IElementHandler)handler2).PlatformView : null) is SkiaView child)
|
||||
{
|
||||
((ViewHandler<Frame, SkiaFrame>)(object)handler).PlatformView.AddChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (content.Handler?.PlatformView is SkiaView skiaContent)
|
||||
{
|
||||
handler.PlatformView.AddChild(skiaContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user