Skip to content

Commit d48da58

Browse files
committed
Remove IPage on Tizen (#72)
- Merge IFrameworkElement and IView and Remove IPage (dotnet#1875)
1 parent 2001f29 commit d48da58

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

src/Controls/src/Core/Platform/AlertManager/AlertManager.Tizen.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,9 @@ void OnPromptRequested(Page sender, PromptArguments args)
319319
prompt.Dismissed += (s, e) => _alerts.Remove(prompt);
320320
}
321321

322-
bool PageIsInThisContext(IPage page)
322+
bool PageIsInThisContext(IView sender)
323323
{
324-
var context = page.Handler?.MauiContext ?? null;
324+
var context = sender.Handler?.MauiContext ?? null;
325325
return context == MauiContext;
326326
}
327327
}

src/Core/src/Handlers/NavigationPage/NavigationPageHandler.Tizen.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ void UpdateTitle(IView page, NaviItem? item = null)
266266

267267
string SpanTitle(IView view)
268268
{
269-
if (view is not IPage page)
269+
if (view is not ITitledElement page)
270270
return string.Empty;
271271
else
272272
{
273273
var span = new TSpan
274274
{
275-
Text = page.Title,
275+
Text = page.Title??string.Empty,
276276
HorizontalTextAlignment = TTextAlignment.Center,
277277
//ForegroundColor = VirtualView.BarTextColor.ToNative()
278278
};

src/Core/src/Handlers/Page/PageHandler.Tizen.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Microsoft.Maui.Handlers
88
{
9-
public partial class PageHandler : ViewHandler<IPage, Page>, INativeViewHandler
9+
public partial class PageHandler : ViewHandler<IView, Page>, INativeViewHandler
1010
{
1111
INativeViewHandler? _contentHandler;
1212

@@ -35,11 +35,11 @@ protected override void DisconnectHandler(Page nativeView)
3535
nativeView.LayoutUpdated -= OnLayoutUpdated;
3636
}
3737

38-
public static void MapTitle(PageHandler handler, IPage page)
38+
public static void MapTitle(PageHandler handler, IView page)
3939
{
4040
}
4141

42-
public static void MapContent(PageHandler handler, IPage page)
42+
public static void MapContent(PageHandler handler, IView page)
4343
{
4444
handler.UpdateContent();
4545
}
@@ -76,11 +76,15 @@ void UpdateContent()
7676
_contentHandler?.Dispose();
7777
_contentHandler = null;
7878

79-
NativeView.Children.Add(VirtualView.Content.ToNative(MauiContext));
80-
if (VirtualView.Content.Handler is INativeViewHandler thandler)
79+
if (VirtualView is IContentView cv && cv.Content is IView view)
8180
{
82-
thandler?.SetParent(this);
83-
_contentHandler = thandler;
81+
NativeView.Children.Add(view.ToNative(MauiContext));
82+
83+
if (view.Handler is INativeViewHandler thandler)
84+
{
85+
thandler?.SetParent(this);
86+
_contentHandler = thandler;
87+
}
8488
}
8589
}
8690
}

src/Core/src/Platform/Tizen/SemanticExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Microsoft.Maui
55
{
66
public static partial class SemanticExtensions
77
{
8-
public static void SetSemanticFocus(this IFrameworkElement element)
8+
public static void SetSemanticFocus(this IView element)
99
{
1010
if (element?.Handler?.NativeView == null)
1111
throw new NullReferenceException("Can't access view from a null handler");

0 commit comments

Comments
 (0)