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

Commit

Permalink
Fix up repo for newer versions
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Feb 6, 2022
1 parent 2bcf050 commit 22cad7c
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override bool Initialize()
return false;
}

var nativeWindow = this.Window?.Content?.ToNative(handler.MauiContext);
var nativeWindow = this.Window?.Content?.ToPlatform(handler.MauiContext);
if (nativeWindow is null)
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override bool Initialize()
return false;
}

var nativeElement = this.Window.Content.ToNative(this.Window.Handler.MauiContext);
var nativeElement = this.Window.Content.ToPlatform(this.Window.Handler.MauiContext);
if (nativeElement == null)
{
return false;
Expand Down
2 changes: 1 addition & 1 deletion DrasticMaui.DragAndDropOverlay/DragAndDropOverlay.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override bool Initialize()
return false;
}

var nativeLayer = this.Window.ToNative(this.Window.Handler.MauiContext);
var nativeLayer = this.Window.ToPlatform(this.Window.Handler.MauiContext);
if (nativeLayer is not UIWindow nativeWindow)
{
return false;
Expand Down
2 changes: 1 addition & 1 deletion DrasticMaui.PageOverlay/PageOverlay.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override bool Initialize()
return false;
}

var nativeWindow = this.Window?.Content?.ToNative(this.Window.Handler.MauiContext);
var nativeWindow = this.Window?.Content?.ToPlatform(this.Window.Handler.MauiContext);
if (nativeWindow == null)
{
return false;
Expand Down
8 changes: 4 additions & 4 deletions DrasticMaui.PageOverlay/PageOverlay.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override bool Initialize()

this.context = handler.MauiContext;

var nativeElement = this.Window.Content.ToNative(this.context);
var nativeElement = this.Window.Content.ToPlatform(this.context);
if (nativeElement is null)
{
return false;
Expand Down Expand Up @@ -82,7 +82,7 @@ internal void AddNativeElements(Microsoft.Maui.Controls.Page page)
return;
}

var element = page.ToNative(this.context);
var element = page.ToPlatform(this.context);

var zindex = 100 + this.Views.Count();
if (element is null)
Expand Down Expand Up @@ -110,7 +110,7 @@ internal void RemoveNativeElements(Microsoft.Maui.Controls.Page page)
return;
}

