From: Matthew Leibowitz Date: Tue, 12 Feb 2019 12:59:18 +0000 (+0200) Subject: Updated all the OpenTK references to use NuGet (#4836) X-Git-Tag: accepted/tizen/5.5/unified/20200421.150457~513 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=920e2dd4169590db8e9061dc7a07684a8bbc2e80;p=platform%2Fcore%2Fcsapi%2Fxsf.git Updated all the OpenTK references to use NuGet (#4836) * Updated all the OpenTK references to use NuGet - Using the same NuGet version of OpenTK across the board - Added a gallery factory to allow for platform-specific pages - Added the OpenGL galleries to Android, iOS, GTK# and WPF * Fix the build for iOS and macOS * Fix the modified defines for the control gallery --- diff --git a/.nuspec/Xamarin.Forms.Platform.GTK.nuspec b/.nuspec/Xamarin.Forms.Platform.GTK.nuspec index d2d6841..f372eb5 100644 --- a/.nuspec/Xamarin.Forms.Platform.GTK.nuspec +++ b/.nuspec/Xamarin.Forms.Platform.GTK.nuspec @@ -15,12 +15,11 @@ + - - diff --git a/.nuspec/Xamarin.Forms.Platform.WPF.nuspec b/.nuspec/Xamarin.Forms.Platform.WPF.nuspec index 067a51b..9c15f00 100644 --- a/.nuspec/Xamarin.Forms.Platform.WPF.nuspec +++ b/.nuspec/Xamarin.Forms.Platform.WPF.nuspec @@ -15,8 +15,8 @@ - - + + diff --git a/Xamarin.Forms.ControlGallery.Android/Activity1.cs b/Xamarin.Forms.ControlGallery.Android/Activity1.cs index bb78d31..24c3744 100644 --- a/Xamarin.Forms.ControlGallery.Android/Activity1.cs +++ b/Xamarin.Forms.ControlGallery.Android/Activity1.cs @@ -19,7 +19,6 @@ using AColor = Android.Graphics.Color; [assembly: Dependency (typeof (CacheService))] [assembly: Dependency (typeof (TestCloudService))] -[assembly: Dependency (typeof (StringProvider))] [assembly: ExportRenderer (typeof (DisposePage), typeof (DisposePageRenderer))] [assembly: ExportRenderer (typeof (DisposeLabel), typeof (DisposeLabelRenderer))] [assembly: ExportRenderer (typeof (CustomButton), typeof (CustomButtonRenderer))] diff --git a/Xamarin.Forms.ControlGallery.Android/PlatformSpecificCoreGalleryFactory.cs b/Xamarin.Forms.ControlGallery.Android/PlatformSpecificCoreGalleryFactory.cs new file mode 100644 index 0000000..bb739bd --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/PlatformSpecificCoreGalleryFactory.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.Android; +using Xamarin.Forms.Controls; + +[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))] + +namespace Xamarin.Forms.ControlGallery.Android +{ + public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory + { + public string Title => "Android Core Gallery"; + + public IEnumerable<(Func Create, string Title)> GetPages() + { +#if HAVE_OPENTK + yield return (() => new AdvancedOpenGLGallery(), "Advanced OpenGL Gallery - Legacy"); +#else + return null; +#endif + } + } +} diff --git a/Xamarin.Forms.ControlGallery.Android/StringProvider.cs b/Xamarin.Forms.ControlGallery.Android/StringProvider.cs deleted file mode 100644 index 018ea7b..0000000 --- a/Xamarin.Forms.ControlGallery.Android/StringProvider.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Xamarin.Forms.Controls; - -namespace Xamarin.Forms.ControlGallery.Android -{ - public class StringProvider : IStringProvider - { - public string CoreGalleryTitle - { - get - { - return "Android CoreGallery"; - } - } - } -} \ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj index ff88f8e..cefa461 100644 --- a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj +++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj @@ -33,6 +33,7 @@ true + HAVE_OPENTK True $(SolutionDir)debug.keystore android @@ -44,7 +45,7 @@ full false bin\Debug\ - TRACE;DEBUG + TRACE;DEBUG;HAVE_OPENTK prompt 4 Full @@ -56,12 +57,13 @@ true + true pdbonly true bin\Release\ - TRACE + TRACE;HAVE_OPENTK prompt 4 SdkOnly @@ -73,6 +75,7 @@ true + true @@ -85,6 +88,7 @@ + @@ -98,6 +102,7 @@ + @@ -106,7 +111,6 @@ - @@ -117,6 +121,9 @@ + + GalleryPages\AdvancedOpenGLGallery.cs + diff --git a/Xamarin.Forms.ControlGallery.GTK/App.config b/Xamarin.Forms.ControlGallery.GTK/App.config index 2ed2990..50233c4 100644 --- a/Xamarin.Forms.ControlGallery.GTK/App.config +++ b/Xamarin.Forms.ControlGallery.GTK/App.config @@ -11,7 +11,7 @@ - + diff --git a/Xamarin.Forms.ControlGallery.GTK/PlatformSpecificCoreGalleryFactory.cs b/Xamarin.Forms.ControlGallery.GTK/PlatformSpecificCoreGalleryFactory.cs new file mode 100644 index 0000000..818aae5 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.GTK/PlatformSpecificCoreGalleryFactory.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.GTK; +using Xamarin.Forms.Controls; + +[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))] + +namespace Xamarin.Forms.ControlGallery.GTK +{ + public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory + { + public string Title => "GTK# Core Gallery"; + + public IEnumerable<(Func Create, string Title)> GetPages() + { +#if HAVE_OPENTK + yield return (() => new BasicOpenGLGallery(), "Basic OpenGL Gallery - Legacy"); + yield return (() => new AdvancedOpenGLGallery(), "Advanced OpenGL Gallery - Legacy"); +#else + return null; +#endif + } + } +} diff --git a/Xamarin.Forms.ControlGallery.GTK/Program.cs b/Xamarin.Forms.ControlGallery.GTK/Program.cs index 44d6a54..4632c95 100644 --- a/Xamarin.Forms.ControlGallery.GTK/Program.cs +++ b/Xamarin.Forms.ControlGallery.GTK/Program.cs @@ -21,11 +21,9 @@ namespace Xamarin.Forms.ControlGallery.GTK GtkOpenGL.Init(); GtkThemes.Init(); Gtk.Application.Init(); - FormsMaps.Init(string.Empty); - Forms.Init(); + FormsMaps.Init(string.Empty); + Forms.Init(); var app = new App(); - //var app = new BasicOpenGLApp(); - //var app = new AdvancedOpenGLApp(); var window = new FormsWindow(); window.LoadApplication(app); window.SetApplicationTitle("Xamarin.Forms GTK# Backend"); diff --git a/Xamarin.Forms.ControlGallery.GTK/StringProvider.cs b/Xamarin.Forms.ControlGallery.GTK/StringProvider.cs deleted file mode 100644 index 3df99ee..0000000 --- a/Xamarin.Forms.ControlGallery.GTK/StringProvider.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Xamarin.Forms; -using Xamarin.Forms.ControlGallery.GTK; - -[assembly: Dependency(typeof(StringProvider))] -namespace Xamarin.Forms.ControlGallery.GTK -{ - public class StringProvider : Controls.IStringProvider - { - public string CoreGalleryTitle - { - get - { - return "GTK# CoreGallery"; - } - } - } -} \ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj b/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj index 76a1afd..e9e82b7 100644 --- a/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj +++ b/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj @@ -20,7 +20,7 @@ full false bin\Debug\ - DEBUG;TRACE + DEBUG;TRACE;HAVE_OPENTK;__GTK__ prompt 4 true @@ -30,7 +30,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;HAVE_OPENTK;__GTK__ prompt 4 true @@ -69,10 +69,6 @@ ..\Xamarin.Forms.Platform.GTK\Libs\gtk-sharp\gtk-sharp-2.0\gtk-sharp.dll False - - False - ..\Xamarin.Forms.Platform.GTK\Libs\OpenTK\OpenTK.dll - False ..\Xamarin.Forms.Platform.GTK\Libs\gtk-sharp\gtk-sharp-2.0\pango-sharp.dll @@ -90,13 +86,20 @@ - - + + + + + GalleryPages\AdvancedOpenGLGallery.cs + + + GalleryPages\BasicOpenGLGallery.cs + + - diff --git a/Xamarin.Forms.ControlGallery.MacOS/NativeServices.cs b/Xamarin.Forms.ControlGallery.MacOS/NativeServices.cs index 1b813a4..df0b19c 100644 --- a/Xamarin.Forms.ControlGallery.MacOS/NativeServices.cs +++ b/Xamarin.Forms.ControlGallery.MacOS/NativeServices.cs @@ -6,7 +6,6 @@ using Xamarin.Forms.Controls; using Xamarin.Forms.Platform.MacOS; [assembly: Dependency(typeof(TestCloudService))] -[assembly: Dependency(typeof(StringProvider))] [assembly: Dependency(typeof(CacheService))] [assembly: ExportRenderer(typeof(DisposePage), typeof(DisposePageRenderer))] [assembly: ExportRenderer(typeof(DisposeLabel), typeof(DisposeLabelRenderer))] @@ -52,14 +51,6 @@ namespace Xamarin.Forms.ControlGallery.MacOS } } - public class StringProvider : IStringProvider - { - public string CoreGalleryTitle - { - get { return "iOS Core Gallery"; } - } - } - public class TestCloudService : ITestCloudService { public bool IsOnTestCloud() diff --git a/Xamarin.Forms.ControlGallery.MacOS/PlatformSpecificCoreGalleryFactory.cs b/Xamarin.Forms.ControlGallery.MacOS/PlatformSpecificCoreGalleryFactory.cs new file mode 100644 index 0000000..a1b39e9 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.MacOS/PlatformSpecificCoreGalleryFactory.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.MacOS; +using Xamarin.Forms.Controls; + +[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))] + +namespace Xamarin.Forms.ControlGallery.MacOS +{ + public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory + { + public string Title => "macOS Core Gallery"; + + public IEnumerable<(Func Create, string Title)> GetPages() + { +#if HAVE_OPENTK + yield return (() => new BasicOpenGLGallery(), "Basic OpenGL Gallery - Legacy"); + yield return (() => new AdvancedOpenGLGallery(), "Advanced OpenGL Gallery - Legacy"); +#else + return null; +#endif + } + } +} diff --git a/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj b/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj index e944930..4560462 100644 --- a/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj +++ b/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj @@ -17,7 +17,7 @@ full false bin\Debug - DEBUG; + DEBUG;HAVE_OPENTK prompt 4 false @@ -37,12 +37,12 @@ + true true bin\Release - - + HAVE_OPENTK prompt 4 false @@ -60,6 +60,7 @@ + true @@ -69,6 +70,7 @@ + @@ -98,8 +100,15 @@ + + + GalleryPages\AdvancedOpenGLGallery.cs + + + GalleryPages\BasicOpenGLGallery.cs + diff --git a/Xamarin.Forms.ControlGallery.Tizen/PlatformSpecificCoreGalleryFactory.cs b/Xamarin.Forms.ControlGallery.Tizen/PlatformSpecificCoreGalleryFactory.cs new file mode 100644 index 0000000..04d6275 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Tizen/PlatformSpecificCoreGalleryFactory.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.Tizen; +using Xamarin.Forms.Controls; + +[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))] + +namespace Xamarin.Forms.ControlGallery.Tizen +{ + public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory + { + public string Title => "Tizen Core Gallery"; + + public IEnumerable<(Func Create, string Title)> GetPages() => null; + } +} diff --git a/Xamarin.Forms.ControlGallery.Tizen/StringProvider.cs b/Xamarin.Forms.ControlGallery.Tizen/StringProvider.cs deleted file mode 100644 index 43816e0..0000000 --- a/Xamarin.Forms.ControlGallery.Tizen/StringProvider.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Xamarin.Forms; -using Xamarin.Forms.Controls; -using Xamarin.Forms.ControlGallery.Tizen; - -[assembly: Dependency(typeof(StringProvider))] -namespace Xamarin.Forms.ControlGallery.Tizen -{ - public class StringProvider : IStringProvider - { - public string CoreGalleryTitle - { - get - { - return "Tizen CoreGallery"; - } - } - } -} \ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.WPF/App.config b/Xamarin.Forms.ControlGallery.WPF/App.config index ad0aecd..e3d8663 100644 --- a/Xamarin.Forms.ControlGallery.WPF/App.config +++ b/Xamarin.Forms.ControlGallery.WPF/App.config @@ -7,7 +7,7 @@ - + diff --git a/Xamarin.Forms.ControlGallery.WPF/MainWindow.xaml.cs b/Xamarin.Forms.ControlGallery.WPF/MainWindow.xaml.cs index 7a269ce..bffffa7 100644 --- a/Xamarin.Forms.ControlGallery.WPF/MainWindow.xaml.cs +++ b/Xamarin.Forms.ControlGallery.WPF/MainWindow.xaml.cs @@ -13,7 +13,6 @@ namespace Xamarin.Forms.ControlGallery.WPF Xamarin.Forms.Forms.Init(); FormsMaps.Init(""); LoadApplication(new Controls.App()); - //LoadApplication(new OpenGLViewApp()); } } } diff --git a/Xamarin.Forms.ControlGallery.WPF/OpenGLViewApp.cs b/Xamarin.Forms.ControlGallery.WPF/OpenGLViewApp.cs deleted file mode 100644 index 5fb48a1..0000000 --- a/Xamarin.Forms.ControlGallery.WPF/OpenGLViewApp.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using OpenTK.Graphics.OpenGL; - -namespace Xamarin.Forms.ControlGallery.WPF -{ - public class OpenGLViewApp : Application - { - public OpenGLViewApp() - { - MainPage = new OpenGLViewSample(); - } - } - - public class OpenGLViewSample : ContentPage - { - private bool _initGl = false; - private int _viewportWidth; - private int _viewportHeight; - private uint _mProgramHandle; - private OpenGLView _openGLView = null; - - public OpenGLViewSample() - { - Title = "OpenGLView Sample"; - - var titleLabel = new Label - { - Text = "OpenGLView", - FontSize = 36 - }; - - _openGLView = new OpenGLView - { - HeightRequest = 300, - WidthRequest = 300, - HasRenderLoop = false - }; - - _openGLView.OnDisplay = r => - { - if (!_initGl) - { - double width_in_pixels = 300; - double height_in_pixels = 300; - - InitGl((int)width_in_pixels, (int)height_in_pixels); - } - - Render(); - }; - - var stack = new StackLayout - { - Padding = new Size(12, 12), - Children = { titleLabel, _openGLView } - }; - - Content = stack; - } - - void InitGl(int width, int height) - { - _viewportHeight = width; - _viewportWidth = height; - - _mProgramHandle = (uint)GL.CreateProgram(); - if (_mProgramHandle == 0) - throw new InvalidOperationException("Unable to create program"); - - GL.BindAttribLocation(_mProgramHandle, 0, "vPosition"); - GL.LinkProgram(_mProgramHandle); - - GL.Viewport(0, 0, _viewportWidth, _viewportHeight); - - GL.UseProgram(_mProgramHandle); - - _initGl = true; - } - - - void Render() - { - GL.ClearColor(0, 0, 0, 0); - GL.Clear(ClearBufferMask.ColorBufferBit); - GL.Color3(1.0f, 0.85f, 0.35f); - GL.Begin(BeginMode.Triangles); - GL.Vertex3(0.0, 0.6, 0.0); - GL.Vertex3(-0.2, -0.3, 0.0); - GL.Vertex3(0.2, -0.3, 0.0); - GL.End(); - GL.Flush(); - } - } - - public class ReferenceTime - { - private static DateTime reference_time; - private static bool reference_time_set = false; - - public static double GetTimeFromReferenceMs() - { - if (!reference_time_set) - { - reference_time = DateTime.Now; - reference_time_set = true; - - return 0.0; - } - - DateTime actual_time = DateTime.Now; - TimeSpan ts = new TimeSpan(actual_time.Ticks - reference_time.Ticks); - - return ts.TotalMilliseconds; - } - } -} \ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.WPF/OpenTK.dll.config b/Xamarin.Forms.ControlGallery.WPF/OpenTK.dll.config deleted file mode 100644 index 7098d39..0000000 --- a/Xamarin.Forms.ControlGallery.WPF/OpenTK.dll.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Xamarin.Forms.ControlGallery.WPF/PlatformSpecificCoreGalleryFactory.cs b/Xamarin.Forms.ControlGallery.WPF/PlatformSpecificCoreGalleryFactory.cs new file mode 100644 index 0000000..333acc2 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.WPF/PlatformSpecificCoreGalleryFactory.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.WPF; +using Xamarin.Forms.Controls; + +[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))] + +namespace Xamarin.Forms.ControlGallery.WPF +{ + public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory + { + public string Title => "WPF Core Gallery"; + + public IEnumerable<(Func Create, string Title)> GetPages() + { +#if HAVE_OPENTK + yield return (() => new BasicOpenGLGallery(), "Basic OpenGL Gallery - Legacy"); + yield return (() => new AdvancedOpenGLGallery(), "Advanced OpenGL Gallery - Legacy"); +#else + return null; +#endif + } + } +} diff --git a/Xamarin.Forms.ControlGallery.WPF/StringProvider.cs b/Xamarin.Forms.ControlGallery.WPF/StringProvider.cs deleted file mode 100644 index f0d8bed..0000000 --- a/Xamarin.Forms.ControlGallery.WPF/StringProvider.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xamarin.Forms; -using Xamarin.Forms.ControlGallery.WPF; -using Xamarin.Forms.Controls; - -[assembly: Dependency(typeof(StringProvider))] -namespace Xamarin.Forms.ControlGallery.WPF -{ - public class StringProvider : IStringProvider - { - public string CoreGalleryTitle - { - get { return "WPF Core Gallery"; } - } - } -} diff --git a/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj b/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj index 79e90cf..81fa280 100644 --- a/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj +++ b/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj @@ -20,7 +20,7 @@ full false bin\Debug\ - DEBUG;TRACE + DEBUG;TRACE;HAVE_OPENTK;__WPF__ prompt 4 true @@ -30,7 +30,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;HAVE_OPENTK;__WPF__ prompt 4 true @@ -54,18 +54,23 @@ - - + + MSBuild:Compile Designer - + + GalleryPages\AdvancedOpenGLGallery.cs + + + GalleryPages\BasicOpenGLGallery.cs + + - MSBuild:Compile Designer @@ -99,9 +104,6 @@ - - Designer - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/PlatformSpecificCoreGalleryFactory.cs b/Xamarin.Forms.ControlGallery.WindowsUniversal/PlatformSpecificCoreGalleryFactory.cs new file mode 100644 index 0000000..a5a9b3b --- /dev/null +++ b/Xamarin.Forms.ControlGallery.WindowsUniversal/PlatformSpecificCoreGalleryFactory.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.WindowsUniversal; +using Xamarin.Forms.Controls; + +[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))] + +namespace Xamarin.Forms.ControlGallery.WindowsUniversal +{ + public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory + { + public string Title => "Windows Core Gallery"; + + public IEnumerable<(Func Create, string Title)> GetPages() => null; + } +} diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/StringProvider.cs b/Xamarin.Forms.ControlGallery.WindowsUniversal/StringProvider.cs deleted file mode 100644 index 0d109d7..0000000 --- a/Xamarin.Forms.ControlGallery.WindowsUniversal/StringProvider.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Xamarin.Forms; -using Xamarin.Forms.ControlGallery.WindowsUniversal; -using Xamarin.Forms.Controls; - -[assembly: Dependency (typeof (StringProvider))] - -namespace Xamarin.Forms.ControlGallery.WindowsUniversal -{ - public class StringProvider : IStringProvider - { - public string CoreGalleryTitle { - get { return "Windows Core Gallery"; } - } - } -} diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj b/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj index 222a9ee..e8427a5 100644 --- a/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj +++ b/Xamarin.Forms.ControlGallery.WindowsUniversal/Xamarin.Forms.ControlGallery.WindowsUniversal.csproj @@ -127,6 +127,7 @@ + @@ -158,7 +159,6 @@ - App.xaml diff --git a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs index 4e07f28..c8560a6 100644 --- a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs +++ b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs @@ -12,7 +12,6 @@ using Xamarin.Forms.Controls.Issues; using Xamarin.Forms.Platform.iOS; [assembly: Dependency(typeof(TestCloudService))] -[assembly: Dependency(typeof(StringProvider))] [assembly: Dependency(typeof(CacheService))] [assembly: ExportRenderer(typeof(DisposePage), typeof(DisposePageRenderer))] [assembly: ExportRenderer(typeof(DisposeLabel), typeof(DisposeLabelRenderer))] @@ -75,14 +74,6 @@ namespace Xamarin.Forms.ControlGallery.iOS } } - public class StringProvider : IStringProvider - { - public string CoreGalleryTitle - { - get { return "iOS Core Gallery"; } - } - } - public class TestCloudService : ITestCloudService { public bool IsOnTestCloud() diff --git a/Xamarin.Forms.ControlGallery.iOS/PlatformSpecificCoreGalleryFactory.cs b/Xamarin.Forms.ControlGallery.iOS/PlatformSpecificCoreGalleryFactory.cs new file mode 100644 index 0000000..4c47e12 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.iOS/PlatformSpecificCoreGalleryFactory.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.iOS; +using Xamarin.Forms.Controls; + +[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))] + +namespace Xamarin.Forms.ControlGallery.iOS +{ + public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory + { + public string Title => "iOS Core Gallery"; + + public IEnumerable<(Func Create, string Title)> GetPages() + { +#if HAVE_OPENTK + yield return (() => new AdvancedOpenGLGallery(), "Advanced OpenGL Gallery - Legacy"); +#else + return null; +#endif + } + } +} diff --git a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj index edde14d..28bc92c 100644 --- a/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj +++ b/Xamarin.Forms.ControlGallery.iOS/Xamarin.Forms.ControlGallery.iOS.csproj @@ -17,7 +17,7 @@ full false bin\iPhoneSimulator\Debug - DEBUG + DEBUG;HAVE_OPENTK prompt 4 false @@ -38,24 +38,27 @@ False iPhone Developer + true none true bin\iPhoneSimulator\Release + HAVE_OPENTK prompt 4 None i386, x86_64 false true + true true full false bin\iPhone\Debug - DEBUG;__UNIFIED__;__MOBILE__;__IOS__ + DEBUG;__UNIFIED__;__MOBILE__;__IOS__;HAVE_OPENTK prompt 4 false @@ -81,11 +84,13 @@ true NSUrlSessionHandler + true none true bin\iPhone\Release + HAVE_OPENTK prompt 4 ARMv7, ARM64 @@ -93,6 +98,7 @@ iPhone Developer Entitlements.plist true + true @@ -101,6 +107,7 @@ + @@ -117,6 +124,9 @@ + + GalleryPages\AdvancedOpenGLGallery.cs + @@ -310,6 +320,7 @@ + diff --git a/Xamarin.Forms.Controls/CoreGallery.cs b/Xamarin.Forms.Controls/CoreGallery.cs index f0edad6..4ceb394 100644 --- a/Xamarin.Forms.Controls/CoreGallery.cs +++ b/Xamarin.Forms.Controls/CoreGallery.cs @@ -370,7 +370,8 @@ namespace Xamarin.Forms.Controls new GalleryPageFactory(() => new MultiGallery(), "Multi Gallery - Legacy"), new GalleryPageFactory(() => new NavigationPropertiesGallery(), "Navigation Properties"), #if HAVE_OPENTK - new GalleryPageFactory(() => new OpenGLGallery(), "OpenGLGallery - Legacy"), + new GalleryPageFactory(() => new BasicOpenGLGallery(), "Basic OpenGL Gallery - Legacy"), + new GalleryPageFactory(() => new AdvancedOpenGLGallery(), "Advanced OpenGL Gallery - Legacy"), #endif new GalleryPageFactory(() => new PickerGallery(), "Picker Gallery - Legacy"), new GalleryPageFactory(() => new ProgressBarGallery(), "ProgressBar Gallery - Legacy"), @@ -396,6 +397,12 @@ namespace Xamarin.Forms.Controls public CorePageView(Page rootPage, NavigationBehavior navigationBehavior = NavigationBehavior.PushAsync) { + var galleryFactory = DependencyService.Get(); + + var platformPages = galleryFactory?.GetPages(); + if (platformPages != null) + _pages.AddRange(platformPages.Select(p => new GalleryPageFactory(p.Create, p.Title + " (Platform Specifc)"))); + _titleToPage = _pages.ToDictionary(o => o.Title); // avoid NRE for root pages without NavigationBar @@ -492,9 +499,9 @@ namespace Xamarin.Forms.Controls { ValidateRegistrar(); - IStringProvider stringProvider = DependencyService.Get(); + var galleryFactory = DependencyService.Get(); - Title = stringProvider.CoreGalleryTitle; + Title = galleryFactory?.Title ?? "Core Gallery"; var corePageView = new CorePageView(rootPage, navigationBehavior); @@ -568,9 +575,11 @@ namespace Xamarin.Forms.Controls } [Preserve(AllMembers = true)] - public interface IStringProvider + public interface IPlatformSpecificCoreGalleryFactory { - string CoreGalleryTitle { get; } + string Title { get; } + + IEnumerable<(Func Create, string Title)> GetPages(); } [Preserve(AllMembers = true)] public static class CoreGallery diff --git a/Xamarin.Forms.ControlGallery.GTK/AdvancedOpenGLView.cs b/Xamarin.Forms.Controls/GalleryPages/OpenGLGalleries/AdvancedOpenGLGallery.cs similarity index 95% rename from Xamarin.Forms.ControlGallery.GTK/AdvancedOpenGLView.cs rename to Xamarin.Forms.Controls/GalleryPages/OpenGLGalleries/AdvancedOpenGLGallery.cs index 81f3c8e..8d49a87 100644 --- a/Xamarin.Forms.ControlGallery.GTK/AdvancedOpenGLView.cs +++ b/Xamarin.Forms.Controls/GalleryPages/OpenGLGalleries/AdvancedOpenGLGallery.cs @@ -1,18 +1,16 @@ -using OpenTK; -using OpenTK.Graphics.OpenGL; +#if HAVE_OPENTK using System; +using OpenTK; -namespace Xamarin.Forms.ControlGallery.GTK -{ - public class AdvancedOpenGLApp : Application - { - public AdvancedOpenGLApp() - { - MainPage = new AdvancedOpenGLView(); - } - } +#if __WPF__ || __GTK__ || __MACOS__ +using OpenTK.Graphics.OpenGL; +#elif __ANDROID__ || __IOS__ +using OpenTK.Graphics.ES20; +#endif - public class AdvancedOpenGLView : ContentPage +namespace Xamarin.Forms.Controls +{ + public class AdvancedOpenGLGallery : ContentPage { private const string VertexShader = @" uniform mat4 uMVPMatrix; @@ -48,7 +46,7 @@ namespace Xamarin.Forms.ControlGallery.GTK private Xamarin.Forms.OpenGLView _openGLView = null; - public AdvancedOpenGLView() + public AdvancedOpenGLGallery() { Title = "Advanced OpenGLView Sample"; @@ -212,4 +210,5 @@ namespace Xamarin.Forms.ControlGallery.GTK return ts.TotalMilliseconds; } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.GTK/BasicOpenGLView.cs b/Xamarin.Forms.Controls/GalleryPages/OpenGLGalleries/BasicOpenGLGallery.cs similarity index 87% rename from Xamarin.Forms.ControlGallery.GTK/BasicOpenGLView.cs rename to Xamarin.Forms.Controls/GalleryPages/OpenGLGalleries/BasicOpenGLGallery.cs index 5139e10..a883333 100644 --- a/Xamarin.Forms.ControlGallery.GTK/BasicOpenGLView.cs +++ b/Xamarin.Forms.Controls/GalleryPages/OpenGLGalleries/BasicOpenGLGallery.cs @@ -1,17 +1,10 @@ -using System; +#if HAVE_OPENTK +using System; using OpenTK.Graphics.OpenGL; -namespace Xamarin.Forms.ControlGallery.GTK +namespace Xamarin.Forms.Controls { - public class BasicOpenGLApp : Application - { - public BasicOpenGLApp() - { - MainPage = new BasicOpenGLView(); - } - } - - public class BasicOpenGLView : ContentPage + public class BasicOpenGLGallery : ContentPage { private bool _initGl = false; private int _viewportWidth; @@ -19,7 +12,7 @@ namespace Xamarin.Forms.ControlGallery.GTK private uint _mProgramHandle; private OpenGLView _openGLView = null; - public BasicOpenGLView() + public BasicOpenGLGallery() { Title = "Basic OpenGLView Sample"; @@ -95,4 +88,5 @@ namespace Xamarin.Forms.ControlGallery.GTK GL.Flush(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/OpenGLGallery.cs b/Xamarin.Forms.Controls/GalleryPages/OpenGLGallery.cs deleted file mode 100644 index bb5ce8a..0000000 --- a/Xamarin.Forms.Controls/GalleryPages/OpenGLGallery.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -#if HAVE_OPENTK -using OpenTK.Graphics; -using OpenTK.Graphics.ES20; -#endif - -namespace Xamarin.Forms.Controls -{ -#if HAVE_OPENTK - public class OpenGLGallery : ContentPage - { - float red, green, blue; - - public OpenGLGallery () - { - var view = new OpenGLView {HasRenderLoop = true}; - var toggle = new Switch {IsToggled = true}; - var button = new Button {Text = "Display"}; - - view.HeightRequest = 300; - view.WidthRequest = 300; - - view.OnDisplay = r =>{ - /* - if (!inited) { - var shader = GL.CreateShader (All.VertexShader); - int length = 0; - GL.ShaderSource (shader, 1, new string [] { "void main() { gl_FragColor = vec4(0.6, 1.0, 0.0, 1.0); }"}, ref length); - GL.CompileShader (shader); - int status = 0; - GL.GetShader (shader, All.CompileStatus, ref status); - if (status == 0) { - GL.DeleteShader (shader); - throw new Exception(); - } - - inited = true; - } - */ - GL.ClearColor (red, green, blue, 1.0f); - GL.Clear ((ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit)); - - red += 0.01f; - if (red >= 1.0f) - red -= 1.0f; - green += 0.02f; - if (green >= 1.0f) - green -= 1.0f; - blue += 0.03f; - if (blue >= 1.0f) - blue -= 1.0f; - }; - - toggle.Toggled += (s, a) => { view.HasRenderLoop = toggle.IsToggled; }; - button.Activated += (s, a) => view.Display (); - - var stack = new StackLayout {Padding = new Size (20, 20)}; - stack.Add (view); - stack.Add (toggle); - stack.Add (button); - - Content = stack; - } - } -#endif -} diff --git a/Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs b/Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs index 3f14a07..9142b7e 100644 --- a/Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs +++ b/Xamarin.Forms.Controls/RootPages/RootTabbedNavigationContentPage.cs @@ -5,10 +5,6 @@ using System.Linq; using System.Resources; using System.Text; using System.Threading.Tasks; -#if HAVE_OPENTK -using OpenTK.Graphics; -using OpenTK.Graphics.ES20; -#endif namespace Xamarin.Forms.Controls { diff --git a/Xamarin.Forms.Maps.GTK/app.config b/Xamarin.Forms.Maps.GTK/app.config index 4777f37..f214d26 100644 --- a/Xamarin.Forms.Maps.GTK/app.config +++ b/Xamarin.Forms.Maps.GTK/app.config @@ -6,10 +6,6 @@ - - - - diff --git a/Xamarin.Forms.Maps.WPF/Xamarin.Forms.Maps.WPF.csproj b/Xamarin.Forms.Maps.WPF/Xamarin.Forms.Maps.WPF.csproj index 6a81675..9e6d70a 100644 --- a/Xamarin.Forms.Maps.WPF/Xamarin.Forms.Maps.WPF.csproj +++ b/Xamarin.Forms.Maps.WPF/Xamarin.Forms.Maps.WPF.csproj @@ -73,7 +73,6 @@ ResXFileCodeGenerator Resources.Designer.cs - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Xamarin.Forms.Maps.WPF/app.config b/Xamarin.Forms.Maps.WPF/app.config deleted file mode 100644 index d4f722e..0000000 --- a/Xamarin.Forms.Maps.WPF/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Xamarin.Forms.Platform.GTK/Libs/OpenTK/OpenTK.dll b/Xamarin.Forms.Platform.GTK/Libs/OpenTK/OpenTK.dll deleted file mode 100644 index 74955ba..0000000 Binary files a/Xamarin.Forms.Platform.GTK/Libs/OpenTK/OpenTK.dll and /dev/null differ diff --git a/Xamarin.Forms.Platform.GTK/Libs/OpenTK/OpenTK.dll.config b/Xamarin.Forms.Platform.GTK/Libs/OpenTK/OpenTK.dll.config deleted file mode 100644 index 7098d39..0000000 --- a/Xamarin.Forms.Platform.GTK/Libs/OpenTK/OpenTK.dll.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Xamarin.Forms.Platform.GTK/Libs/OpenTK/README.txt b/Xamarin.Forms.Platform.GTK/Libs/OpenTK/README.txt deleted file mode 100644 index 6ff2316..0000000 --- a/Xamarin.Forms.Platform.GTK/Libs/OpenTK/README.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/opentk/opentk \ No newline at end of file diff --git a/Xamarin.Forms.Platform.GTK/Xamarin.Forms.Platform.GTK.csproj b/Xamarin.Forms.Platform.GTK/Xamarin.Forms.Platform.GTK.csproj index 7da144d..559e92e 100644 --- a/Xamarin.Forms.Platform.GTK/Xamarin.Forms.Platform.GTK.csproj +++ b/Xamarin.Forms.Platform.GTK/Xamarin.Forms.Platform.GTK.csproj @@ -66,10 +66,6 @@ Libs\gtk-sharp\Mono.Cairo\Mono.Cairo.dll False - - False - Libs\OpenTK\OpenTK.dll - False Libs\gtk-sharp\gtk-sharp-2.0\pango-sharp.dll @@ -93,6 +89,9 @@ + + + Properties\GlobalAssemblyInfo.cs @@ -239,10 +238,7 @@ - - - PreserveNewest diff --git a/Xamarin.Forms.Platform.WPF/OpenTK.dll.config b/Xamarin.Forms.Platform.WPF/OpenTK.dll.config deleted file mode 100644 index 7098d39..0000000 --- a/Xamarin.Forms.Platform.WPF/OpenTK.dll.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Xamarin.Forms.Platform.WPF/Xamarin.Forms.Platform.WPF.csproj b/Xamarin.Forms.Platform.WPF/Xamarin.Forms.Platform.WPF.csproj index 6dd879c..813a7ee 100644 --- a/Xamarin.Forms.Platform.WPF/Xamarin.Forms.Platform.WPF.csproj +++ b/Xamarin.Forms.Platform.WPF/Xamarin.Forms.Platform.WPF.csproj @@ -53,8 +53,8 @@ - - + + @@ -196,9 +196,6 @@ Resources.Designer.cs - - Designer - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/Xamarin.Forms.Platform.WPF/app.config b/Xamarin.Forms.Platform.WPF/app.config index d4f722e..90cfbda 100644 --- a/Xamarin.Forms.Platform.WPF/app.config +++ b/Xamarin.Forms.Platform.WPF/app.config @@ -4,7 +4,7 @@ - +