Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Updated to .NET MAUI GA
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz committed May 25, 2022
1 parent 079376a commit d6ba589
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 108 deletions.
4 changes: 2 additions & 2 deletions Microsoft.Maui.Graphics.Controls.MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework.Contains('-windows')) == true ">
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
<PackageReference Include="Microsoft.Maui.Graphics.Win2D.WinUI.Desktop" Version="6.0.300-rc.3.1315" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.3.1" />
<PackageReference Include="Microsoft.Maui.Graphics.Win2D.WinUI.Desktop" Version="6.0.400-preview.1.1367" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/GraphicsControls.Sample/GraphicsControls.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.3" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.1" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.3.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/GraphicsControls/GraphicsControls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageId>Microsoft.Maui.Graphics.Controls</PackageId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Graphics" Version="6.0.300-rc.3.1315" />
<PackageReference Include="Microsoft.Maui.Graphics" Version="6.0.400-preview.1.1367" />
</ItemGroup>
<Import Project="..\..\Microsoft.Maui.Graphics.Controls.MultiTargeting.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable disable
using System;
using Android.App;
using Android.Content;
using Android.Graphics;
Expand All @@ -13,16 +14,16 @@ public partial class GraphicsDatePicker : View, IMixedNativeView
DateTime _minimumDate;
DateTime _maximumDate;

IMixedGraphicsHandler? _graphicsControl;
IMixedGraphicsHandler _graphicsControl;
readonly PlatformCanvas _canvas;
readonly ScalingCanvas _scalingCanvas;
readonly float _scale;

int _width, _height;
Color? _backgroundColor;
IDrawable? _drawable;
Color _backgroundColor;
IDrawable _drawable;

DatePickerDialog? _dialog;
DatePickerDialog _dialog;

public GraphicsDatePicker(Context context) : base(context)
{
Expand Down Expand Up @@ -63,7 +64,7 @@ public DateTime MaximumDate
}
}

public Color? BackgroundColor
public Color BackgroundColor
{
get => _backgroundColor;
set
Expand All @@ -73,13 +74,13 @@ public Color? BackgroundColor
}
}

public IMixedGraphicsHandler? GraphicsControl
public IMixedGraphicsHandler GraphicsControl
{
get => _graphicsControl;
set => Drawable = _graphicsControl = value;
}

public IDrawable? Drawable
public IDrawable Drawable
{
get => _drawable;
set
Expand All @@ -89,7 +90,7 @@ public IDrawable? Drawable
}
}

public event EventHandler<DateSelectedEventArgs>? DateSelected;
public event EventHandler<DateSelectedEventArgs> DateSelected;

static readonly string[] DefaultNativeLayers = new string[] { };

Expand All @@ -113,7 +114,7 @@ protected override void Dispose(bool disposing)
}
}

public override void Draw(Canvas? androidCanvas)
public override void Draw(Canvas androidCanvas)
{
if (_drawable == null)
return;
Expand Down Expand Up @@ -145,7 +146,7 @@ protected override void OnSizeChanged(int width, int height, int oldWidth, int o
_height = height;
}

public override bool OnTouchEvent(MotionEvent? e)
public override bool OnTouchEvent(MotionEvent e)
{
if (e != null && Enabled)
{
Expand All @@ -162,7 +163,7 @@ public override bool OnTouchEvent(MotionEvent? e)
return base.OnTouchEvent(e);
}

void OnTouch(object? sender, TouchEventArgs e)
void OnTouch(object sender, TouchEventArgs e)
{
if (e.Event?.Action != MotionEventActions.Up)
return;
Expand Down Expand Up @@ -197,7 +198,7 @@ void CreateDialog(DateTime date)
_dialog.SetCanceledOnTouchOutside(true);
}

void OnCancelButtonClicked(object? sender, EventArgs e)
void OnCancelButtonClicked(object sender, EventArgs e)
{
ClearFocus();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Graphics.Canvas.UI.Xaml;
#nullable disable
using Microsoft.Graphics.Canvas.UI.Xaml;
using Microsoft.Maui.Graphics.Win2D;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
Expand All @@ -14,11 +15,11 @@ public class GraphicsDatePicker : UserControl, IMixedNativeView
DateTime _minimumDate;
DateTime _maximumDate;

DatePickerFlyout? _datePickerFlyout;
CanvasControl? _canvasControl;
DatePickerFlyout _datePickerFlyout;
CanvasControl _canvasControl;
readonly W2DCanvas _canvas = new W2DCanvas();

IMixedGraphicsHandler? _graphicsControl;
IMixedGraphicsHandler _graphicsControl;
IDrawable? _drawable;
RectF _dirty;

Expand Down Expand Up @@ -59,13 +60,13 @@ public DateTime MaximumDate
}
}

public IMixedGraphicsHandler? GraphicsControl
public IMixedGraphicsHandler GraphicsControl
{
get => _graphicsControl;
set => Drawable = _graphicsControl = value;
}

public IDrawable? Drawable
public IDrawable Drawable
{
get => _drawable;
set
Expand All @@ -75,7 +76,7 @@ public IDrawable? Drawable
}
}

public event EventHandler<DateSelectedEventArgs>? DateSelected;
public event EventHandler<DateSelectedEventArgs> DateSelected;

static readonly string[] DefaultNativeLayers = new string[] { };

Expand Down
23 changes: 12 additions & 11 deletions src/GraphicsControls/Handlers/DatePicker/GraphicsDatePicker.iOS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable disable
using System;
using System.Diagnostics;
using CoreGraphics;
using Foundation;
Expand All @@ -14,15 +15,15 @@ public class GraphicsDatePicker : UIView, IMixedNativeView
DateTime _minimumDate;
DateTime _maximumDate;

