Merge pull request #134 from dotnet/align-naming

Align naming with MAUI Core
This commit is contained in:
Javier Suárez 2023-06-02 19:01:21 +02:00 коммит произвёл GitHub
Родитель bd4e6a6fa5 62a97aad99
Коммит dc73de97df
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
40 изменённых файлов: 210 добавлений и 210 удалений

Просмотреть файл

@ -1,8 +1,8 @@
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public interface IMixedNativeView : IInvalidatable public interface IMixedPlatformView : IInvalidatable
{ {
string[] NativeLayers { get; } string[] PlatformLayers { get; }
IDrawable Drawable { get; set; } IDrawable Drawable { get; set; }
IMixedGraphicsHandler? GraphicsControl { get; set; } IMixedGraphicsHandler? GraphicsControl { get; set; }

Просмотреть файл

@ -7,18 +7,18 @@
return new GraphicsDatePicker(Context!) { GraphicsControl = this }; return new GraphicsDatePicker(Context!) { GraphicsControl = this };
} }
protected override void ConnectHandler(GraphicsDatePicker nativeView) protected override void ConnectHandler(GraphicsDatePicker platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.DateSelected += OnDateSelected; platformView.DateSelected += OnDateSelected;
} }
protected override void DisconnectHandler(GraphicsDatePicker nativeView) protected override void DisconnectHandler(GraphicsDatePicker platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.DateSelected -= OnDateSelected; platformView.DateSelected -= OnDateSelected;
} }
public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker) public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker)

Просмотреть файл

@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
public partial class DatePickerHandler : MixedGraphicsControlHandler<IDatePickerDrawable, IDatePicker, object> public partial class DatePickerHandler : MixedGraphicsControlHandler<IDatePickerDrawable, IDatePicker, object>
{ {
protected override object CreateNativeView() => throw new NotImplementedException(); protected override object CreatePlatformView() => throw new NotImplementedException();
public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker) { } public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker) { }
public static void MapMaximumDate(DatePickerHandler handler, IDatePicker datePicker) { } public static void MapMaximumDate(DatePickerHandler handler, IDatePicker datePicker) { }

Просмотреть файл

@ -7,18 +7,18 @@
return new GraphicsDatePicker() { GraphicsControl = this }; return new GraphicsDatePicker() { GraphicsControl = this };
} }
protected override void ConnectHandler(GraphicsDatePicker nativeView) protected override void ConnectHandler(GraphicsDatePicker platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.DateSelected += OnDateSelected; platformView.DateSelected += OnDateSelected;
} }
protected override void DisconnectHandler(GraphicsDatePicker nativeView) protected override void DisconnectHandler(GraphicsDatePicker platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.DateSelected -= OnDateSelected; platformView.DateSelected -= OnDateSelected;
} }
public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker) public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker)

Просмотреть файл

@ -7,18 +7,18 @@
return new GraphicsDatePicker() { GraphicsControl = this }; return new GraphicsDatePicker() { GraphicsControl = this };
} }
protected override void ConnectHandler(GraphicsDatePicker nativeView) protected override void ConnectHandler(GraphicsDatePicker platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.DateSelected += OnDateSelected; platformView.DateSelected += OnDateSelected;
} }
protected override void DisconnectHandler(GraphicsDatePicker nativeView) protected override void DisconnectHandler(GraphicsDatePicker platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.DateSelected -= OnDateSelected; platformView.DateSelected -= OnDateSelected;
} }
public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker) public static void MapMinimumDate(DatePickerHandler handler, IDatePicker datePicker)

Просмотреть файл

@ -8,7 +8,7 @@ using Microsoft.Maui.Graphics.Platform;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public partial class GraphicsDatePicker : View, IMixedNativeView public partial class GraphicsDatePicker : View, IMixedPlatformView
{ {
DateTime _date; DateTime _date;
DateTime _minimumDate; DateTime _minimumDate;
@ -92,9 +92,9 @@ namespace Microsoft.Maui.Graphics.Controls
public event EventHandler<DateSelectedEventArgs> DateSelected; public event EventHandler<DateSelectedEventArgs> DateSelected;
static readonly string[] DefaultNativeLayers = new string[] { }; static readonly string[] DefaultPlatformLayers = new string[] { };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -9,7 +9,7 @@ using WSize = Windows.Foundation.Size;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsDatePicker : UserControl, IMixedNativeView public class GraphicsDatePicker : UserControl, IMixedPlatformView
{ {
DateTime _date; DateTime _date;
DateTime _minimumDate; DateTime _minimumDate;
@ -78,9 +78,9 @@ namespace Microsoft.Maui.Graphics.Controls
public event EventHandler<DateSelectedEventArgs> DateSelected; public event EventHandler<DateSelectedEventArgs> DateSelected;
static readonly string[] DefaultNativeLayers = new string[] { }; static readonly string[] DefaultPlatformLayers = new string[] { };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -9,7 +9,7 @@ using UIKit;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsDatePicker : UIView, IMixedNativeView public class GraphicsDatePicker : UIView, IMixedPlatformView
{ {
DateTime _date; DateTime _date;
DateTime _minimumDate; DateTime _minimumDate;
@ -104,9 +104,9 @@ namespace Microsoft.Maui.Graphics.Controls
} }
} }
static readonly string[] DefaultNativeLayers = new string[] { }; static readonly string[] DefaultPlatformLayers = new string[] { };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void Invalidate() public void Invalidate()
{ {

Просмотреть файл

@ -14,45 +14,45 @@ namespace Microsoft.Maui.Graphics.Controls
protected override GraphicsEditor CreatePlatformView() protected override GraphicsEditor CreatePlatformView()
{ {
var nativeView = new GraphicsEditor(Context!) var platformView = new GraphicsEditor(Context!)
{ {
GraphicsControl = this, GraphicsControl = this,
ImeOptions = ImeAction.Done ImeOptions = ImeAction.Done
}; };
nativeView.SetSingleLine(false); platformView.SetSingleLine(false);
nativeView.Gravity = GravityFlags.Top; platformView.Gravity = GravityFlags.Top;
nativeView.TextAlignment = ATextAlignment.ViewStart; platformView.TextAlignment = ATextAlignment.ViewStart;
nativeView.SetHorizontallyScrolling(false); platformView.SetHorizontallyScrolling(false);
var density = nativeView.Resources?.DisplayMetrics?.Density ?? 1.0f; var density = platformView.Resources?.DisplayMetrics?.Density ?? 1.0f;
if (Drawable is MaterialEditorDrawable) if (Drawable is MaterialEditorDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 24), 0, 0); platformView.SetPadding((int)(density * 12), (int)(density * 24), 0, 0);
else if (Drawable is FluentEditorDrawable) else if (Drawable is FluentEditorDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0); platformView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);
else if (Drawable is CupertinoEditorDrawable) else if (Drawable is CupertinoEditorDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0); platformView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);
return nativeView; return platformView;
} }
protected override void ConnectHandler(GraphicsEditor nativeView) protected override void ConnectHandler(GraphicsEditor platformView)
{ {
FocusChangeListener.Handler = this; FocusChangeListener.Handler = this;
nativeView.OnFocusChangeListener = FocusChangeListener; platformView.OnFocusChangeListener = FocusChangeListener;
nativeView.TextChanged += OnTextChanged; platformView.TextChanged += OnTextChanged;
} }
protected override void DisconnectHandler(GraphicsEditor nativeView) protected override void DisconnectHandler(GraphicsEditor platformView)
{ {
nativeView.OnFocusChangeListener = null; platformView.OnFocusChangeListener = null;
FocusChangeListener.Handler = null; FocusChangeListener.Handler = null;
nativeView.TextChanged -= OnTextChanged; platformView.TextChanged -= OnTextChanged;
} }
public static void MapText(EditorHandler handler, IEditor editor) public static void MapText(EditorHandler handler, IEditor editor)

Просмотреть файл

@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
public partial class EditorHandler : MixedGraphicsControlHandler<IEditorDrawable, IEditor, object> public partial class EditorHandler : MixedGraphicsControlHandler<IEditorDrawable, IEditor, object>
{ {
protected override object CreateNativeView() => throw new NotImplementedException(); protected override object CreatePlatformView() => throw new NotImplementedException();
public static void MapText(IViewHandler handler, IEditor editor) { } public static void MapText(IViewHandler handler, IEditor editor) { }
public static void MapTextColor(IViewHandler handler, IEditor editor) { } public static void MapTextColor(IViewHandler handler, IEditor editor) { }

Просмотреть файл

@ -22,20 +22,20 @@ namespace Microsoft.Maui.Graphics.Controls
return new GraphicsEditor { GraphicsControl = this, EdgeInsets = edgeInsets }; return new GraphicsEditor { GraphicsControl = this, EdgeInsets = edgeInsets };
} }
protected override void ConnectHandler(GraphicsEditor nativeView) protected override void ConnectHandler(GraphicsEditor platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.Started += OnStarted; platformView.Started += OnStarted;
nativeView.Ended += OnEnded; platformView.Ended += OnEnded;
} }
protected override void DisconnectHandler(GraphicsEditor nativeView) protected override void DisconnectHandler(GraphicsEditor platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.Started -= OnStarted; platformView.Started -= OnStarted;
nativeView.Ended -= OnEnded; platformView.Ended -= OnEnded;
} }
public static void MapText(EditorHandler handler, IEditor editor) public static void MapText(EditorHandler handler, IEditor editor)

Просмотреть файл

@ -7,7 +7,7 @@ using Microsoft.Maui.Graphics.Platform;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsEditor : AppCompatEditText, IMixedNativeView public class GraphicsEditor : AppCompatEditText, IMixedPlatformView
{ {
readonly PlatformCanvas _canvas; readonly PlatformCanvas _canvas;
readonly ScalingCanvas _scalingCanvas; readonly ScalingCanvas _scalingCanvas;
@ -54,9 +54,9 @@ namespace Microsoft.Maui.Graphics.Controls
} }
} }
static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) }; static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -7,7 +7,7 @@ using WSize = Windows.Foundation.Size;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsEditor : UserControl, IMixedNativeView public class GraphicsEditor : UserControl, IMixedPlatformView
{ {
CanvasControl _canvasControl; CanvasControl _canvasControl;
readonly W2DCanvas _canvas = new W2DCanvas(); readonly W2DCanvas _canvas = new W2DCanvas();
@ -37,9 +37,9 @@ namespace Microsoft.Maui.Graphics.Controls
} }
} }
static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) }; static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -7,7 +7,7 @@ using UIKit;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsEditor : UITextView, IMixedNativeView public class GraphicsEditor : UITextView, IMixedPlatformView
{ {
readonly PlatformCanvas _canvas; readonly PlatformCanvas _canvas;
readonly UITapGestureRecognizer _tapGesture; readonly UITapGestureRecognizer _tapGesture;
@ -62,9 +62,9 @@ namespace Microsoft.Maui.Graphics.Controls
} }
} }
static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) }; static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void Invalidate() public void Invalidate()
{ {

Просмотреть файл

@ -18,47 +18,47 @@ namespace Microsoft.Maui.Graphics.Controls
protected override GraphicsEntry CreatePlatformView() protected override GraphicsEntry CreatePlatformView()
{ {
var nativeView = new GraphicsEntry(Context!) var platformView = new GraphicsEntry(Context!)
{ {
GraphicsControl = this GraphicsControl = this
}; };
var density = nativeView.Resources?.DisplayMetrics?.Density ?? 1.0f; var density = platformView.Resources?.DisplayMetrics?.Density ?? 1.0f;
if (Drawable is MaterialEntryDrawable) if (Drawable is MaterialEntryDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 24), 0, 0); platformView.SetPadding((int)(density * 12), (int)(density * 24), 0, 0);
else if (Drawable is FluentEntryDrawable) else if (Drawable is FluentEntryDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0); platformView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);
else if (Drawable is CupertinoEntryDrawable) else if (Drawable is CupertinoEntryDrawable)
nativeView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0); platformView.SetPadding((int)(density * 12), (int)(density * 12), 0, 0);
return nativeView; return platformView;
} }
protected override void ConnectHandler(GraphicsEntry nativeView) protected override void ConnectHandler(GraphicsEntry platformView)
{ {
Watcher.Handler = this; Watcher.Handler = this;
ActionListener.Handler = this; ActionListener.Handler = this;
FocusChangeListener.Handler = this; FocusChangeListener.Handler = this;
nativeView.AddTextChangedListener(Watcher); platformView.AddTextChangedListener(Watcher);
nativeView.SetOnEditorActionListener(ActionListener); platformView.SetOnEditorActionListener(ActionListener);
nativeView.OnFocusChangeListener = FocusChangeListener; platformView.OnFocusChangeListener = FocusChangeListener;
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
} }
protected override void DisconnectHandler(GraphicsEntry nativeView) protected override void DisconnectHandler(GraphicsEntry platformView)
{ {
nativeView.RemoveTextChangedListener(Watcher); platformView.RemoveTextChangedListener(Watcher);
nativeView.SetOnEditorActionListener(null); platformView.SetOnEditorActionListener(null);
nativeView.OnFocusChangeListener = null; platformView.OnFocusChangeListener = null;
Watcher.Handler = null; Watcher.Handler = null;
ActionListener.Handler = null; ActionListener.Handler = null;
FocusChangeListener.Handler = null; FocusChangeListener.Handler = null;
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
} }
public override bool StartInteraction(PointF[] points) public override bool StartInteraction(PointF[] points)
@ -88,7 +88,7 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
// TODO: Get require service FontManager // TODO: Get require service FontManager
//IFontManager? fontManager = null; //IFontManager? fontManager = null;
//handler.NativeView?.UpdateFont(editor, fontManager); //handler.PlatformView?.UpdateFont(editor, fontManager);
} }
public static void MapHorizontalTextAlignment(EntryHandler handler, IEntry entry) public static void MapHorizontalTextAlignment(EntryHandler handler, IEntry entry)

Просмотреть файл

@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
public partial class EntryHandler : MixedGraphicsControlHandler<IEntryDrawable, IEntry, object> public partial class EntryHandler : MixedGraphicsControlHandler<IEntryDrawable, IEntry, object>
{ {
protected override object CreateNativeView() => throw new NotImplementedException(); protected override object CreatePlatformView() => throw new NotImplementedException();
public static void MapText(IViewHandler handler, IEntry entry) { } public static void MapText(IViewHandler handler, IEntry entry) { }
public static void MapCharacterSpacing(IViewHandler handler, IEntry entry) { } public static void MapCharacterSpacing(IViewHandler handler, IEntry entry) { }

Просмотреть файл

@ -20,30 +20,30 @@ namespace Microsoft.Maui.Graphics.Controls
else else
edgeInsets = new UIEdgeInsets(); edgeInsets = new UIEdgeInsets();
var nativeView = new GraphicsEntry { GraphicsControl = this, EdgeInsets = edgeInsets }; var platformView = new GraphicsEntry { GraphicsControl = this, EdgeInsets = edgeInsets };
return nativeView; return platformView;
} }
protected override void ConnectHandler(GraphicsEntry nativeView) protected override void ConnectHandler(GraphicsEntry platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.Started += OnStarted; platformView.Started += OnStarted;
nativeView.EditingChanged += OnEditingChanged; platformView.EditingChanged += OnEditingChanged;
nativeView.EditingDidEnd += OnEditingEnded; platformView.EditingDidEnd += OnEditingEnded;
nativeView.ShouldChangeCharacters += OnShouldChangeCharacters; platformView.ShouldChangeCharacters += OnShouldChangeCharacters;
} }
protected override void DisconnectHandler(GraphicsEntry nativeView) protected override void DisconnectHandler(GraphicsEntry platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.Started -= OnStarted; platformView.Started -= OnStarted;
nativeView.EditingChanged -= OnEditingChanged; platformView.EditingChanged -= OnEditingChanged;
nativeView.EditingDidEnd -= OnEditingEnded; platformView.EditingDidEnd -= OnEditingEnded;
nativeView.ShouldChangeCharacters -= OnShouldChangeCharacters; platformView.ShouldChangeCharacters -= OnShouldChangeCharacters;
} }
public override bool StartInteraction(PointF[] points) public override bool StartInteraction(PointF[] points)

Просмотреть файл

@ -7,7 +7,7 @@ using Microsoft.Maui.Graphics.Platform;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsEntry : AppCompatEditText, IMixedNativeView public class GraphicsEntry : AppCompatEditText, IMixedPlatformView
{ {
IMixedGraphicsHandler _graphicsControl; IMixedGraphicsHandler _graphicsControl;
readonly PlatformCanvas _canvas; readonly PlatformCanvas _canvas;
@ -54,9 +54,9 @@ namespace Microsoft.Maui.Graphics.Controls
} }
} }
static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) }; static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -9,7 +9,7 @@ using WSize = Windows.Foundation.Size;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsEntry : UserControl, IMixedNativeView public class GraphicsEntry : UserControl, IMixedPlatformView
{ {
CanvasControl _canvasControl; CanvasControl _canvasControl;
readonly W2DCanvas _canvas = new W2DCanvas(); readonly W2DCanvas _canvas = new W2DCanvas();
@ -40,9 +40,9 @@ namespace Microsoft.Maui.Graphics.Controls
} }
} }
static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) }; static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -7,7 +7,7 @@ using UIKit;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsEntry : UITextField, IMixedNativeView public class GraphicsEntry : UITextField, IMixedPlatformView
{ {
readonly PlatformCanvas _canvas; readonly PlatformCanvas _canvas;
readonly UITapGestureRecognizer _tapGesture; readonly UITapGestureRecognizer _tapGesture;
@ -53,9 +53,9 @@ namespace Microsoft.Maui.Graphics.Controls
public UIEdgeInsets EdgeInsets { get; set; } public UIEdgeInsets EdgeInsets { get; set; }
static readonly string[] DefaultNativeLayers = new[] { nameof(IEntry.Text) }; static readonly string[] DefaultPlatformLayers = new[] { nameof(IEntry.Text) };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void Invalidate() public void Invalidate()
{ {

Просмотреть файл

@ -5,7 +5,7 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
public partial class GraphicsControlHandler<TViewDrawable, TVirtualView> : ViewHandler<TVirtualView, object> public partial class GraphicsControlHandler<TViewDrawable, TVirtualView> : ViewHandler<TVirtualView, object>
{ {
protected override object CreateNativeView() => throw new NotImplementedException(); protected override object CreatePlatformView() => throw new NotImplementedException();
public void Invalidate() => throw new NotImplementedException(); public void Invalidate() => throw new NotImplementedException();
} }
} }

Просмотреть файл

@ -17,22 +17,22 @@ namespace Microsoft.Maui.Graphics.Controls
return nativeGraphicsView; return nativeGraphicsView;
} }
protected override void ConnectHandler(PlatformGraphicsView nativeView) protected override void ConnectHandler(PlatformGraphicsView platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.ViewAttachedToWindow += OnViewAttachedToWindow; platformView.ViewAttachedToWindow += OnViewAttachedToWindow;
nativeView.ViewDetachedFromWindow += OnViewDetachedFromWindow; platformView.ViewDetachedFromWindow += OnViewDetachedFromWindow;
nativeView.Touch += OnTouch; platformView.Touch += OnTouch;
} }
protected override void DisconnectHandler(PlatformGraphicsView nativeView) protected override void DisconnectHandler(PlatformGraphicsView platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.ViewAttachedToWindow -= OnViewAttachedToWindow; platformView.ViewAttachedToWindow -= OnViewAttachedToWindow;
nativeView.ViewDetachedFromWindow -= OnViewDetachedFromWindow; platformView.ViewDetachedFromWindow -= OnViewDetachedFromWindow;
nativeView.Touch -= OnTouch; platformView.Touch -= OnTouch;
} }
public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? arg) public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? arg)

Просмотреть файл

@ -4,6 +4,6 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
public partial class GraphicsViewHandler : ViewHandler<IGraphicsView, object> public partial class GraphicsViewHandler : ViewHandler<IGraphicsView, object>
{ {
protected override object CreateNativeView() => throw new NotImplementedException(); protected override object CreatePlatformView() => throw new NotImplementedException();
} }
} }

Просмотреть файл

@ -13,24 +13,24 @@ namespace Microsoft.Maui.Graphics.Controls
Drawable = VirtualView Drawable = VirtualView
}; };
protected override void ConnectHandler(W2DGraphicsView nativeView) protected override void ConnectHandler(W2DGraphicsView platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.PointerPressed += OnPointerPressed; platformView.PointerPressed += OnPointerPressed;
nativeView.PointerMoved += OnPointerMoved; platformView.PointerMoved += OnPointerMoved;
nativeView.PointerReleased += OnPointerReleased; platformView.PointerReleased += OnPointerReleased;
nativeView.PointerCanceled += OnPointerCanceled; platformView.PointerCanceled += OnPointerCanceled;
} }
protected override void DisconnectHandler(W2DGraphicsView nativeView) protected override void DisconnectHandler(W2DGraphicsView platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.PointerPressed -= OnPointerPressed; platformView.PointerPressed -= OnPointerPressed;
nativeView.PointerMoved -= OnPointerMoved; platformView.PointerMoved -= OnPointerMoved;
nativeView.PointerReleased -= OnPointerReleased; platformView.PointerReleased -= OnPointerReleased;
nativeView.PointerCanceled -= OnPointerCanceled; platformView.PointerCanceled -= OnPointerCanceled;
} }
public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? arg) public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? arg)

Просмотреть файл

