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:
2026-01-01 07:43:44 -05:00
parent 33914bf572
commit 2a4e35cd39
258 changed files with 35256 additions and 49900 deletions

View File

@@ -1,325 +1,316 @@
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 SkiaSharp;
namespace Microsoft.Maui.Platform;
/// <summary>
/// A view that displays indicators for a collection of items.
/// Used to show page indicators for CarouselView or similar controls.
/// </summary>
public class SkiaIndicatorView : SkiaView
{
private int _count;
private int _count = 0;
private int _position = 0;
private int _position;
/// <summary>
/// Gets or sets the number of indicators to display.
/// </summary>
public int Count
{
get => _count;
set
{
if (_count != value)
{
_count = Math.Max(0, value);
if (_position >= _count)
{
_position = Math.Max(0, _count - 1);
}
InvalidateMeasure();
Invalidate();
}
}
}
public int Count
{
get
{
return _count;
}
set
{
if (_count != value)
{
_count = Math.Max(0, value);
if (_position >= _count)
{
_position = Math.Max(0, _count - 1);
}
InvalidateMeasure();
Invalidate();
}
}
}
/// <summary>
/// Gets or sets the selected position.
/// </summary>
public int Position
{
get => _position;
set
{
int newValue = Math.Clamp(value, 0, Math.Max(0, _count - 1));
if (_position != newValue)
{
_position = newValue;
Invalidate();
}
}
}
public int Position
{
get
{
return _position;
}
set
{
int num = Math.Clamp(value, 0, Math.Max(0, _count - 1));
if (_position != num)
{
_position = num;
Invalidate();
}
}
}
/// <summary>
/// Gets or sets the indicator color.
/// </summary>
public SKColor IndicatorColor { get; set; } = new SKColor(180, 180, 180);
public SKColor IndicatorColor { get; set; } = new SKColor((byte)180, (byte)180, (byte)180);
/// <summary>
/// Gets or sets the selected indicator color.
/// </summary>
public SKColor SelectedIndicatorColor { get; set; } = new SKColor(33, 150, 243);
public SKColor SelectedIndicatorColor { get; set; } = new SKColor((byte)33, (byte)150, (byte)243);
/// <summary>
/// Gets or sets the indicator size.
/// </summary>
public float IndicatorSize { get; set; } = 10f;
public float IndicatorSize { get; set; } = 10f;
/// <summary>
/// Gets or sets the selected indicator size.
/// </summary>
public float SelectedIndicatorSize { get; set; } = 10f;
public float SelectedIndicatorSize { get; set; } = 10f;
/// <summary>
/// Gets or sets the spacing between indicators.
/// </summary>
public float IndicatorSpacing { get; set; } = 8f;
public float IndicatorSpacing { get; set; } = 8f;
/// <summary>
/// Gets or sets the indicator shape.
/// </summary>
public IndicatorShape IndicatorShape { get; set; } = IndicatorShape.Circle;
public IndicatorShape IndicatorShape { get; set; }
/// <summary>
/// Gets or sets whether indicators should have a border.
/// </summary>
public bool ShowBorder { get; set; } = false;
public bool ShowBorder { get; set; }
/// <summary>
/// Gets or sets the border color.
/// </summary>
public SKColor BorderColor { get; set; } = new SKColor(100, 100, 100);
public SKColor BorderColor { get; set; } = new SKColor((byte)100, (byte)100, (byte)100);
/// <summary>
/// Gets or sets the border width.
/// </summary>
public float BorderWidth { get; set; } = 1f;
public float BorderWidth { get; set; } = 1f;
/// <summary>
/// Gets or sets the maximum visible indicators.
/// </summary>
public int MaximumVisible { get; set; } = 10;
public int MaximumVisible { get; set; } = 10;
/// <summary>
/// Gets or sets whether to hide indicators when count is 1 or less.
/// </summary>
public bool HideSingle { get; set; } = true;
public bool HideSingle { get; set; } = true;
protected override SKSize MeasureOverride(SKSize availableSize)
{
if (_count <= 0 || (HideSingle && _count <= 1))
{
return SKSize.Empty;
}
protected override SKSize MeasureOverride(SKSize availableSize)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (_count <= 0 || (HideSingle && _count <= 1))
{
return SKSize.Empty;
}
int num = Math.Min(_count, MaximumVisible);
float num2 = (float)num * IndicatorSize + (float)(num - 1) * IndicatorSpacing;
float num3 = Math.Max(IndicatorSize, SelectedIndicatorSize);
return new SKSize(num2, num3);
}
int visibleCount = Math.Min(_count, MaximumVisible);
float totalWidth = visibleCount * IndicatorSize + (visibleCount - 1) * IndicatorSpacing;
float height = Math.Max(IndicatorSize, SelectedIndicatorSize);
protected override void OnDraw(SKCanvas canvas, SKRect bounds)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Expected O, but got Unknown
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
if (_count <= 0 || (HideSingle && _count <= 1))
{
return;
}
canvas.Save();
canvas.ClipRect(base.Bounds, (SKClipOperation)1, false);
int num = Math.Min(_count, MaximumVisible);
float num2 = (float)num * IndicatorSize + (float)(num - 1) * IndicatorSpacing;
SKRect bounds2 = base.Bounds;
float num3 = ((SKRect)(ref bounds2)).MidX - num2 / 2f + IndicatorSize / 2f;
bounds2 = base.Bounds;
float midY = ((SKRect)(ref bounds2)).MidY;
int num4 = 0;
int num5 = num;
if (_count > MaximumVisible)
{
int num6 = MaximumVisible / 2;
num4 = Math.Max(0, _position - num6);
num5 = Math.Min(_count, num4 + MaximumVisible);
if (num5 == _count)
{
num4 = _count - MaximumVisible;
}
}
SKPaint val = new SKPaint
{
Color = IndicatorColor,
Style = (SKPaintStyle)0,
IsAntialias = true
};
try
{
SKPaint val2 = new SKPaint
{
Color = SelectedIndicatorColor,
Style = (SKPaintStyle)0,
IsAntialias = true
};
try
{
SKPaint val3 = new SKPaint
{
Color = BorderColor,
Style = (SKPaintStyle)1,
StrokeWidth = BorderWidth,
IsAntialias = true
};
try
{
for (int i = num4; i < num5; i++)
{
int num7 = i - num4;
float x = num3 + (float)num7 * (IndicatorSize + IndicatorSpacing);
bool num8 = i == _position;
SKPaint fillPaint = (num8 ? val2 : val);
float size = (num8 ? SelectedIndicatorSize : IndicatorSize);
DrawIndicator(canvas, x, midY, size, fillPaint, val3);
}
canvas.Restore();
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
finally
{
((IDisposable)val2)?.Dispose();
}
}
finally
{
((IDisposable)val)?.Dispose();
}
}
return new SKSize(totalWidth, height);
}
private void DrawIndicator(SKCanvas canvas, float x, float y, float size, SKPaint fillPaint, SKPaint borderPaint)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
float num = size / 2f;
switch (IndicatorShape)
{
case IndicatorShape.Circle:
canvas.DrawCircle(x, y, num, fillPaint);
if (ShowBorder)
{
canvas.DrawCircle(x, y, num, borderPaint);
}
break;
case IndicatorShape.Square:
{
SKRect val3 = default(SKRect);
((SKRect)(ref val3))._002Ector(x - num, y - num, x + num, y + num);
canvas.DrawRect(val3, fillPaint);
if (ShowBorder)
{
canvas.DrawRect(val3, borderPaint);
}
break;
}
case IndicatorShape.RoundedSquare:
{
SKRect val2 = default(SKRect);
((SKRect)(ref val2))._002Ector(x - num, y - num, x + num, y + num);
float num2 = num * 0.3f;
canvas.DrawRoundRect(val2, num2, num2, fillPaint);
if (ShowBorder)
{
canvas.DrawRoundRect(val2, num2, num2, borderPaint);
}
break;
}
case IndicatorShape.Diamond:
{
SKPath val = new SKPath();
try
{
val.MoveTo(x, y - num);
val.LineTo(x + num, y);
val.LineTo(x, y + num);
val.LineTo(x - num, y);
val.Close();
canvas.DrawPath(val, fillPaint);
if (ShowBorder)
{
canvas.DrawPath(val, borderPaint);
}
break;
}
finally
{
((IDisposable)val)?.Dispose();
}
}
}
}
protected override void OnDraw(SKCanvas canvas, SKRect bounds)
{
if (_count <= 0 || (HideSingle && _count <= 1)) return;
public override SkiaView? HitTest(float x, float y)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if (base.IsVisible)
{
SKRect bounds = base.Bounds;
if (((SKRect)(ref bounds)).Contains(x, y))
{
if (_count > 0)
{
int num = Math.Min(_count, MaximumVisible);
float num2 = (float)num * IndicatorSize + (float)(num - 1) * IndicatorSpacing;
bounds = base.Bounds;
float num3 = ((SKRect)(ref bounds)).MidX - num2 / 2f;
if (_count > MaximumVisible)
{
int num4 = MaximumVisible / 2;
if (Math.Max(0, _position - num4) + MaximumVisible > _count)
{
_ = _count;
_ = MaximumVisible;
}
}
for (int i = 0; i < num; i++)
{
float num5 = num3 + (float)i * (IndicatorSize + IndicatorSpacing);
if (x >= num5 && x <= num5 + IndicatorSize)
{
return this;
}
}
}
return null;
}
}
return null;
}
canvas.Save();
canvas.ClipRect(Bounds);
public override void OnPointerPressed(PointerEventArgs e)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if (!base.IsEnabled || _count <= 0)
{
return;
}
int num = Math.Min(_count, MaximumVisible);
float num2 = (float)num * IndicatorSize + (float)(num - 1) * IndicatorSpacing;
SKRect bounds = base.Bounds;
float num3 = ((SKRect)(ref bounds)).MidX - num2 / 2f;
int num4 = 0;
if (_count > MaximumVisible)
{
int num5 = MaximumVisible / 2;
num4 = Math.Max(0, _position - num5);
if (num4 + MaximumVisible > _count)
{
num4 = _count - MaximumVisible;
}
}
int num6 = (int)((e.X - num3) / (IndicatorSize + IndicatorSpacing));
if (num6 >= 0 && num6 < num)
{
Position = num4 + num6;
e.Handled = true;
}
base.OnPointerPressed(e);
}
int visibleCount = Math.Min(_count, MaximumVisible);
float totalWidth = visibleCount * IndicatorSize + (visibleCount - 1) * IndicatorSpacing;
float startX = Bounds.MidX - totalWidth / 2 + IndicatorSize / 2;
float centerY = Bounds.MidY;
// Determine visible range if count > MaximumVisible
int startIndex = 0;
int endIndex = visibleCount;
if (_count > MaximumVisible)
{
int halfVisible = MaximumVisible / 2;
startIndex = Math.Max(0, _position - halfVisible);
endIndex = Math.Min(_count, startIndex + MaximumVisible);
if (endIndex == _count)
{
startIndex = _count - MaximumVisible;
}
}
using var normalPaint = new SKPaint
{
Color = IndicatorColor,
Style = SKPaintStyle.Fill,
IsAntialias = true
};
using var selectedPaint = new SKPaint
{
Color = SelectedIndicatorColor,
Style = SKPaintStyle.Fill,
IsAntialias = true
};
using var borderPaint = new SKPaint
{
Color = BorderColor,
Style = SKPaintStyle.Stroke,
StrokeWidth = BorderWidth,
IsAntialias = true
};
for (int i = startIndex; i < endIndex; i++)
{
int visualIndex = i - startIndex;
float x = startX + visualIndex * (IndicatorSize + IndicatorSpacing);
bool isSelected = i == _position;
var paint = isSelected ? selectedPaint : normalPaint;
float size = isSelected ? SelectedIndicatorSize : IndicatorSize;
DrawIndicator(canvas, x, centerY, size, paint, borderPaint);
}
canvas.Restore();
}
private void DrawIndicator(SKCanvas canvas, float x, float y, float size, SKPaint fillPaint, SKPaint borderPaint)
{
float radius = size / 2;
switch (IndicatorShape)
{
case IndicatorShape.Circle:
canvas.DrawCircle(x, y, radius, fillPaint);
if (ShowBorder)
{
canvas.DrawCircle(x, y, radius, borderPaint);
}
break;
case IndicatorShape.Square:
var rect = new SKRect(x - radius, y - radius, x + radius, y + radius);
canvas.DrawRect(rect, fillPaint);
if (ShowBorder)
{
canvas.DrawRect(rect, borderPaint);
}
break;
case IndicatorShape.RoundedSquare:
var roundRect = new SKRect(x - radius, y - radius, x + radius, y + radius);
float cornerRadius = radius * 0.3f;
canvas.DrawRoundRect(roundRect, cornerRadius, cornerRadius, fillPaint);
if (ShowBorder)
{
canvas.DrawRoundRect(roundRect, cornerRadius, cornerRadius, borderPaint);
}
break;
case IndicatorShape.Diamond:
using (var path = new SKPath())
{
path.MoveTo(x, y - radius);
path.LineTo(x + radius, y);
path.LineTo(x, y + radius);
path.LineTo(x - radius, y);
path.Close();
canvas.DrawPath(path, fillPaint);
if (ShowBorder)
{
canvas.DrawPath(path, borderPaint);
}
}
break;
}
}
public override SkiaView? HitTest(float x, float y)
{
if (!IsVisible || !Bounds.Contains(x, y)) return null;
// Check if click is on an indicator
if (_count > 0)
{
int visibleCount = Math.Min(_count, MaximumVisible);
float totalWidth = visibleCount * IndicatorSize + (visibleCount - 1) * IndicatorSpacing;
float startX = Bounds.MidX - totalWidth / 2;
int startIndex = 0;
if (_count > MaximumVisible)
{
int halfVisible = MaximumVisible / 2;
startIndex = Math.Max(0, _position - halfVisible);
if (startIndex + MaximumVisible > _count)
{
startIndex = _count - MaximumVisible;
}
}
for (int i = 0; i < visibleCount; i++)
{
float indicatorX = startX + i * (IndicatorSize + IndicatorSpacing);
if (x >= indicatorX && x <= indicatorX + IndicatorSize)
{
return this;
}
}
}
return null;
}
public override void OnPointerPressed(PointerEventArgs e)
{
if (!IsEnabled || _count <= 0) return;
// Calculate which indicator was clicked
int visibleCount = Math.Min(_count, MaximumVisible);
float totalWidth = visibleCount * IndicatorSize + (visibleCount - 1) * IndicatorSpacing;
float startX = Bounds.MidX - totalWidth / 2;
int startIndex = 0;
if (_count > MaximumVisible)
{
int halfVisible = MaximumVisible / 2;
startIndex = Math.Max(0, _position - halfVisible);
if (startIndex + MaximumVisible > _count)
{
startIndex = _count - MaximumVisible;
}
}
float relativeX = e.X - startX;
int visualIndex = (int)(relativeX / (IndicatorSize + IndicatorSpacing));
if (visualIndex >= 0 && visualIndex < visibleCount)
{
Position = startIndex + visualIndex;
e.Handled = true;
}
base.OnPointerPressed(e);
}
}
/// <summary>
/// Shape of indicator dots.
/// </summary>
public enum IndicatorShape
{
Circle,
Square,
RoundedSquare,
Diamond
}