IMixedGraphicsHandler? _graphicsControl;
IMixedGraphicsHandler _graphicsControl;
readonly PlatformCanvas _canvas;

UIDatePicker? _picker;
NoCaretField? _entry;
NSDate? _preSelectedDate;
UIDatePicker _picker;
NoCaretField _entry;
NSDate _preSelectedDate;

CGColorSpace? _colorSpace;
IDrawable? _drawable;
CGColorSpace _colorSpace;
IDrawable _drawable;
CGRect _lastBounds;

public GraphicsDatePicker()
Expand Down Expand Up @@ -64,13 +65,13 @@ public DateTime MaximumDate
}
}

public IMixedGraphicsHandler? GraphicsControl
public IMixedGraphicsHandler GraphicsControl
{
get => _graphicsControl;
set => Drawable = _graphicsControl = value;
}

public IDrawable? Drawable
public IDrawable Drawable
{
get => _drawable;
set
Expand All @@ -82,7 +83,7 @@ public IDrawable? Drawable
}
}

public event EventHandler<DateSelectedEventArgs>? DateSelected;
public event EventHandler<DateSelectedEventArgs> DateSelected;

public override CGRect Bounds
{
Expand Down Expand Up @@ -148,7 +149,7 @@ public override void Draw(CGRect dirtyRect)
Draw(coreGraphics, dirtyRect.AsRectangleF());
}

public override void TouchesBegan(NSSet touches, UIEvent? evt)
public override void TouchesBegan(NSSet touches, UIEvent evt)
{
try
{
Expand Down
17 changes: 9 additions & 8 deletions src/GraphicsControls/Handlers/Editor/GraphicsEditor.Android.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Android.Content;
#nullable disable
using Android.Content;
using Android.Graphics;
using Android.Views;
using AndroidX.AppCompat.Widget;
Expand All @@ -14,9 +15,9 @@ public class GraphicsEditor : AppCompatEditText, IMixedNativeView

bool _pressedContained;
int _width, _height;
Color? _backgroundColor;
IMixedGraphicsHandler? _graphicsControl;
IDrawable? _drawable;
Color _backgroundColor;
IMixedGraphicsHandler _graphicsControl;
IDrawable _drawable;

public GraphicsEditor(Context context) : base(context)
{
Expand All @@ -37,13 +38,13 @@ public Color? BackgroundColor
}
}

public IMixedGraphicsHandler? GraphicsControl
public IMixedGraphicsHandler GraphicsControl
{
get => _graphicsControl;
set => Drawable = _graphicsControl = value;
}

public IDrawable? Drawable
public IDrawable Drawable
{
get => _drawable;
set
Expand All @@ -59,7 +60,7 @@ public IDrawable? Drawable

public void DrawBaseLayer(RectF dirtyRect) { }

public override void Draw(Canvas? androidCanvas)
public override void Draw(Canvas androidCanvas)
{
if (_drawable == null)
return;
Expand Down Expand Up @@ -93,7 +94,7 @@ protected override void OnSizeChanged(int width, int height, int oldWidth, int o
_height = height;
}

public override bool OnTouchEvent(MotionEvent? e)
public override bool OnTouchEvent(MotionEvent e)
{
if (e != null && Enabled)
{
Expand Down
13 changes: 7 additions & 6 deletions src/GraphicsControls/Handlers/Editor/GraphicsEditor.Windows.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Graphics.Canvas.UI.Xaml;
#nullable disable
using Microsoft.Graphics.Canvas.UI.Xaml;
using Microsoft.Maui.Graphics.Win2D;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
Expand All @@ -8,10 +9,10 @@ namespace Microsoft.Maui.Graphics.Controls
{
public class GraphicsEditor : UserControl, IMixedNativeView
{
CanvasControl? _canvasControl;
CanvasControl _canvasControl;
readonly W2DCanvas _canvas = new W2DCanvas();
IMixedGraphicsHandler? _graphicsControl;
IDrawable? _drawable;
IMixedGraphicsHandler _graphicsControl;
IDrawable _drawable;
RectF _dirty;

public GraphicsEditor()
Expand All @@ -20,13 +21,13 @@ public GraphicsEditor()
Unloaded += OnUnloaded;
}

public IMixedGraphicsHandler? GraphicsControl
public IMixedGraphicsHandler GraphicsControl
{
get => _graphicsControl;
set => Drawable = _graphicsControl = value;
}

public IDrawable? Drawable
public IDrawable Drawable
{
get => _drawable;
set
Expand Down
13 changes: 7 additions & 6 deletions src/GraphicsControls/Handlers/Editor/GraphicsEditor.iOS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable disable
using System;
using System.Diagnostics;
using CoreGraphics;
using Microsoft.Maui.Graphics.Platform;
Expand All @@ -11,9 +12,9 @@ public class GraphicsEditor : UITextView, IMixedNativeView
readonly PlatformCanvas _canvas;
readonly UITapGestureRecognizer _tapGesture;

CGColorSpace? _colorSpace;
IMixedGraphicsHandler? _graphicsControl;
IDrawable? _drawable;
CGColorSpace _colorSpace;
IMixedGraphicsHandler _graphicsControl;
IDrawable _drawable;
CGRect _lastBounds;
UIEdgeInsets _eddgeInsets;

Expand All @@ -32,13 +33,13 @@ public GraphicsEditor()
AddGestureRecognizer(_tapGesture);
}

public IMixedGraphicsHandler? GraphicsControl
public IMixedGraphicsHandler GraphicsControl
{
get => _graphicsControl;
set => Drawable = _graphicsControl = value;
}

public IDrawable? Drawable
public IDrawable Drawable
{
get => _drawable;
set
Expand Down
Loading

0 comments on commit d6ba589

Please sign in to comment.