@ -85,28 +85,28 @@ namespace Microsoft.Maui.Graphics.Controls
return nativeGraphicsView; return nativeGraphicsView;
} }
protected override void ConnectHandler(TouchNativeGraphicsView nativeView) protected override void ConnectHandler(TouchNativeGraphicsView platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
var key = nativeView.Superview == null ? "subviews" : "superview"; var key = platformView.Superview == null ? "subviews" : "superview";
_isLoadedObserverDisposable = nativeView.AddObserver(key, observingOptions, OnViewLoadedObserver); _isLoadedObserverDisposable = platformView.AddObserver(key, observingOptions, OnViewLoadedObserver);
nativeView.TouchDown += OnTouchDown; platformView.TouchDown += OnTouchDown;
nativeView.TouchMove += OnTouchMove; platformView.TouchMove += OnTouchMove;
nativeView.TouchUp += OnTouchUp; platformView.TouchUp += OnTouchUp;
} }
protected override void DisconnectHandler(TouchNativeGraphicsView nativeView) protected override void DisconnectHandler(TouchNativeGraphicsView platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
_isLoadedObserverDisposable?.Dispose(); _isLoadedObserverDisposable?.Dispose();
_isLoadedObserverDisposable = null; _isLoadedObserverDisposable = null;
nativeView.TouchDown -= OnTouchDown; platformView.TouchDown -= OnTouchDown;
nativeView.TouchMove -= OnTouchMove; platformView.TouchMove -= OnTouchMove;
nativeView.TouchUp -= OnTouchUp; platformView.TouchUp -= OnTouchUp;
} }
public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? arg) public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? arg)

Просмотреть файл

