зеркало из https://github.com/DeGsoft/maui-linux.git
[Tizen] Adjust the platform creation timing (#2977)
This commit is contained in:
Родитель
3654454b28
Коммит
ae92582d5a
|
@ -131,18 +131,6 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
throw new InvalidOperationException("Call Forms.Init (UIApplication) before this");
|
||||
}
|
||||
|
||||
if (_platform != null)
|
||||
{
|
||||
_platform.SetPage(page);
|
||||
return;
|
||||
}
|
||||
|
||||
_platform = Platform.CreatePlatform(BaseLayout);
|
||||
_platform.HasAlpha = MainWindow.Alpha;
|
||||
BaseLayout.SetContent(_platform.GetRootNativeView());
|
||||
|
||||
_platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView);
|
||||
|
||||
if (_application != null)
|
||||
{
|
||||
_application.Platform = _platform;
|
||||
|
@ -191,6 +179,11 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
_platform = Platform.CreatePlatform(BaseLayout);
|
||||
_platform.HasAlpha = MainWindow.Alpha;
|
||||
BaseLayout.SetContent(_platform.GetRootNativeView());
|
||||
_platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView);
|
||||
}
|
||||
|
||||
public void Run()
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
_page.Platform = this;
|
||||
|
||||
var renderer = Platform.AttachRenderer(_page);
|
||||
var renderer = Platform.CreateRenderer(_page);
|
||||
_rootView = renderer.NativeView;
|
||||
RootNativeViewChanged?.Invoke(this, new RootNativeViewChangedEventArgs(_rootView));
|
||||
_rootView.Show();
|
||||
|
|
|
@ -35,19 +35,17 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
/// Gets the renderer associated with the <c>view</c>. If it doesn't exist, creates a new one.
|
||||
/// </summary>
|
||||
/// <returns>Renderer associated with the <c>view</c>.</returns>
|
||||
/// <param name="view">View for which the renderer is going to be returned.</param>
|
||||
public static IVisualElementRenderer GetOrCreateRenderer(VisualElement view)
|
||||
/// <param name="element">VisualElement for which the renderer is going to be returned.</param>
|
||||
public static IVisualElementRenderer GetOrCreateRenderer(VisualElement element)
|
||||
{
|
||||
return GetRenderer(view) ?? AttachRenderer(view);
|
||||
return GetRenderer(element) ?? CreateRenderer(element);
|
||||
}
|
||||
|
||||
internal static IVisualElementRenderer AttachRenderer(VisualElement view)
|
||||
internal static IVisualElementRenderer CreateRenderer(VisualElement element)
|
||||
{
|
||||
IVisualElementRenderer visualElementRenderer = Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(view) ?? new DefaultRenderer();
|
||||
|
||||
visualElementRenderer.SetElement(view);
|
||||
|
||||
return visualElementRenderer;
|
||||
IVisualElementRenderer renderer = Registrar.Registered.GetHandlerForObject<IVisualElementRenderer>(element) ?? new DefaultRenderer();
|
||||
renderer.SetElement(element);
|
||||
return renderer;
|
||||
}
|
||||
|
||||
internal static ITizenPlatform CreatePlatform(EvasObject parent)
|
||||
|
@ -160,7 +158,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
Page = newRoot;
|
||||
Page.Platform = this;
|
||||
|
||||
IVisualElementRenderer pageRenderer = Platform.AttachRenderer(Page);
|
||||
IVisualElementRenderer pageRenderer = Platform.CreateRenderer(Page);
|
||||
var naviItem = _internalNaviframe.Push(pageRenderer.NativeView);
|
||||
naviItem.TitleBarVisible = false;
|
||||
|
||||
|
@ -282,7 +280,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
async Task INavigation.PushModalAsync(Page modal, bool animated)
|
||||
{
|
||||
var previousPage = CurrentPageController;
|
||||
Device.BeginInvokeOnMainThread(()=> previousPage?.SendDisappearing());
|
||||
Device.BeginInvokeOnMainThread(() => previousPage?.SendDisappearing());
|
||||
|
||||
_navModel.PushModal(modal);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче