This commit is contained in:
Javier Suárez Ruiz 2022-02-28 17:24:51 +01:00
Родитель cbc87b682f
Коммит 52ae3cd09e
9 изменённых файлов: 17 добавлений и 15 удалений

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

@ -7,10 +7,10 @@ namespace DrasticOverlay
{
internal static AView? GetNative(this IElement view, bool returnWrappedIfPresent)
{
if (view.Handler is INativeViewHandler nativeHandler && nativeHandler.NativeView != null)
return nativeHandler.NativeView;
if (view.Handler is IPlatformViewHandler nativeHandler && nativeHandler.PlatformView != null)
return nativeHandler.PlatformView;
return (view.Handler?.NativeView as AView);
return (view.Handler?.PlatformView as AView);
}
public static NavigationRootManager GetNavigationRootManager(this IMauiContext mauiContext) =>

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

@ -7,10 +7,10 @@ namespace DrasticOverlay
{
internal static FrameworkElement? GetNative(this IElement view, bool returnWrappedIfPresent)
{
if (view.Handler is INativeViewHandler nativeHandler && nativeHandler.NativeView != null)
return nativeHandler.NativeView;
if (view.Handler is IPlatformViewHandler nativeHandler && nativeHandler.PlatformView != null)
return nativeHandler.PlatformView;
return (view.Handler?.NativeView as FrameworkElement);
return (view.Handler?.PlatformView as FrameworkElement);
}
}
}

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

@ -6,10 +6,10 @@ namespace DrasticOverlay
{
internal static UIView? GetNative(this IElement view, bool returnWrappedIfPresent)
{
if (view.Handler is INativeViewHandler nativeHandler && nativeHandler.NativeView != null)
return nativeHandler.NativeView;
if (view.Handler is IPlatformViewHandler nativeHandler && nativeHandler.PlatformView != null)
return nativeHandler.PlatformView;
return (view.Handler?.NativeView as UIView);
return (view.Handler?.PlatformView as UIView);
}
}
}

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

@ -24,7 +24,7 @@ namespace DrasticOverlay.Overlays
return false;
var handler = Window.Handler as WindowHandler;
if (handler?.NativeView is not Microsoft.UI.Xaml.Window _window)
if (handler?.PlatformView is not Microsoft.UI.Xaml.Window _window)
return false;
var panel = _window.Content as Microsoft.UI.Xaml.Controls.Panel;

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

@ -39,7 +39,7 @@ namespace DrasticOverlay.Overlays
return false;
if (handler.NativeView is not Activity activity)
if (handler.PlatformView is not Activity activity)
return false;
_nativeActivity = activity;

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

@ -31,7 +31,7 @@ namespace DrasticOverlay.Overlays
if (_nativeElement == null)
return false;
var handler = Window.Handler as WindowHandler;
if (handler?.NativeView is not Microsoft.UI.Xaml.Window _window)
if (handler?.PlatformView is not Microsoft.UI.Xaml.Window _window)
return false;
_panel = _window.Content as Panel;

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

@ -31,6 +31,8 @@ namespace DrasticOverlay.Overlays
public bool IsNativeViewInitialized { get; private set; }
public bool IsPlatformViewInitialized { get; set; }
public event EventHandler<WindowOverlayTappedEventArgs> Tapped;
public bool AddWindowElement(IWindowOverlayElement element)

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

@ -20,7 +20,7 @@ namespace DrasticOverlay.Overlays
return false;
var handler = Window.Handler as Microsoft.Maui.Handlers.WindowHandler;
if (handler?.NativeView is not Microsoft.UI.Xaml.Window _window)
if (handler?.PlatformView is not Microsoft.UI.Xaml.Window _window)
return false;
this.panel = _window.Content as Microsoft.UI.Xaml.Controls.Panel;

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

@ -24,7 +24,7 @@ namespace DrasticOverlay.Overlays
var handler = Window.Handler as Microsoft.Maui.Handlers.WindowHandler;
if (handler?.NativeView is not Microsoft.UI.Xaml.Window _window)
if (handler?.PlatformView is not Microsoft.UI.Xaml.Window _window)
return false;
if (handler.MauiContext == null)
@ -50,7 +50,7 @@ namespace DrasticOverlay.Overlays
this.page = page;
var pageHandler = page.ToHandler(this.mauiContext);
element = pageHandler.NativeView;
element = pageHandler.PlatformView;
if (element != null)
panel.Children.Add(element);
pageSet = true;