diff --git a/Ooui.Forms/Forms.cs b/Ooui.Forms/Forms.cs index 8c06773..be696c9 100644 --- a/Ooui.Forms/Forms.cs +++ b/Ooui.Forms/Forms.cs @@ -166,6 +166,12 @@ namespace Xamarin.Forms public void QuitApplication() { } + + public SizeRequest GetNativeSize(VisualElement view, double widthConstraint, double heightConstraint) + { + var renderer = Ooui.Forms.Platform.GetRenderer(view); + return renderer.GetDesiredSize(widthConstraint, heightConstraint); + } } public class ViewInitializedEventArgs diff --git a/Ooui.Forms/Ooui.Forms.csproj b/Ooui.Forms/Ooui.Forms.csproj index de25f30..7908af0 100644 --- a/Ooui.Forms/Ooui.Forms.csproj +++ b/Ooui.Forms/Ooui.Forms.csproj @@ -1,4 +1,4 @@ - + 1.0.0 @@ -18,7 +18,7 @@ - + diff --git a/Ooui.Forms/Platform.cs b/Ooui.Forms/Platform.cs index c600a20..2ab9be1 100644 --- a/Ooui.Forms/Platform.cs +++ b/Ooui.Forms/Platform.cs @@ -7,7 +7,10 @@ using Xamarin.Forms.Internals; namespace Ooui.Forms { - public class Platform : BindableObject, IPlatform, INavigation, IDisposable + public class Platform : BindableObject, INavigation, IDisposable +#pragma warning disable CS0618 // Type or member is obsolete + , IPlatform +#pragma warning restore CS0618 // Type or member is obsolete { bool _disposed; @@ -99,7 +102,7 @@ namespace Ooui.Forms base.OnBindingContextChanged (); } - public SizeRequest GetNativeSize (VisualElement view, double widthConstraint, double heightConstraint) + public static SizeRequest GetNativeSize (VisualElement view, double widthConstraint, double heightConstraint) { var renderView = GetRenderer (view); if (renderView == null || renderView.NativeView == null) @@ -116,8 +119,12 @@ namespace Ooui.Forms throw new NotImplementedException (); Page = newRoot; +#pragma warning disable CS0618 // Type or member is obsolete + // The Platform property is no longer necessary, but we have to set it because some third-party + // library might still be retrieving it and using it Page.Platform = this; - AddChild (Page); +#pragma warning restore CS0618 // Type or member is obsolete + AddChild(Page); Page.DescendantRemoved += HandleChildRemoved; @@ -232,5 +239,12 @@ namespace Ooui.Forms { throw new NotImplementedException (); } + + #region obsolete + SizeRequest IPlatform.GetNativeSize (VisualElement view, double widthConstraint, double heightConstraint) + { + return GetNativeSize(view, widthConstraint, heightConstraint); + } + #endregion } } diff --git a/Ooui.Forms/Renderers/NavigationPageRenderer.cs b/Ooui.Forms/Renderers/NavigationPageRenderer.cs index cc6a40c..46fd0d3 100644 --- a/Ooui.Forms/Renderers/NavigationPageRenderer.cs +++ b/Ooui.Forms/Renderers/NavigationPageRenderer.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.ComponentModel; using System.Net; -using System.Text; using Xamarin.Forms; using Xamarin.Forms.Internals; using System.Linq; @@ -161,18 +159,24 @@ namespace Ooui.Forms.Renderers private void OnPopToRootRequested(object sender, NavigationRequestedEventArgs e) { +#pragma warning disable CS0618 // Type or member is obsolete e.Realize = true; +#pragma warning restore CS0618 // Type or member is obsolete } private void OnPopRequested(object sender, NavigationRequestedEventArgs e) { +#pragma warning disable CS0618 // Type or member is obsolete e.Realize = true; +#pragma warning restore CS0618 // Type or member is obsolete } // This is where you would draw the new contents. private void OnPushRequested(object sender, NavigationRequestedEventArgs e) { +#pragma warning disable CS0618 // Type or member is obsolete e.Realize = true; +#pragma warning restore CS0618 // Type or member is obsolete } private string GenerateFullHash() diff --git a/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj b/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj index bfa4412..601b31a 100644 --- a/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj +++ b/PlatformSamples/AspNetCoreMvc/AspNetCoreMvc.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.0 @@ -9,7 +9,7 @@ - + diff --git a/Samples/Program.cs b/Samples/Program.cs index 59320c5..325786b 100644 --- a/Samples/Program.cs +++ b/Samples/Program.cs @@ -55,7 +55,7 @@ namespace Samples sample.Publish(); } - var samplePage = new SamplePickerSample(samples); + var samplePage = new SamplePicker(samples); samplePage.Publish(); UI.Present (samplePage.Path); diff --git a/Samples/SamplePickerSample.cs b/Samples/SamplePicker.cs similarity index 92% rename from Samples/SamplePickerSample.cs rename to Samples/SamplePicker.cs index 53d9fc8..f0e3dcd 100644 --- a/Samples/SamplePickerSample.cs +++ b/Samples/SamplePicker.cs @@ -7,11 +7,11 @@ using Element = Ooui.Element; namespace Samples { - public class SamplePickerSample : ISample + public class SamplePicker : ISample { private readonly IEnumerable _samplePages; - public SamplePickerSample(IEnumerable samplePages) + public SamplePicker(IEnumerable samplePages) { _samplePages = samplePages.OrderBy(s => s.Title); } diff --git a/Samples/Samples.csproj b/Samples/Samples.csproj index d909b7d..37a96c8 100644 --- a/Samples/Samples.csproj +++ b/Samples/Samples.csproj @@ -10,7 +10,7 @@ - +