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,115 +1,100 @@
|
||||
using System;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Graphics;
|
||||
// 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.Handlers;
|
||||
using Microsoft.Maui.Graphics;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Platform;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Handlers;
|
||||
|
||||
public class TimePickerHandler : ViewHandler<ITimePicker, SkiaTimePicker>
|
||||
/// <summary>
|
||||
/// Handler for TimePicker on Linux using Skia rendering.
|
||||
/// </summary>
|
||||
public partial class TimePickerHandler : ViewHandler<ITimePicker, SkiaTimePicker>
|
||||
{
|
||||
public static IPropertyMapper<ITimePicker, TimePickerHandler> Mapper = (IPropertyMapper<ITimePicker, TimePickerHandler>)(object)new PropertyMapper<ITimePicker, TimePickerHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)ViewHandler.ViewMapper })
|
||||
{
|
||||
["Time"] = MapTime,
|
||||
["Format"] = MapFormat,
|
||||
["TextColor"] = MapTextColor,
|
||||
["CharacterSpacing"] = MapCharacterSpacing,
|
||||
["Background"] = MapBackground
|
||||
};
|
||||
public static IPropertyMapper<ITimePicker, TimePickerHandler> Mapper =
|
||||
new PropertyMapper<ITimePicker, TimePickerHandler>(ViewHandler.ViewMapper)
|
||||
{
|
||||
[nameof(ITimePicker.Time)] = MapTime,
|
||||
[nameof(ITimePicker.Format)] = MapFormat,
|
||||
[nameof(ITimePicker.TextColor)] = MapTextColor,
|
||||
[nameof(ITimePicker.CharacterSpacing)] = MapCharacterSpacing,
|
||||
[nameof(IView.Background)] = MapBackground,
|
||||
};
|
||||
|
||||
public static CommandMapper<ITimePicker, TimePickerHandler> CommandMapper = new CommandMapper<ITimePicker, TimePickerHandler>((CommandMapper)(object)ViewHandler.ViewCommandMapper);
|
||||
public static CommandMapper<ITimePicker, TimePickerHandler> CommandMapper =
|
||||
new(ViewHandler.ViewCommandMapper)
|
||||
{
|
||||
};
|
||||
|
||||
public TimePickerHandler()
|
||||
: base((IPropertyMapper)(object)Mapper, (CommandMapper)(object)CommandMapper)
|
||||
{
|
||||
}
|
||||
public TimePickerHandler() : base(Mapper, CommandMapper)
|
||||
{
|
||||
}
|
||||
|
||||
public TimePickerHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
|
||||
: base((IPropertyMapper)(((object)mapper) ?? ((object)Mapper)), (CommandMapper)(((object)commandMapper) ?? ((object)CommandMapper)))
|
||||
{
|
||||
}
|
||||
public TimePickerHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
|
||||
: base(mapper ?? Mapper, commandMapper ?? CommandMapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override SkiaTimePicker CreatePlatformView()
|
||||
{
|
||||
return new SkiaTimePicker();
|
||||
}
|
||||
protected override SkiaTimePicker CreatePlatformView()
|
||||
{
|
||||
return new SkiaTimePicker();
|
||||
}
|
||||
|
||||
protected override void ConnectHandler(SkiaTimePicker platformView)
|
||||
{
|
||||
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_002b: Invalid comparison between Unknown and I4
|
||||
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
|
||||
base.ConnectHandler(platformView);
|
||||
platformView.TimeSelected += OnTimeSelected;
|
||||
Application current = Application.Current;
|
||||
if (current != null && (int)current.UserAppTheme == 2)
|
||||
{
|
||||
platformView.ClockBackgroundColor = new SKColor((byte)30, (byte)30, (byte)30);
|
||||
platformView.ClockFaceColor = new SKColor((byte)45, (byte)45, (byte)45);
|
||||
platformView.TextColor = new SKColor((byte)224, (byte)224, (byte)224);
|
||||
platformView.BorderColor = new SKColor((byte)97, (byte)97, (byte)97);
|
||||
platformView.BackgroundColor = new SKColor((byte)45, (byte)45, (byte)45);
|
||||
}
|
||||
}
|
||||
protected override void ConnectHandler(SkiaTimePicker platformView)
|
||||
{
|
||||
base.ConnectHandler(platformView);
|
||||
platformView.TimeSelected += OnTimeSelected;
|
||||
}
|
||||
|
||||
protected override void DisconnectHandler(SkiaTimePicker platformView)
|
||||
{
|
||||
platformView.TimeSelected -= OnTimeSelected;
|
||||
base.DisconnectHandler(platformView);
|
||||
}
|
||||
protected override void DisconnectHandler(SkiaTimePicker platformView)
|
||||
{
|
||||
platformView.TimeSelected -= OnTimeSelected;
|
||||
base.DisconnectHandler(platformView);
|
||||
}
|
||||
|
||||
private void OnTimeSelected(object? sender, EventArgs e)
|
||||
{
|
||||
if (base.VirtualView != null && base.PlatformView != null)
|
||||
{
|
||||
base.VirtualView.Time = base.PlatformView.Time;
|
||||
}
|
||||
}
|
||||
private void OnTimeSelected(object? sender, EventArgs e)
|
||||
{
|
||||
if (VirtualView is null || PlatformView is null) return;
|
||||
|
||||
public static void MapTime(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
if (((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView != null)
|
||||
{
|
||||
((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView.Time = timePicker.Time;
|
||||
}
|
||||
}
|
||||
VirtualView.Time = PlatformView.Time;
|
||||
}
|
||||
|
||||
public static void MapFormat(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
if (((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView != null)
|
||||
{
|
||||
((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView.Format = timePicker.Format ?? "t";
|
||||
}
|
||||
}
|
||||
public static void MapTime(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
handler.PlatformView.Time = timePicker.Time;
|
||||
}
|
||||
|
||||
public static void MapTextColor(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView != null && ((ITextStyle)timePicker).TextColor != null)
|
||||
{
|
||||
((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView.TextColor = ((ITextStyle)timePicker).TextColor.ToSKColor();
|
||||
}
|
||||
}
|
||||
public static void MapFormat(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
handler.PlatformView.Format = timePicker.Format ?? "t";
|
||||
}
|
||||
|
||||
public static void MapCharacterSpacing(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
}
|
||||
public static void MapTextColor(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
if (timePicker.TextColor is not null)
|
||||
{
|
||||
handler.PlatformView.TextColor = timePicker.TextColor.ToSKColor();
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapBackground(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView != null)
|
||||
{
|
||||
Paint background = ((IView)timePicker).Background;
|
||||
SolidPaint val = (SolidPaint)(object)((background is SolidPaint) ? background : null);
|
||||
if (val != null && val.Color != null)
|
||||
{
|
||||
((ViewHandler<ITimePicker, SkiaTimePicker>)(object)handler).PlatformView.BackgroundColor = val.Color.ToSKColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void MapCharacterSpacing(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
// Character spacing would require custom text rendering
|
||||
}
|
||||
|
||||
public static void MapBackground(TimePickerHandler handler, ITimePicker timePicker)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
|
||||
if (timePicker.Background is SolidPaint solidPaint && solidPaint.Color is not null)
|
||||
{
|
||||
handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user