var element = page.ToNative(this.context);
var element = page.ToPlatform(this.context);
if (element is null)
{
return;
Expand Down Expand Up @@ -139,7 +139,7 @@ private void Panel_PointerMoved(object sender, Microsoft.UI.Xaml.Input.PointerRo

foreach (var view in this.Views)
{
var nativeView = (view as Microsoft.Maui.Controls.Page)?.ToNative(this.context);
var nativeView = (view as Microsoft.Maui.Controls.Page)?.ToPlatform(this.context);
var hitTests = view.HitTestViews.Any(n => n.GetBoundingBox(this.context).Contains(new Microsoft.Maui.Graphics.Point(pointerPoint.Position.X, pointerPoint.Position.Y)));
if (nativeView is not null)
{
Expand Down
12 changes: 2 additions & 10 deletions DrasticMaui.PageOverlay/PageOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
// Copyright (c) Drastic Actions. All rights reserved.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DrasticMaui.Tools;
using Microsoft.Maui.Platform;

namespace DrasticMaui.Overlays
{
/// <summary>
Expand Down Expand Up @@ -67,7 +59,7 @@ public bool AddView(Page view)
this.hitTestElements.Add(hitTestView, hittestView.HitTestViews);
}

Microsoft.Maui.Controls.Xaml.Diagnostics.VisualDiagnostics.OnChildAdded(this, view, 0);
VisualDiagnostics.OnChildAdded(this, view, 0);
return true;
}

Expand All @@ -94,7 +86,7 @@ public bool RemoveView(Page view)
this.RemoveNativeElements(view);
#endif

Microsoft.Maui.Controls.Xaml.Diagnostics.VisualDiagnostics.OnChildRemoved(this, view, 0);
VisualDiagnostics.OnChildRemoved(this, view, 0);
return this.hitTestElements.Remove(hitTestView);
}

Expand Down
2 changes: 1 addition & 1 deletion DrasticMaui.PageOverlay/PageOverlay.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override bool Initialize()
return false;
}

var nativeLayer = this.Window?.ToNative(this.context);
var nativeLayer = this.Window?.ToPlatform(this.context);
if (nativeLayer is not UIWindow nativeWindow)
{
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class DrasticSideBarNavigationWindow
{
private Microsoft.UI.Xaml.FrameworkElement? page;
private MauiNavigationView? navigationView;
private NavigationRootView? navigationRootView;
private WindowRootView? navigationRootView;
private Page? selectedPage;
private IMauiContext? context;

Expand Down Expand Up @@ -53,7 +53,7 @@ public async void SetupNavigationView()
return;
}

if (panel.Children[0] is not NavigationRootView rootView)
if (panel.Children[0] is not WindowRootView rootView)
{
return;
}
Expand All @@ -64,7 +64,7 @@ public async void SetupNavigationView()

private void NavigationRootView_Loaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
if (sender is not NavigationRootView view)
if (sender is not WindowRootView view)
{
return;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.Navigati
}

var testing = selectedItem.Page.ToHandler(this.Handler.MauiContext);
var page = testing.GetWrappedNativeView();
var page = testing.ContainerView;

bool addNavigationHandlers = false;
if (page != this.page)
Expand Down
2 changes: 1 addition & 1 deletion DrasticMaui/Tools/PlatformExtensions.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static List<T> GetChildView<T>(this Android.Views.ViewGroup view)
/// <param name="view">MAUI IView.</param>
/// <returns>Rectangle.</returns>
public static Microsoft.Maui.Graphics.Rectangle GetBoundingBox(this IView view, IMauiContext context)
=> view.ToNative(context).GetBoundingBox();
=> view.ToPlatform(context).GetBoundingBox();

/// <summary>
/// Get the bounding box for an Android View.
Expand Down
2 changes: 1 addition & 1 deletion DrasticMaui/Tools/PlatformExtensions.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static AppWindow GetAppWindowFromWindowHandle(IntPtr windowHandle)
}

public static Microsoft.Maui.Graphics.Rectangle GetBoundingBox(this IView view, IMauiContext context)
=> view.ToNative(context).GetBoundingBox();
=> view.ToPlatform(context).GetBoundingBox();

public static Microsoft.Maui.Graphics.Rectangle GetBoundingBox(this FrameworkElement? nativeView)
{
Expand Down
8 changes: 3 additions & 5 deletions DrasticMaui/Tools/PlatformExtensions.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class PlatformExtensions
/// <returns>Matrix4x4.</returns>
public static System.Numerics.Matrix4x4 GetViewTransform(this IView view, IMauiContext context)
{
var nativeView = view?.ToNative(context);
var nativeView = view?.ToPlatform(context);
if (nativeView == null)
{
return default(System.Numerics.Matrix4x4);
Expand All @@ -48,7 +48,7 @@ public static System.Numerics.Matrix4x4 GetViewTransform(this UIView view)
/// <param name="view">IView.</param>
/// <returns>Rectangle.</returns>
public static Microsoft.Maui.Graphics.Rectangle GetBoundingBox(this IView view, IMauiContext context)
=> view.ToNative(context).GetBoundingBox();
=> view.ToPlatform(context).GetBoundingBox();

/// <summary>
/// Get Bounding Box.
Expand Down Expand Up @@ -85,7 +85,7 @@ public static double ExtractAngleInRadians(this System.Numerics.Matrix4x4 matrix
/// <returns>Rectangle.</returns>
public static Rectangle GetNativeViewBounds(this IView view, IMauiContext context)
{
var nativeView = view?.ToNative(context);
var nativeView = view?.ToPlatform(context);
if (nativeView == null)
{
return default(Rectangle);
Expand Down Expand Up @@ -311,8 +311,6 @@ public static async Task SetFrameForUIWindow(this UIWindow window, CGRect rect)
return;
}

var testFrame = window.GetFrame();

var attachedWindow = nsWindow.ValueForKey(new NSString("attachedWindow"));

if (attachedWindow is null)
Expand Down

0 comments on commit 22cad7c

Please sign in to comment.