@ -14,16 +14,16 @@ using PlatformView = System.Object;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public abstract partial class MixedGraphicsControlHandler<TViewDrawable, TVirtualView, TNativeView> : ViewHandler<TVirtualView, TNativeView>, IViewHandler, IMixedGraphicsHandler public abstract partial class MixedGraphicsControlHandler<TViewDrawable, TVirtualView, TPlatformView> : ViewHandler<TVirtualView, TPlatformView>, IViewHandler, IMixedGraphicsHandler
where TVirtualView : class, IView where TVirtualView : class, IView
where TViewDrawable : class, IViewDrawable where TViewDrawable : class, IViewDrawable
#if !NETSTANDARD || IOS || ANDROID || WINDOWS #if !NETSTANDARD || IOS || ANDROID || WINDOWS
where TNativeView : PlatformView, IMixedNativeView where TPlatformView : PlatformView, IMixedPlatformView
#else #else
where TNativeView : class where TPlatformView : class
#endif #endif
{ {
TViewDrawable? _drawable; TViewDrawable? _drawable;
protected readonly DrawMapper _drawMapper; protected readonly DrawMapper _drawMapper;
ControlState _currentState = ControlState.Default; ControlState _currentState = ControlState.Default;
@ -131,7 +131,7 @@ namespace Microsoft.Maui.Graphics.Controls
base.SetVirtualView(view); base.SetVirtualView(view);
Drawable.View = VirtualView!; Drawable.View = VirtualView!;
if (PlatformView is IMixedNativeView mnv) if (PlatformView is IMixedPlatformView mnv)
mnv.Drawable = this; mnv.Drawable = this;
Invalidate(); Invalidate();
@ -147,20 +147,20 @@ namespace Microsoft.Maui.Graphics.Controls
var layers = LayerDrawingOrder(); var layers = LayerDrawingOrder();
var rect = dirtyRect; var rect = dirtyRect;
bool hasDrawnBase = false; bool hasDrawnBase = false;
var mixedNativeView = PlatformView as IMixedNativeView; var mixedPlatformView = PlatformView as IMixedPlatformView;
var nativeLayers = mixedNativeView?.NativeLayers; var platformLayers = mixedPlatformView?.PlatformLayers;
foreach (var layer in layers) foreach (var layer in layers)
{ {
//This will allow the native layer to handle the layers it can, //This will allow the native layer to handle the layers it can,
//i.e: For Entry, the Text layer and Caret is handled by the base drawing. //i.e: For Entry, the Text layer and Caret is handled by the base drawing.
if (nativeLayers != null && nativeLayers.Contains(layer)) if (platformLayers != null && platformLayers.Contains(layer))
{ {
if (hasDrawnBase) if (hasDrawnBase)
continue; continue;
hasDrawnBase = true; hasDrawnBase = true;
mixedNativeView?.DrawBaseLayer(dirtyRect); mixedPlatformView?.DrawBaseLayer(dirtyRect);
} }
else else
_drawMapper?.DrawLayer(canvas, rect, Drawable, VirtualView, layer); _drawMapper?.DrawLayer(canvas, rect, Drawable, VirtualView, layer);

Просмотреть файл

@ -9,7 +9,7 @@ using Microsoft.Maui.Graphics.Platform;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsTimePicker : View, IMixedNativeView public class GraphicsTimePicker : View, IMixedPlatformView
{ {
TimeSpan _time; TimeSpan _time;
@ -71,9 +71,9 @@ namespace Microsoft.Maui.Graphics.Controls
public event EventHandler<TimeSelectedEventArgs> TimeSelected; public event EventHandler<TimeSelectedEventArgs> TimeSelected;
static readonly string[] DefaultNativeLayers = new string[] { }; static readonly string[] DefaultPlatformLayers = new string[] { };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -9,7 +9,7 @@ using WSize = Windows.Foundation.Size;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsTimePicker : UserControl, IMixedNativeView public class GraphicsTimePicker : UserControl, IMixedPlatformView
{ {
TimeSpan _time; TimeSpan _time;
@ -56,9 +56,9 @@ namespace Microsoft.Maui.Graphics.Controls
public event EventHandler<TimeSelectedEventArgs> TimeSelected; public event EventHandler<TimeSelectedEventArgs> TimeSelected;
static readonly string[] DefaultNativeLayers = new string[] { }; static readonly string[] DefaultPlatformLayers = new string[] { };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void DrawBaseLayer(RectF dirtyRect) { } public void DrawBaseLayer(RectF dirtyRect) { }

Просмотреть файл

@ -9,7 +9,7 @@ using UIKit;
namespace Microsoft.Maui.Graphics.Controls namespace Microsoft.Maui.Graphics.Controls
{ {
public class GraphicsTimePicker : UIView, IMixedNativeView public class GraphicsTimePicker : UIView, IMixedPlatformView
{ {
TimeSpan _time; TimeSpan _time;
@ -82,9 +82,9 @@ namespace Microsoft.Maui.Graphics.Controls
} }
} }
static readonly string[] DefaultNativeLayers = new string[] { }; static readonly string[] DefaultPlatformLayers = new string[] { };
public string[] NativeLayers => DefaultNativeLayers; public string[] PlatformLayers => DefaultPlatformLayers;
public void Invalidate() public void Invalidate()
{ {

Просмотреть файл

@ -7,18 +7,18 @@
return new GraphicsTimePicker(Context!) { GraphicsControl = this }; return new GraphicsTimePicker(Context!) { GraphicsControl = this };
} }
protected override void ConnectHandler(GraphicsTimePicker nativeView) protected override void ConnectHandler(GraphicsTimePicker platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.TimeSelected += OnTimeSelected; platformView.TimeSelected += OnTimeSelected;
} }
protected override void DisconnectHandler(GraphicsTimePicker nativeView) protected override void DisconnectHandler(GraphicsTimePicker platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.TimeSelected -= OnTimeSelected; platformView.TimeSelected -= OnTimeSelected;
} }
public static void MapTime(TimePickerHandler handler, ITimePicker timePicker) public static void MapTime(TimePickerHandler handler, ITimePicker timePicker)

Просмотреть файл

@ -4,7 +4,7 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
public partial class TimePickerHandler : MixedGraphicsControlHandler<ITimePickerDrawable, ITimePicker, object> public partial class TimePickerHandler : MixedGraphicsControlHandler<ITimePickerDrawable, ITimePicker, object>
{ {
protected override object CreateNativeView() => throw new NotImplementedException(); protected override object CreatePlatformView() => throw new NotImplementedException();
public static void MapTime(TimePickerHandler handler, ITimePicker timePicker) { } public static void MapTime(TimePickerHandler handler, ITimePicker timePicker) { }
} }

Просмотреть файл

@ -7,18 +7,18 @@
return new GraphicsTimePicker() { GraphicsControl = this }; return new GraphicsTimePicker() { GraphicsControl = this };
} }
protected override void ConnectHandler(GraphicsTimePicker nativeView) protected override void ConnectHandler(GraphicsTimePicker platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.TimeSelected += OnTimeSelected; platformView.TimeSelected += OnTimeSelected;
} }
protected override void DisconnectHandler(GraphicsTimePicker nativeView) protected override void DisconnectHandler(GraphicsTimePicker platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.TimeSelected -= OnTimeSelected; platformView.TimeSelected -= OnTimeSelected;
} }
public static void MapTime(TimePickerHandler handler, ITimePicker timePicker) public static void MapTime(TimePickerHandler handler, ITimePicker timePicker)

Просмотреть файл

@ -7,18 +7,18 @@
return new GraphicsTimePicker() { GraphicsControl = this }; return new GraphicsTimePicker() { GraphicsControl = this };
} }
protected override void ConnectHandler(GraphicsTimePicker nativeView) protected override void ConnectHandler(GraphicsTimePicker platformView)
{ {
base.ConnectHandler(nativeView); base.ConnectHandler(platformView);
nativeView.TimeSelected += OnTimeSelected; platformView.TimeSelected += OnTimeSelected;
} }
protected override void DisconnectHandler(GraphicsTimePicker nativeView) protected override void DisconnectHandler(GraphicsTimePicker platformView)
{ {
base.DisconnectHandler(nativeView); base.DisconnectHandler(platformView);
nativeView.TimeSelected -= OnTimeSelected; platformView.TimeSelected -= OnTimeSelected;
} }
public static void MapTime(TimePickerHandler handler, ITimePicker timePicker) public static void MapTime(TimePickerHandler handler, ITimePicker timePicker)

Просмотреть файл

@ -2,19 +2,19 @@
{ {
public static class DatePickerExtensions public static class DatePickerExtensions
{ {
public static void UpdateMinimumDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateMinimumDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.MinimumDate = datePicker.MinimumDate; platformView.MinimumDate = datePicker.MinimumDate;
} }
public static void UpdateMaximumDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateMaximumDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.MaximumDate = datePicker.MaximumDate; platformView.MaximumDate = datePicker.MaximumDate;
} }
public static void UpdateDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.Date = datePicker.Date; platformView.Date = datePicker.Date;
} }
} }
} }

Просмотреть файл

@ -2,9 +2,9 @@
{ {
public static class TimePickerExtensions public static class TimePickerExtensions
{ {
public static void UpdateTime(this GraphicsTimePicker nativeView, ITimePicker timePicker) public static void UpdateTime(this GraphicsTimePicker platformView, ITimePicker timePicker)
{ {
nativeView.Time = timePicker.Time; platformView.Time = timePicker.Time;
} }
} }
} }

Просмотреть файл

@ -2,19 +2,19 @@
{ {
public static class DatePickerExtensions public static class DatePickerExtensions
{ {
public static void UpdateMinimumDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateMinimumDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.MinimumDate = datePicker.MinimumDate; platformView.MinimumDate = datePicker.MinimumDate;
} }
public static void UpdateMaximumDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateMaximumDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.MaximumDate = datePicker.MaximumDate; platformView.MaximumDate = datePicker.MaximumDate;
} }
public static void UpdateDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.Date = datePicker.Date; platformView.Date = datePicker.Date;
} }
} }
} }

Просмотреть файл

@ -2,9 +2,9 @@
{ {
public static class TimePickerExtensions public static class TimePickerExtensions
{ {
public static void UpdateTime(this GraphicsTimePicker nativeView, ITimePicker timePicker) public static void UpdateTime(this GraphicsTimePicker platformView, ITimePicker timePicker)
{ {
nativeView.Time = timePicker.Time; platformView.Time = timePicker.Time;
} }
} }
} }

Просмотреть файл

@ -2,19 +2,19 @@
{ {
public static class DatePickerExtensions public static class DatePickerExtensions
{ {
public static void UpdateMinimumDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateMinimumDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.MinimumDate = datePicker.MinimumDate; platformView.MinimumDate = datePicker.MinimumDate;
} }
public static void UpdateMaximumDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateMaximumDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.MaximumDate = datePicker.MaximumDate; platformView.MaximumDate = datePicker.MaximumDate;
} }
public static void UpdateDate(this GraphicsDatePicker nativeView, IDatePicker datePicker) public static void UpdateDate(this GraphicsDatePicker platformView, IDatePicker datePicker)
{ {
nativeView.Date = datePicker.Date; platformView.Date = datePicker.Date;
} }
} }
} }

Просмотреть файл

@ -2,9 +2,9 @@
{ {
public static class TimePickerExtensions public static class TimePickerExtensions
{ {
public static void UpdateTime(this GraphicsTimePicker nativeView, ITimePicker timePicker) public static void UpdateTime(this GraphicsTimePicker platformView, ITimePicker timePicker)
{ {
nativeView.Time = timePicker.Time; platformView.Time = timePicker.Time;
} }
} }
} }

Просмотреть файл

@ -4,9 +4,9 @@ namespace Microsoft.Maui.Graphics.Controls
{ {
public static class ViewExtensions public static class ViewExtensions
{ {
public static void UpdateIsEnabled(this UIView nativeView, IView view) public static void UpdateIsEnabled(this UIView platformView, IView view)
{ {
nativeView.UserInteractionEnabled = view.IsEnabled; platformView.UserInteractionEnabled = view.IsEnabled;
} }
} }
} }