From bb508e76c071fc1947e4c081a8f478e10dec32d1 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Wed, 11 Jan 2023 15:04:36 +0100 Subject: [PATCH 1/2] Remove obsoleted OpenGLView --- ...ompatibility.ControlGallery.Android.csproj | 1 - .../PlatformSpecificCoreGalleryFactory.cs | 4 - .../FlowDirectionGallery.cs | 2 - .../ControlGallery/src/Core/CoreGallery.cs | 5 - .../ActivityIndicatorCoreGalleryPage.cs | 43 --- .../CoreGalleryPages/ButtonCoreGalleryPage.cs | 129 ------- .../CarouselViewCoreGalleryPage.cs | 111 ------ .../CheckBoxCoreGalleryPage.cs | 64 ---- .../CollectionViewCoreGalleryPage.cs | 26 -- .../CoreBoxViewGalleryPage.cs | 43 --- .../Core/CoreGalleryPages/CoreGalleryPage.cs | 266 --------------- .../DatePickerCoreGalleryPage.cs | 64 ---- .../CoreGalleryPages/EditorCoreGalleryPage.cs | 66 ---- .../CoreGalleryPages/EntryCoreGalleryPage.cs | 152 --------- .../CoreGalleryPages/FrameCoreGalleryPage.cs | 49 --- .../ImageButtonCoreGalleryPage.cs | 136 -------- .../CoreGalleryPages/ImageCoreGalleryPage.cs | 42 --- .../KeyboardCoreGalleryPage.cs | 53 --- .../CoreGalleryPages/LabelCoreGalleryPage.cs | 319 ----------------- .../ListViewCoreGalleryPage.cs | 321 ------------------ .../OpenGLViewCoreGalleryPage.cs | 16 - .../CoreGalleryPages/PickerCoreGalleryPage.cs | 101 ------ .../ProgressBarCoreGalleryPage.cs | 31 -- .../RadioButtonCoreGalleryPage.cs | 97 ------ .../RefreshViewCoreGalleyPage.cs | 121 ------- .../SearchBarCoreGalleryPage.cs | 121 ------- .../CoreGalleryPages/SliderCoreGalleryPage.cs | 46 --- .../StepperCoreGalleryPage.cs | 29 -- .../SwipeViewCoreGalleryPage.cs | 119 ------- .../CoreGalleryPages/SwitchCoreGalleryPage.cs | 52 --- .../TableViewCoreGalleryPage.cs | 45 --- .../TimePickerCoreGalleryPage.cs | 49 --- .../WebViewCoreGalleryPage.cs | 173 ---------- .../WkWebViewCoreGalleryPage.cs | 149 -------- .../Core/GalleryPages/MemoryLeakGallery.cs | 1 - .../OpenGLGalleries/AdvancedOpenGLGallery.cs | 218 ------------ .../OpenGLGalleries/BasicOpenGLGallery.cs | 94 ----- .../src/Issues.Shared/Helpers/ViewHelper.cs | 1 - .../src/Tizen/RegistrarValidationService.cs | 2 +- .../src/UITests.Shared/PlatformQueries.cs | 2 - .../src/UITests.Shared/Queries.cs | 2 - .../src/WinUI/RegistrarValidationService.cs | 2 +- .../PlatformSpecificCoreGalleryFactory.cs | 5 - .../Xamarin.Forms.ControlGallery.GTK.csproj | 6 - .../PlatformSpecificCoreGalleryFactory.cs | 5 - .../Xamarin.Forms.ControlGallery.MacOS.csproj | 6 - .../PlatformSpecificCoreGalleryFactory.cs | 5 - .../RegistrarValidationService.cs | 2 +- .../Xamarin.Forms.ControlGallery.WPF.csproj | 6 - .../Compatibility.ControlGallery.iOS.csproj | 4 - .../iOS/PlatformSpecificCoreGalleryFactory.cs | 4 - .../Android/Renderers/OpenGLViewRenderer.cs | 111 ------ .../Core/src/AppHostBuilderExtensions.cs | 6 - .../Core/src/GTK/Compatibility.GTK.csproj | 2 - .../Core/src/GTK/Controls/OpenGLView.cs | 99 ------ .../Core/src/GTK/Properties/AssemblyInfo.cs | 1 - .../src/GTK/Renderers/OpenGLViewRenderer.cs | 83 ----- .../Core/src/MacOS/Compatibility.macOS.csproj | 2 - .../src/MacOS/Controls/MacOSOpenGLView.cs | 12 - .../Core/src/MacOS/Properties/AssemblyInfo.cs | 1 - .../src/MacOS/Renderers/OpenGLViewRenderer.cs | 104 ------ .../Core/src/WPF/Properties/AssemblyInfo.cs | 1 - .../src/WPF/Renderers/OpenGLViewRenderer.cs | 133 -------- .../src/iOS/Renderers/OpenGLViewRenderer.cs | 123 ------- .../Microsoft.Maui.Controls/OpenGLView.xml | 314 ----------------- .../src/Core/IOpenGlViewController.cs | 9 - src/Controls/src/Core/OpenGLView.cs | 49 --- .../net-android/PublicAPI.Shipped.txt | 12 - .../PublicAPI/net-ios/PublicAPI.Shipped.txt | 12 - .../net-maccatalyst/PublicAPI.Shipped.txt | 12 - .../PublicAPI/net-tizen/PublicAPI.Shipped.txt | 12 - .../net-windows/PublicAPI.Shipped.txt | 12 - .../Core/PublicAPI/net/PublicAPI.Shipped.txt | 12 - .../netstandard/PublicAPI.Shipped.txt | 12 - .../Core.UnitTests/NotifiedPropertiesTests.cs | 1 - .../Core.UnitTests/OpenGLViewUnitTests.cs | 20 -- 76 files changed, 3 insertions(+), 4562 deletions(-) delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CarouselViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CheckBoxCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CollectionViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CoreBoxViewGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/DatePickerCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/EditorCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/EntryCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/FrameCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ImageButtonCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ImageCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/KeyboardCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/LabelCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ListViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/OpenGLViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/PickerCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ProgressBarCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/RadioButtonCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/RefreshViewCoreGalleyPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SearchBarCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SliderCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/StepperCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SwipeViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SwitchCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/TableViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/TimePickerCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WebViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/AdvancedOpenGLGallery.cs delete mode 100644 src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/BasicOpenGLGallery.cs delete mode 100644 src/Compatibility/Core/src/Android/Renderers/OpenGLViewRenderer.cs delete mode 100644 src/Compatibility/Core/src/GTK/Controls/OpenGLView.cs delete mode 100644 src/Compatibility/Core/src/GTK/Renderers/OpenGLViewRenderer.cs delete mode 100644 src/Compatibility/Core/src/MacOS/Controls/MacOSOpenGLView.cs delete mode 100644 src/Compatibility/Core/src/MacOS/Renderers/OpenGLViewRenderer.cs delete mode 100644 src/Compatibility/Core/src/WPF/Renderers/OpenGLViewRenderer.cs delete mode 100644 src/Compatibility/Core/src/iOS/Renderers/OpenGLViewRenderer.cs delete mode 100644 src/Controls/docs/Microsoft.Maui.Controls/OpenGLView.xml delete mode 100644 src/Controls/src/Core/IOpenGlViewController.cs delete mode 100644 src/Controls/src/Core/OpenGLView.cs delete mode 100644 src/Controls/tests/Core.UnitTests/OpenGLViewUnitTests.cs diff --git a/src/Compatibility/ControlGallery/src/Android/Compatibility.ControlGallery.Android.csproj b/src/Compatibility/ControlGallery/src/Android/Compatibility.ControlGallery.Android.csproj index d5e854e26c33..c98889dfa205 100644 --- a/src/Compatibility/ControlGallery/src/Android/Compatibility.ControlGallery.Android.csproj +++ b/src/Compatibility/ControlGallery/src/Android/Compatibility.ControlGallery.Android.csproj @@ -57,7 +57,6 @@ - diff --git a/src/Compatibility/ControlGallery/src/Android/PlatformSpecificCoreGalleryFactory.cs b/src/Compatibility/ControlGallery/src/Android/PlatformSpecificCoreGalleryFactory.cs index 280f6ffb863e..79c1d0761e39 100644 --- a/src/Compatibility/ControlGallery/src/Android/PlatformSpecificCoreGalleryFactory.cs +++ b/src/Compatibility/ControlGallery/src/Android/PlatformSpecificCoreGalleryFactory.cs @@ -16,11 +16,7 @@ public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFa 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/src/Compatibility/ControlGallery/src/Core/ControlGalleryPages/FlowDirectionGallery.cs b/src/Compatibility/ControlGallery/src/Core/ControlGalleryPages/FlowDirectionGallery.cs index 4bad11ecdf25..6e0700b4e331 100644 --- a/src/Compatibility/ControlGallery/src/Core/ControlGalleryPages/FlowDirectionGallery.cs +++ b/src/Compatibility/ControlGallery/src/Core/ControlGalleryPages/FlowDirectionGallery.cs @@ -291,8 +291,6 @@ void SetContent(FlowDirection direction) lbl3.HorizontalTextAlignment = TextAlignment.Center; lbl3.Text = "Center text"; - //var ogv = AddView(grid, ref col, ref row, hOptions, vOptions, margin); - var pkr = AddView(grid, ref col, ref row); pkr.ItemsSource = Enumerable.Range(0, 10).ToList(); diff --git a/src/Compatibility/ControlGallery/src/Core/CoreGallery.cs b/src/Compatibility/ControlGallery/src/Core/CoreGallery.cs index a8c0179a1ffd..e995bdd424f9 100644 --- a/src/Compatibility/ControlGallery/src/Core/CoreGallery.cs +++ b/src/Compatibility/ControlGallery/src/Core/CoreGallery.cs @@ -360,7 +360,6 @@ public override string ToString() new GalleryPageFactory(() => new KeyboardCoreGallery(), "Keyboard Gallery"), new GalleryPageFactory(() => new LabelCoreGalleryPage(), "Label Gallery"), new GalleryPageFactory(() => new ListViewCoreGalleryPage(), "ListView Gallery"), - new GalleryPageFactory(() => new OpenGLViewCoreGalleryPage(), "OpenGLView Gallery"), new GalleryPageFactory(() => new PickerCoreGalleryPage(), "Picker Gallery"), new GalleryPageFactory(() => new ProgressBarCoreGalleryPage(), "ProgressBar Gallery"), new GalleryPageFactory(() => new MaterialProgressBarGallery(), "ProgressBar & Slider Gallery (Material)"), @@ -422,10 +421,6 @@ public override string ToString() new GalleryPageFactory(() => new MinimumSizeGallery(), "MinimumSize Gallery - Legacy"), new GalleryPageFactory(() => new MultiGallery(), "Multi Gallery - Legacy"), new GalleryPageFactory(() => new NavigationPropertiesGallery(), "Navigation Properties"), -#if HAVE_OPENTK - 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"), new GalleryPageFactory(() => new RelativeLayoutGallery(), "RelativeLayout Gallery - Legacy"), diff --git a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs deleted file mode 100644 index 5afc952c6b8c..000000000000 --- a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.Maui.Controls.CustomAttributes; -using Microsoft.Maui.Graphics; - -namespace Microsoft.Maui.Controls.Compatibility.ControlGallery -{ - internal class ActivityIndicatorCoreGalleryPage : CoreGalleryPage - { - protected override bool SupportsTapGestureRecognizer - { - get { return true; } - } - - protected override void InitializeElement(ActivityIndicator element) - { - element.IsRunning = true; - } - - protected override void Build(StackLayout stackLayout) - { - base.Build(stackLayout); - - var colorContainer = new ViewContainer(Test.ActivityIndicator.Color, new ActivityIndicator - { - Color = Colors.Lime, - IsRunning = true - - }); - - var isRunningContainer = new StateViewContainer(Test.ActivityIndicator.IsRunning, new ActivityIndicator - { - IsRunning = true - }); - - isRunningContainer.StateChangeButton.Clicked += (sender, args) => - { - isRunningContainer.View.IsRunning = !isRunningContainer.View.IsRunning; - }; - - Add(colorContainer); - Add(isRunningContainer); - } - } -} \ No newline at end of file diff --git a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs deleted file mode 100644 index bbedf862deff..000000000000 --- a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs +++ /dev/null @@ -1,129 +0,0 @@ -using Microsoft.Maui.Controls.CustomAttributes; -using Microsoft.Maui.Graphics; - -namespace Microsoft.Maui.Controls.Compatibility.ControlGallery -{ - internal class ButtonCoreGalleryPage : CoreGalleryPage - -" - }, - HeightRequest = 200 - }; - - jsAlertWebView.On().SetIsJavaScriptAlertEnabled(true); - - var javascriptAlertWebSourceContainer = new ViewContainer(Test.WebView.JavaScriptAlert, - jsAlertWebView - ); - - var evaluateJsWebView = new WebView - { - Source = new UrlWebViewSource { Url = "https://www.google.com/" }, - HeightRequest = 50 - }; - var evaluateJsWebViewSourceContainer = new ViewContainer(Test.WebView.EvaluateJavaScript, - evaluateJsWebView - ); - - var resultsLabel = new Label(); - var execButton = new Button(); - execButton.Text = "Evaluate Javascript"; - execButton.Command = new Command(async () => resultsLabel.Text = await evaluateJsWebView.EvaluateJavaScriptAsync( - "var test = function(){ return 'This string came from Javascript!'; }; test();")); - - evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(resultsLabel); - evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(execButton); - - - Add(urlWebViewSourceContainer); - Add(htmlWebViewSourceContainer); - Add(htmlFileWebSourceContainer); - Add(javascriptAlertWebSourceContainer); - Add(evaluateJsWebViewSourceContainer); - } - } -} \ No newline at end of file diff --git a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs deleted file mode 100644 index 71cf9fa85962..000000000000 --- a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs +++ /dev/null @@ -1,149 +0,0 @@ -using Microsoft.Maui.Controls.CustomAttributes; -using Microsoft.Maui.Controls.PlatformConfiguration; -using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; -using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific; -using Microsoft.Maui.Devices; - -using WindowsOS = Microsoft.Maui.Controls.PlatformConfiguration.Windows; - -namespace Microsoft.Maui.Controls.Compatibility.ControlGallery -{ - internal class WkWebViewCoreGalleryPage : CoreGalleryPage - { - protected override bool SupportsFocus - { - get { return false; } - } - - protected override void InitializeElement(WkWebView element) - { - element.HeightRequest = 200; - - element.Source = new UrlWebViewSource { Url = "http://xamarin.com/" }; - } - - protected override void Build(StackLayout stackLayout) - { - base.Build(stackLayout); - - var urlWebViewSourceContainer = new ViewContainer(Test.WebView.UrlWebViewSource, - new WkWebView - { - Source = new UrlWebViewSource { Url = "https://www.google.com/" }, - HeightRequest = 200 - } - ); - - const string html = "" + - "" + - "

I am raw html

"; - - var htmlWebViewSourceContainer = new ViewContainer(Test.WebView.HtmlWebViewSource, - new WkWebView - { - Source = new HtmlWebViewSource { Html = html }, - HeightRequest = 200 - } - ); - - var htmlFileWebSourceContainer = new ViewContainer(Test.WebView.LoadHtml, - new WkWebView - { - Source = new HtmlWebViewSource - { - Html = @" - - - - - -

Xamarin.Forms

-

The CSS and image are loaded from local files!

- -

next page

- -" - }, - HeightRequest = 200 - } - ); - - // NOTE: Currently the ability to programmatically enable/disable mixed content only exists on Android - if (DeviceInfo.Platform == DevicePlatform.Android) - { - var mixedContentTestPage = "https://mixed-content-test.appspot.com/"; - - var mixedContentDisallowedWebView = new WkWebView() { HeightRequest = 1000 }; - mixedContentDisallowedWebView.On().SetMixedContentMode(MixedContentHandling.NeverAllow); - mixedContentDisallowedWebView.Source = new UrlWebViewSource - { - Url = mixedContentTestPage - }; - - var mixedContentAllowedWebView = new WkWebView() { HeightRequest = 1000 }; - mixedContentAllowedWebView.On().SetMixedContentMode(MixedContentHandling.AlwaysAllow); - mixedContentAllowedWebView.Source = new UrlWebViewSource - { - Url = mixedContentTestPage - }; - - var mixedContentDisallowedContainer = new ViewContainer(Test.WebView.MixedContentDisallowed, - mixedContentDisallowedWebView); - var mixedContentAllowedContainer = new ViewContainer(Test.WebView.MixedContentAllowed, - mixedContentAllowedWebView); - - Add(mixedContentDisallowedContainer); - Add(mixedContentAllowedContainer); - } - - - var jsAlertWebView = new WkWebView - { - Source = new HtmlWebViewSource - { - Html = @" - - - - - - - -" - }, - HeightRequest = 200 - }; - - jsAlertWebView.On().SetIsJavaScriptAlertEnabled(true); - - var javascriptAlertWebSourceContainer = new ViewContainer(Test.WebView.JavaScriptAlert, - jsAlertWebView - ); - - var evaluateJsWebView = new WkWebView - { - Source = new UrlWebViewSource { Url = "https://www.google.com/" }, - HeightRequest = 50 - }; - var evaluateJsWebViewSourceContainer = new ViewContainer(Test.WebView.EvaluateJavaScript, - evaluateJsWebView - ); - - var resultsLabel = new Label(); - var execButton = new Button(); - execButton.Text = "Evaluate Javascript"; - execButton.Command = new Command(async () => resultsLabel.Text = await evaluateJsWebView.EvaluateJavaScriptAsync( - "var test = function(){ return 'This string came from Javascript!'; }; test();")); - - evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(resultsLabel); - evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(execButton); - - - Add(urlWebViewSourceContainer); - Add(htmlWebViewSourceContainer); - Add(htmlFileWebSourceContainer); - Add(javascriptAlertWebSourceContainer); - Add(evaluateJsWebViewSourceContainer); - } - } -} \ No newline at end of file diff --git a/src/Compatibility/ControlGallery/src/Core/GalleryPages/MemoryLeakGallery.cs b/src/Compatibility/ControlGallery/src/Core/GalleryPages/MemoryLeakGallery.cs index b15d023ad019..e475f74a23af 100644 --- a/src/Compatibility/ControlGallery/src/Core/GalleryPages/MemoryLeakGallery.cs +++ b/src/Compatibility/ControlGallery/src/Core/GalleryPages/MemoryLeakGallery.cs @@ -97,7 +97,6 @@ public MemoryLeakGallery() MakeButton(nameof(WebView), () => new WebView { BackgroundColor = Colors.Azure, HeightRequest = 50 }), MakeButton(nameof(ProgressBar), () => new ProgressBar { BackgroundColor = Colors.Azure, Progress = 0.5 }), MakeButton(nameof(Picker), () => new Picker { BackgroundColor = Colors.Azure, HeightRequest = 50 }), - MakeButton(nameof(OpenGLView), () => new OpenGLView ()), MakeButton(nameof(SearchBar), () => new SearchBar ()), MakeButton(nameof(Slider), () => new Slider ()), MakeButton(nameof(Stepper), () => new Stepper ()), diff --git a/src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/AdvancedOpenGLGallery.cs b/src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/AdvancedOpenGLGallery.cs deleted file mode 100644 index 5808f14377d1..000000000000 --- a/src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/AdvancedOpenGLGallery.cs +++ /dev/null @@ -1,218 +0,0 @@ -#if HAVE_OPENTK -using System; -using OpenTK; - -#if __WPF__ || __GTK__ || __MACOS__ -using OpenTK.Graphics.OpenGL; -#elif __ANDROID__ || __IOS__ -using OpenTK.Graphics.ES20; -#endif - -using Microsoft.Maui.Graphics; - -namespace Microsoft.Maui.Controls.Compatibility.ControlGallery -{ - public class AdvancedOpenGLGallery : ContentPage - { - private const string VertexShader = @" - uniform mat4 uMVPMatrix; - attribute vec4 vColor; - attribute vec4 vPosition; - varying vec4 color; - void main() - { - color = vColor; - gl_Position = uMVPMatrix * vPosition; - }"; - - private const string FragmentShader = @" - varying lowp vec4 color; - void main (void) - { - gl_FragColor = color; - }"; - - private bool _initGl = false; - private int _viewportWidth; - private int _viewportHeight; - private Vector4[] _vertices; - private Vector4[] _colors; - - private uint _mProgramHandle; - private int _mColorHandle; - private int _mPositionHandle; - private int _mMVPMatrixHandle; - private Matrix4 _mProjectionMatrix; - private Matrix4 _mViewMatrix; - private Matrix4 _mModelViewProjectionMatrix; - - private Microsoft.Maui.Controls.OpenGLView _openGLView = null; - - public AdvancedOpenGLGallery() - { - Title = "Advanced OpenGLView Sample"; - - var titleLabel = new Label - { - Text = "OpenGLView", - FontSize = 36 - }; - - _openGLView = new OpenGLView - { - HeightRequest = 300, - WidthRequest = 300, - HasRenderLoop = true - }; - - _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; - - _vertices = new Vector4[] - { - new Vector4(0.0f, 0.5f, 0.0f, 1.0f), - new Vector4(0.5f, -0.5f, 0.0f, 1.0f), - new Vector4(-0.5f, -0.5f, 0.0f, 1.0f) - }; - - _colors = new Vector4[] - { - new Vector4(1.0f, 0.0f, 0.0f, 1.0f), - new Vector4(0.0f, 1.0f, 0.0f, 1.0f), - new Vector4(0.0f, 0.0f, 1.0f, 1.0f) - }; - - uint vertexShader = CompileShader(VertexShader, ShaderType.VertexShader); - uint fragmentShader = CompileShader(FragmentShader, ShaderType.FragmentShader); - - _mProgramHandle = (uint)GL.CreateProgram(); - if (_mProgramHandle == 0) - throw new InvalidOperationException("Unable to create program"); - - GL.AttachShader(_mProgramHandle, vertexShader); - GL.AttachShader(_mProgramHandle, fragmentShader); - - GL.BindAttribLocation(_mProgramHandle, 0, "vPosition"); - GL.LinkProgram(_mProgramHandle); - - GL.Viewport(0, 0, _viewportWidth, _viewportHeight); - - GL.UseProgram(_mProgramHandle); - - _initGl = true; - } - - public static uint CompileShader(string shaderString, ShaderType shaderType) - { - uint shaderHandle = (uint)GL.CreateShader(shaderType); - GL.ShaderSource((int)shaderHandle, shaderString); - GL.CompileShader(shaderHandle); - - return shaderHandle; - } - - public static void UniformMatrix4(int location, Matrix4 value) - { - GL.UniformMatrix4(location, 1, false, ref value.Row0.X); - } - - void Render() - { - GL.UseProgram(_mProgramHandle); - - GL.ClearColor(0.7f, 0.7f, 0.7f, 1); - GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit); - - float aspectRatio = ((float)Width) / ((float)Height); - float ratio = ((float)_viewportWidth) / ((float)_viewportHeight); - - _mProjectionMatrix = Matrix4.CreateOrthographicOffCenter(-ratio, ratio, -1, 1, 0.1f, 10.0f); - - _mViewMatrix = Matrix4.LookAt(new Vector3(0, 0, 5), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); - - _mModelViewProjectionMatrix = Matrix4.Mult(_mViewMatrix, _mProjectionMatrix); - - Matrix4 mModel = Matrix4.CreateRotationY((float)(Math.PI * 2.0 * ReferenceTime.GetTimeFromReferenceMs() / 5000.0)); - - _mModelViewProjectionMatrix = Matrix4.Mult(_mModelViewProjectionMatrix, mModel); - - _mPositionHandle = GL.GetAttribLocation(_mProgramHandle, "vPosition"); - - _mColorHandle = GL.GetAttribLocation(_mProgramHandle, "vColor"); - - GL.EnableVertexAttribArray(_mPositionHandle); - GL.EnableVertexAttribArray(_mColorHandle); - - unsafe - { - fixed (Vector4* pvertices = _vertices) - { - GL.VertexAttribPointer(_mPositionHandle, Vector4.SizeInBytes / 4, VertexAttribPointerType.Float, false, 0, new IntPtr(pvertices)); - } - - fixed (Vector4* pcolors = _colors) - { - GL.VertexAttribPointer(_mColorHandle, Vector4.SizeInBytes / 4, VertexAttribPointerType.Float, false, 0, new IntPtr(pcolors)); - } - } - - _mMVPMatrixHandle = GL.GetUniformLocation(_mProgramHandle, "uMVPMatrix"); - - UniformMatrix4(_mMVPMatrixHandle, _mModelViewProjectionMatrix); - -#pragma warning disable 0618 - GL.DrawArrays(BeginMode.Triangles, 0, 3); -#pragma warning restore 0618 - GL.Finish(); - GL.DisableVertexAttribArray(_mPositionHandle); - GL.DisableVertexAttribArray(_mColorHandle); - } - } - - 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; - } - } -} -#endif \ No newline at end of file diff --git a/src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/BasicOpenGLGallery.cs b/src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/BasicOpenGLGallery.cs deleted file mode 100644 index a8f792787af1..000000000000 --- a/src/Compatibility/ControlGallery/src/Core/GalleryPages/OpenGLGalleries/BasicOpenGLGallery.cs +++ /dev/null @@ -1,94 +0,0 @@ -#if HAVE_OPENTK -using System; -using OpenTK.Graphics.OpenGL; - -namespace Microsoft.Maui.Controls.Compatibility.ControlGallery -{ - public class BasicOpenGLGallery : ContentPage - { - private bool _initGl = false; - private int _viewportWidth; - private int _viewportHeight; - private uint _mProgramHandle; - private OpenGLView _openGLView = null; - - public BasicOpenGLGallery() - { - Title = "Basic OpenGLView Sample"; - - var titleLabel = new Label - { - Text = "OpenGLView", - FontSize = 36 - }; - - _openGLView = new OpenGLView - { - HeightRequest = 300, - WidthRequest = 300, - HasRenderLoop = true - }; - - _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() - { -#pragma warning disable 0618 - 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); -#pragma warning restore 0618 - - GL.End(); - - GL.Flush(); - } - } -} -#endif \ No newline at end of file diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Helpers/ViewHelper.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Helpers/ViewHelper.cs index f79a9ba4c49a..924bacd9ea7d 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Helpers/ViewHelper.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Helpers/ViewHelper.cs @@ -24,7 +24,6 @@ public static List GetAllViews() new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(typeof(ImageCell)) }, new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(typeof(EntryCell)) }, new ListView { ItemsSource = Enumerable.Range(0,10), ItemTemplate = new DataTemplate(typeof(SwitchCell)) }, - new OpenGLView { }, new Picker { }, new ProgressBar { }, new SearchBar { }, diff --git a/src/Compatibility/ControlGallery/src/Tizen/RegistrarValidationService.cs b/src/Compatibility/ControlGallery/src/Tizen/RegistrarValidationService.cs index 1d029d5eec05..433c9b62f2c7 100644 --- a/src/Compatibility/ControlGallery/src/Tizen/RegistrarValidationService.cs +++ b/src/Compatibility/ControlGallery/src/Tizen/RegistrarValidationService.cs @@ -13,7 +13,7 @@ public bool Validate(VisualElement element, out string message) { message = "Success"; - if (element == null || element is OpenGLView) + if (element == null) return true; var renderer = Platform.Tizen.Platform.GetOrCreateRenderer(element); diff --git a/src/Compatibility/ControlGallery/src/UITests.Shared/PlatformQueries.cs b/src/Compatibility/ControlGallery/src/UITests.Shared/PlatformQueries.cs index e2ec706546eb..ad4493df7216 100644 --- a/src/Compatibility/ControlGallery/src/UITests.Shared/PlatformQueries.cs +++ b/src/Compatibility/ControlGallery/src/UITests.Shared/PlatformQueries.cs @@ -72,7 +72,6 @@ internal static class PlatformViews public static readonly string Label = "UILabel"; public static readonly string ListView = "UITableView"; public static readonly string Map = "MKMapView"; - public static readonly string OpenGLView = "GLKView"; public static readonly string Picker = "UITextField"; public static readonly string Pin = "MKPinAnnotationView"; public static readonly string ProgressBar = "UIProgressView"; @@ -98,7 +97,6 @@ internal static class PlatformViews public static readonly string Label = "android.widget.TextView"; public static readonly string ListView = "android.widget.ListView"; public static readonly string Map = "android.gms.maps.GoogleMap"; - public static readonly string OpenGLView = "android.widget.GLSurfaceView"; public static readonly string Picker = "android.widget.EditText"; public static readonly string Pin = "android.gms.maps.model.Marker"; public static readonly string ProgressBar = "android.widget.ProgressBar"; diff --git a/src/Compatibility/ControlGallery/src/UITests.Shared/Queries.cs b/src/Compatibility/ControlGallery/src/UITests.Shared/Queries.cs index 5d488eb216ac..a9c24c9cefda 100644 --- a/src/Compatibility/ControlGallery/src/UITests.Shared/Queries.cs +++ b/src/Compatibility/ControlGallery/src/UITests.Shared/Queries.cs @@ -30,7 +30,6 @@ internal static class GalleryQueries public const string ImageButtonGallery = "* marked:'Image Button Gallery'"; public const string LabelGallery = "* marked:'Label Gallery'"; public const string ListViewGallery = "* marked:'ListView Gallery'"; - public const string OpenGLViewGallery = "* marked:'OpenGLView Gallery'"; public const string PickerGallery = "* marked:'Picker Gallery'"; public const string ProgressBarGallery = "* marked:'ProgressBar Gallery'"; public const string RadioButtonGallery = "* marked:'RadioButton Core Gallery'"; @@ -94,7 +93,6 @@ internal static class Views public static readonly string Label = PlatformViews.Label; public static readonly string ListView = PlatformViews.ListView; public static readonly string Map = PlatformViews.Map; - public static readonly string OpenGLView = PlatformViews.OpenGLView; public static readonly string Picker = PlatformViews.Picker; public static readonly string Pin = PlatformViews.Pin; public static readonly string ProgressBar = PlatformViews.ProgressBar; diff --git a/src/Compatibility/ControlGallery/src/WinUI/RegistrarValidationService.cs b/src/Compatibility/ControlGallery/src/WinUI/RegistrarValidationService.cs index ddd9a940d6e7..2f0620811662 100644 --- a/src/Compatibility/ControlGallery/src/WinUI/RegistrarValidationService.cs +++ b/src/Compatibility/ControlGallery/src/WinUI/RegistrarValidationService.cs @@ -13,7 +13,7 @@ public bool Validate(VisualElement element, out string message) { message = "Success"; - if (element == null || element is OpenGLView) + if (element == null) return true; #pragma warning disable CS0612 // Type or member is obsolete diff --git a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/PlatformSpecificCoreGalleryFactory.cs b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/PlatformSpecificCoreGalleryFactory.cs index 818aae56820c..8ce8f4fbab86 100644 --- a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/PlatformSpecificCoreGalleryFactory.cs +++ b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/PlatformSpecificCoreGalleryFactory.cs @@ -14,12 +14,7 @@ public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFa 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/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj index 212b639a303f..3e68e6b06902 100644 --- a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj +++ b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.GTK/Xamarin.Forms.ControlGallery.GTK.csproj @@ -89,12 +89,6 @@
- - GalleryPages\AdvancedOpenGLGallery.cs - - - GalleryPages\BasicOpenGLGallery.cs - diff --git a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/PlatformSpecificCoreGalleryFactory.cs b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/PlatformSpecificCoreGalleryFactory.cs index a1b39e9d59fb..0bfe0e7996c1 100644 --- a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/PlatformSpecificCoreGalleryFactory.cs +++ b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/PlatformSpecificCoreGalleryFactory.cs @@ -14,12 +14,7 @@ public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFa 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/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj index ab0ffbc09e6d..5c7589714645 100644 --- a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj +++ b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.MacOS/Xamarin.Forms.ControlGallery.MacOS.csproj @@ -104,12 +104,6 @@ - - GalleryPages\AdvancedOpenGLGallery.cs - - - GalleryPages\BasicOpenGLGallery.cs - diff --git a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/PlatformSpecificCoreGalleryFactory.cs b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/PlatformSpecificCoreGalleryFactory.cs index 333acc2bd177..e900eb93a927 100644 --- a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/PlatformSpecificCoreGalleryFactory.cs +++ b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/PlatformSpecificCoreGalleryFactory.cs @@ -14,12 +14,7 @@ public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFa 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/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/RegistrarValidationService.cs b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/RegistrarValidationService.cs index 464164719077..e976feb673a1 100644 --- a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/RegistrarValidationService.cs +++ b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/RegistrarValidationService.cs @@ -12,7 +12,7 @@ public bool Validate(VisualElement element, out string message) { message = "Success"; - if (element == null || element is OpenGLView) + if (element == null) return true; var renderer = Platform.WPF.Platform.GetOrCreateRenderer(element); diff --git a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj index e88efd4e20a9..df3b2c2cc2e5 100644 --- a/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj +++ b/src/Compatibility/ControlGallery/src/Xamarin.Forms.ControlGallery.WPF/Xamarin.Forms.ControlGallery.WPF.csproj @@ -42,12 +42,6 @@ - - GalleryPages\AdvancedOpenGLGallery.cs - - - GalleryPages\BasicOpenGLGallery.cs - diff --git a/src/Compatibility/ControlGallery/src/iOS/Compatibility.ControlGallery.iOS.csproj b/src/Compatibility/ControlGallery/src/iOS/Compatibility.ControlGallery.iOS.csproj index 9596c55b7a69..3c73eca148a5 100644 --- a/src/Compatibility/ControlGallery/src/iOS/Compatibility.ControlGallery.iOS.csproj +++ b/src/Compatibility/ControlGallery/src/iOS/Compatibility.ControlGallery.iOS.csproj @@ -35,10 +35,6 @@ - - - - diff --git a/src/Compatibility/ControlGallery/src/iOS/PlatformSpecificCoreGalleryFactory.cs b/src/Compatibility/ControlGallery/src/iOS/PlatformSpecificCoreGalleryFactory.cs index a0fc10b98716..ac5ffc8f5167 100644 --- a/src/Compatibility/ControlGallery/src/iOS/PlatformSpecificCoreGalleryFactory.cs +++ b/src/Compatibility/ControlGallery/src/iOS/PlatformSpecificCoreGalleryFactory.cs @@ -16,11 +16,7 @@ public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFa 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/src/Compatibility/Core/src/Android/Renderers/OpenGLViewRenderer.cs b/src/Compatibility/Core/src/Android/Renderers/OpenGLViewRenderer.cs deleted file mode 100644 index 9ce5f95d6743..000000000000 --- a/src/Compatibility/Core/src/Android/Renderers/OpenGLViewRenderer.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.ComponentModel; -using Android.Content; -using Android.Opengl; -using Javax.Microedition.Khronos.Opengles; -using Microsoft.Maui.Controls.Platform; -using Microsoft.Maui.Graphics; -using EGLConfig = Javax.Microedition.Khronos.Egl.EGLConfig; -using Object = Java.Lang.Object; - -namespace Microsoft.Maui.Controls.Compatibility.Platform.Android -{ - [Obsolete] - internal class OpenGLViewRenderer : ViewRenderer - { - bool _disposed; - - public OpenGLViewRenderer(Context context) : base(context) - { - AutoPackage = false; - } - - protected override void Dispose(bool disposing) - { - if (!_disposed && disposing) - { - _disposed = true; - - if (Element != null) - ((IOpenGlViewController)Element).DisplayRequested -= Render; - } - base.Dispose(disposing); - } - - protected override GLSurfaceView CreateNativeControl() - { - return new GLSurfaceView(Context); - } - - protected override void OnElementChanged(ElementChangedEventArgs e) - { - base.OnElementChanged(e); - - if (e.OldElement != null) - ((IOpenGlViewController)Element).DisplayRequested -= Render; - - if (e.NewElement != null) - { - GLSurfaceView surfaceView = Control; - if (surfaceView == null) - { - surfaceView = CreateNativeControl(); - surfaceView.SetEGLContextClientVersion(2); - SetNativeControl(surfaceView); - } - - ((IOpenGlViewController)Element).DisplayRequested += Render; - surfaceView.SetRenderer(new Renderer(Element)); - SetRenderMode(); - } - } - - protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) - { - base.OnElementPropertyChanged(sender, e); - - if (e.PropertyName == OpenGLView.HasRenderLoopProperty.PropertyName) - SetRenderMode(); - } - - void Render(object sender, EventArgs eventArgs) - { - if (Element.HasRenderLoop) - return; - Control.RequestRender(); - } - - void SetRenderMode() - { - Control.RenderMode = Element.HasRenderLoop ? Rendermode.Continuously : Rendermode.WhenDirty; - } - - class Renderer : Object, GLSurfaceView.IRenderer - { - readonly OpenGLView _model; - Rect _rect; - - public Renderer(OpenGLView model) - { - _model = model; - } - - public void OnDrawFrame(IGL10 gl) - { - Action onDisplay = _model.OnDisplay; - if (onDisplay == null) - return; - onDisplay(_rect); - } - - public void OnSurfaceChanged(IGL10 gl, int width, int height) - { - _rect = new Rect(0.0, 0.0, width, height); - } - - public void OnSurfaceCreated(IGL10 gl, EGLConfig config) - { - } - } - } -} \ No newline at end of file diff --git a/src/Compatibility/Core/src/AppHostBuilderExtensions.cs b/src/Compatibility/Core/src/AppHostBuilderExtensions.cs index 0604c85e3165..a425c83983b6 100644 --- a/src/Compatibility/Core/src/AppHostBuilderExtensions.cs +++ b/src/Compatibility/Core/src/AppHostBuilderExtensions.cs @@ -36,7 +36,6 @@ #elif TIZEN using Microsoft.Maui.Controls.Compatibility.Platform.Tizen; using Microsoft.Maui.Graphics.Skia; -using OpenGLViewRenderer = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.DefaultRenderer; using StreamImagesourceHandler = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.StreamImageSourceHandler; using ImageLoaderSourceHandler = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.UriImageSourceHandler; using DefaultRenderer = Microsoft.Maui.Controls.Compatibility.Platform.Tizen.DefaultRenderer; @@ -77,11 +76,6 @@ public static MauiAppBuilder UseMauiCompatibility(this MauiAppBuilder builder) #if !WINDOWS #if !(MACCATALYST || MACOS) -#pragma warning disable CS0618 // Type or member is obsolete -#pragma warning disable CS0612 // Type or member is obsolete - handlers.TryAddCompatibilityRenderer(typeof(OpenGLView), typeof(OpenGLViewRenderer)); -#pragma warning restore CS0612 // Type or member is obsolete -#pragma warning restore CS0618 // Type or member is obsolete #endif #else #pragma warning disable CS0618 // Type or member is obsolete diff --git a/src/Compatibility/Core/src/GTK/Compatibility.GTK.csproj b/src/Compatibility/Core/src/GTK/Compatibility.GTK.csproj index 4175f802f74d..91693d8ab489 100644 --- a/src/Compatibility/Core/src/GTK/Compatibility.GTK.csproj +++ b/src/Compatibility/Core/src/GTK/Compatibility.GTK.csproj @@ -129,7 +129,6 @@ - @@ -197,7 +196,6 @@ - diff --git a/src/Compatibility/Core/src/GTK/Controls/OpenGLView.cs b/src/Compatibility/Core/src/GTK/Controls/OpenGLView.cs deleted file mode 100644 index ae39a222d3ca..000000000000 --- a/src/Compatibility/Core/src/GTK/Controls/OpenGLView.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using Gtk; -using OpenTK.GLWidget; -using OpenTK.Graphics; - -namespace Microsoft.Maui.Controls.Compatibility.Platform.GTK.Controls -{ - public class OpenGLView : EventBox - { - private GLWidget _glWidget; - - private Action _action; - private bool _hasLoop; - protected uint _timerId; - - public OpenGLView() - { - if (!GtkOpenGL.IsInitialized) - throw new InvalidOperationException("call GtkOpenGL.Init() before use OpenGLView"); - - GraphicsMode graphicsMode = GraphicsMode.Default; - - _glWidget = new GLWidget(GraphicsMode.Default); - - _glWidget.SingleBuffer = true; - _glWidget.ColorBPP = graphicsMode.ColorFormat.BitsPerPixel; - _glWidget.AccumulatorBPP = graphicsMode.AccumulatorFormat.BitsPerPixel; - _glWidget.DepthBPP = graphicsMode.Depth; - _glWidget.Samples = graphicsMode.Samples; - _glWidget.StencilBPP = graphicsMode.Stencil; - _glWidget.Stereo = graphicsMode.Stereo; - _glWidget.GlVersionMajor = 2; - _glWidget.GlVersionMinor = 1; - _glWidget.CanFocus = true; - _glWidget.GraphicsContextFlags = GraphicsContextFlags.Default; - - _glWidget.Initialized += new EventHandler(OnGLWidgetInitialized); - _glWidget.RenderFrame += new EventHandler(OnGLWidgetRenderer); - _glWidget.Destroyed += new EventHandler(OnGLWidgetDestroy); - - _glWidget.AddEvents((int)Gdk.EventMask.AllEventsMask); - - Add(_glWidget); - - _glWidget.ShowAll(); - } - - public Action OnDisplay - { - get { return _action; } - set { _action = value; } - } - - public bool HasRenderLoop - { - get { return _hasLoop; } - set { _hasLoop = value; } - } - - protected void OnGLWidgetInitialized(object sender, EventArgs e) - { - _timerId = GLib.Timeout.Add(16, new GLib.TimeoutHandler(Render)); - } - - protected void OnGLWidgetRenderer(object sender, EventArgs e) - { - _timerId = GLib.Timeout.Add(16, new GLib.TimeoutHandler(Render)); - } - - protected void OnGLWidgetDestroy(object sender, EventArgs e) - { - GLib.Source.Remove(_timerId); - } - - public override void Destroy() - { - base.Destroy(); - - if (_glWidget != null) - { - _glWidget.Destroy(); - } - } - - private bool Render() - { - if (!HasRenderLoop) - { - return false; - } - else - { - OnDisplay(new Rectangle(0, 0, WidthRequest, HeightRequest)); - - return true; - } - } - } -} diff --git a/src/Compatibility/Core/src/GTK/Properties/AssemblyInfo.cs b/src/Compatibility/Core/src/GTK/Properties/AssemblyInfo.cs index a6aeaa384cb1..98b31b3afbee 100644 --- a/src/Compatibility/Core/src/GTK/Properties/AssemblyInfo.cs +++ b/src/Compatibility/Core/src/GTK/Properties/AssemblyInfo.cs @@ -28,7 +28,6 @@ #pragma warning restore CS0618 // Type or member is obsolete [assembly: ExportRenderer(typeof(FlyoutPage), typeof(FlyoutPageRenderer))] [assembly: ExportRenderer(typeof(NavigationPage), typeof(NavigationPageRenderer))] -[assembly: ExportRenderer(typeof(OpenGLView), typeof(OpenGLViewRenderer))] [assembly: ExportRenderer(typeof(Page), typeof(PageRenderer))] [assembly: ExportRenderer(typeof(Picker), typeof(PickerRenderer))] [assembly: ExportRenderer(typeof(ProgressBar), typeof(ProgressBarRenderer))] diff --git a/src/Compatibility/Core/src/GTK/Renderers/OpenGLViewRenderer.cs b/src/Compatibility/Core/src/GTK/Renderers/OpenGLViewRenderer.cs deleted file mode 100644 index ba030bbaa6bc..000000000000 --- a/src/Compatibility/Core/src/GTK/Renderers/OpenGLViewRenderer.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Microsoft.Maui.Controls.Compatibility.Platform.GTK.Renderers -{ - public class OpenGLViewRenderer : ViewRenderer - { - private Controls.OpenGLView _openGlView; - private bool _disposed; - - protected override void Dispose(bool disposing) - { - if (!_disposed && disposing) - { - _disposed = true; - - if (Element != null) - ((IOpenGlViewController)Element).DisplayRequested -= OnDisplay; - } - - base.Dispose(disposing); - } - - protected override void OnElementChanged(ElementChangedEventArgs e) - { - if (e.OldElement != null) - ((IOpenGlViewController)e.OldElement).DisplayRequested -= OnDisplay; - - if (e.NewElement != null) - { - // The Open Toolkit library is a low-level C# binding for OpenGL, OpenGL ES and OpenAL. - // Runs on Linux, macOS and Windows with GTK# (and more platforms). - _openGlView = new Controls.OpenGLView(); - SetNativeControl(_openGlView); - - ((IOpenGlViewController)e.NewElement).DisplayRequested += OnDisplay; - - SetRenderMode(); - SetupRenderAction(); - } - - base.OnElementChanged(e); - } - - protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) - { - base.OnElementPropertyChanged(sender, e); - - if (e.PropertyName == OpenGLView.HasRenderLoopProperty.PropertyName) - { - SetRenderMode(); - SetupRenderAction(); - } - } - - public void OnDisplay(object sender, EventArgs eventArgs) - { - if (Element.HasRenderLoop) - return; - - SetupRenderAction(); - } - - private void SetRenderMode() - { - Control.HasRenderLoop = Element.HasRenderLoop; - } - - private void SetupRenderAction() - { - if (!Element.HasRenderLoop) - return; - - var model = Element; - var onDisplay = model.OnDisplay; - - if (_openGlView != null) - { - _openGlView.OnDisplay = onDisplay; - } - } - } -} diff --git a/src/Compatibility/Core/src/MacOS/Compatibility.macOS.csproj b/src/Compatibility/Core/src/MacOS/Compatibility.macOS.csproj index 002a434d93a1..458ca5871531 100644 --- a/src/Compatibility/Core/src/MacOS/Compatibility.macOS.csproj +++ b/src/Compatibility/Core/src/MacOS/Compatibility.macOS.csproj @@ -131,8 +131,6 @@ - - diff --git a/src/Compatibility/Core/src/MacOS/Controls/MacOSOpenGLView.cs b/src/Compatibility/Core/src/MacOS/Controls/MacOSOpenGLView.cs deleted file mode 100644 index 47634acd5cd0..000000000000 --- a/src/Compatibility/Core/src/MacOS/Controls/MacOSOpenGLView.cs +++ /dev/null @@ -1,12 +0,0 @@ -using AppKit; - -namespace Microsoft.Maui.Controls.Compatibility.Platform.MacOS -{ - //TODO: Still not implemented on macOS - public class MacOSOpenGLView : NSView - { - public MacOSOpenGLView() - { - } - } -} \ No newline at end of file diff --git a/src/Compatibility/Core/src/MacOS/Properties/AssemblyInfo.cs b/src/Compatibility/Core/src/MacOS/Properties/AssemblyInfo.cs index e842345ef5de..300b18a9f65e 100644 --- a/src/Compatibility/Core/src/MacOS/Properties/AssemblyInfo.cs +++ b/src/Compatibility/Core/src/MacOS/Properties/AssemblyInfo.cs @@ -33,7 +33,6 @@ [assembly: ExportRenderer(typeof(Entry), typeof(EntryRenderer))] [assembly: ExportRenderer(typeof(Frame), typeof(FrameRenderer))] [assembly: ExportRenderer(typeof(Image), typeof(ImageRenderer))] -[assembly: ExportRenderer(typeof(OpenGLView), typeof(OpenGLViewRenderer))] [assembly: ExportRenderer(typeof(Picker), typeof(PickerRenderer))] [assembly: ExportRenderer(typeof(ProgressBar), typeof(ProgressBarRenderer))] [assembly: ExportRenderer(typeof(SearchBar), typeof(SearchBarRenderer))] diff --git a/src/Compatibility/Core/src/MacOS/Renderers/OpenGLViewRenderer.cs b/src/Compatibility/Core/src/MacOS/Renderers/OpenGLViewRenderer.cs deleted file mode 100644 index 86a7458f4945..000000000000 --- a/src/Compatibility/Core/src/MacOS/Renderers/OpenGLViewRenderer.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.ComponentModel; -using CoreVideo; - -namespace Microsoft.Maui.Controls.Compatibility.Platform.MacOS -{ - // ReSharper disable once InconsistentNaming - internal class OpenGLViewRenderer : ViewRenderer - { - CVDisplayLink _displayLink; - - public void Display(object sender, EventArgs eventArgs) - { - if (Element.HasRenderLoop) - return; - SetupRenderLoop(true); - } - - protected override void Dispose(bool disposing) - { - if (_displayLink != null) - { - _displayLink.Dispose(); - _displayLink = null; - - if (Element != null) - Element.DisplayRequested -= Display; - } - - base.Dispose(disposing); - } - - protected override void OnElementChanged(ElementChangedEventArgs e) - { - if (e.OldElement != null) - e.OldElement.DisplayRequested -= Display; - - if (e.NewElement != null) - { - //var context = new EAGLContext(EAGLRenderingAPI.OpenGLES2); - //var glkView = new GLKView(RectangleF.Empty) { Context = context, DrawableDepthFormat = GLKViewDrawableDepthFormat.Format24, Delegate = new Delegate(e.NewElement) }; - var glkView = new MacOSOpenGLView(); - SetNativeControl(glkView); - - e.NewElement.DisplayRequested += Display; - - SetupRenderLoop(false); - } - - base.OnElementChanged(e); - } - - protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) - { - base.OnElementPropertyChanged(sender, e); - - if (e.PropertyName == OpenGLView.HasRenderLoopProperty.PropertyName) - SetupRenderLoop(false); - } - - void SetupRenderLoop(bool oneShot) - { - if (_displayLink != null) - return; - if (!oneShot && !Element.HasRenderLoop) - return; - - _displayLink = new CVDisplayLink(); - - //.Create(() => - //{ - // var control = Control; - // var model = Element; - // if (control != null) - // control.Display(); - // if (control == null || model == null || !model.HasRenderLoop) - // { - // _displayLink.Invalidate(); - // _displayLink.Dispose(); - // _displayLink = null; - // } - //}); - //_displayLink.(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); - } - - //class Delegate : GLKViewDelegate - //{ - // readonly OpenGLView _model; - - // public Delegate(OpenGLView model) - // { - // _model = model; - // } - - // public override void DrawInRect(GLKView view, RectangleF rect) - // { - // var onDisplay = _model.OnDisplay; - // if (onDisplay == null) - // return; - // onDisplay(rect.ToRectangle()); - // } - //} - } -} \ No newline at end of file diff --git a/src/Compatibility/Core/src/WPF/Properties/AssemblyInfo.cs b/src/Compatibility/Core/src/WPF/Properties/AssemblyInfo.cs index f4118d8b322b..7e336e347ee7 100644 --- a/src/Compatibility/Core/src/WPF/Properties/AssemblyInfo.cs +++ b/src/Compatibility/Core/src/WPF/Properties/AssemblyInfo.cs @@ -32,7 +32,6 @@ [assembly: ExportRenderer(typeof(ActivityIndicator), typeof(ActivityIndicatorRenderer))] [assembly: ExportRenderer(typeof(Frame), typeof(FrameRenderer))] [assembly: ExportRenderer(typeof(ListView), typeof(ListViewRenderer))] -[assembly: ExportRenderer(typeof(OpenGLView), typeof(OpenGLViewRenderer))] [assembly: ExportRenderer(typeof(ImageButton), typeof(ImageButtonRenderer))] [assembly: ExportRenderer(typeof(EmbeddedFont), typeof(EmbeddedFontLoader))] [assembly: ExportRenderer(typeof(Path), typeof(PathRenderer))] diff --git a/src/Compatibility/Core/src/WPF/Renderers/OpenGLViewRenderer.cs b/src/Compatibility/Core/src/WPF/Renderers/OpenGLViewRenderer.cs deleted file mode 100644 index d65b6d66f138..000000000000 --- a/src/Compatibility/Core/src/WPF/Renderers/OpenGLViewRenderer.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using System.Windows.Forms.Integration; -using System.Windows.Threading; -using OpenTK; -using OpenTK.Graphics; - -namespace Microsoft.Maui.Controls.Compatibility.Platform.WPF -{ - public class OpenGLViewRenderer : ViewRenderer - { - private GLControl _glControl; - private DispatcherTimer _timer; - private Action _action; - private bool _hasRenderLoop; - private bool _disposed; - - public Action Action - { - get { return _action; } - set { _action = value; } - } - - public bool HasRenderLoop - { - get { return _hasRenderLoop; } - set { _hasRenderLoop = value; } - } - - protected override void Dispose(bool disposing) - { - if (!_disposed && disposing) - { - _disposed = true; - - if (Element != null) - ((IOpenGlViewController)Element).DisplayRequested -= Render; - - if (_glControl != null) - _glControl.Paint -= OnPaint; - - if (_timer != null) - _timer.Tick -= OnTick; - } - - base.Dispose(disposing); - } - - protected override void OnElementChanged(ElementChangedEventArgs e) - { - if (e.OldElement != null) - ((IOpenGlViewController)e.OldElement).DisplayRequested -= Render; - - if (e.NewElement != null) - { - var windowsFormsHost = new WindowsFormsHost(); - _glControl = new GLControl(new GraphicsMode(32, 24), 2, 0, GraphicsContextFlags.Default); - _glControl.MakeCurrent(); - _glControl.Dock = DockStyle.Fill; - - _glControl.Paint += OnPaint; - - windowsFormsHost.Child = _glControl; - SetNativeControl(windowsFormsHost); - - _timer = new DispatcherTimer(); - _timer.Interval = TimeSpan.FromMilliseconds(16); - _timer.Tick += OnTick; - _timer.Start(); - - ((IOpenGlViewController)e.NewElement).DisplayRequested += Render; - - SetRenderMode(); - SetupRenderAction(); - } - - base.OnElementChanged(e); - } - - protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) - { - base.OnElementPropertyChanged(sender, e); - - if (e.PropertyName == OpenGLView.HasRenderLoopProperty.PropertyName) - { - SetRenderMode(); - SetupRenderAction(); - } - } - - public void Render(object sender, EventArgs eventArgs) - { - if (HasRenderLoop) - return; - - SetupRenderAction(); - } - - private void SetRenderMode() - { - HasRenderLoop = Element.HasRenderLoop; - } - - private void SetupRenderAction() - { - var model = Element; - var onDisplay = model.OnDisplay; - - Action = onDisplay; - } - - private void OnPaint(object sender, PaintEventArgs e) - { - if (_glControl == null) - { - return; - } - - _glControl.MakeCurrent(); - Action.Invoke(new Rectangle(0, 0, _glControl.Width, _glControl.Height)); - _glControl.SwapBuffers(); - } - - private void OnTick(object sender, EventArgs e) - { - if (!HasRenderLoop) - return; - - _glControl.Invalidate(); - } - } -} \ No newline at end of file diff --git a/src/Compatibility/Core/src/iOS/Renderers/OpenGLViewRenderer.cs b/src/Compatibility/Core/src/iOS/Renderers/OpenGLViewRenderer.cs deleted file mode 100644 index d667cd1c2aa8..000000000000 --- a/src/Compatibility/Core/src/iOS/Renderers/OpenGLViewRenderer.cs +++ /dev/null @@ -1,123 +0,0 @@ -#if !(MACCATALYST || MACOS) -using System; -using System.ComponentModel; -using System.Runtime.Versioning; -using CoreAnimation; -using Foundation; -using GLKit; -using Microsoft.Maui.Controls.Platform; -using OpenGLES; -using RectangleF = CoreGraphics.CGRect; - -namespace Microsoft.Maui.Controls.Compatibility.Platform.iOS -{ - [System.Obsolete] - [UnsupportedOSPlatform("ios12.0")] - [UnsupportedOSPlatform("tvos12.0")] - internal class OpenGLViewRenderer : ViewRenderer - { - CADisplayLink _displayLink; - - [Microsoft.Maui.Controls.Internals.Preserve(Conditional = true)] - public OpenGLViewRenderer() - { - - } - - public void Display(object sender, EventArgs eventArgs) - { - if (Element.HasRenderLoop) - return; - SetupRenderLoop(true); - } - - protected override void Dispose(bool disposing) - { - if (_displayLink != null) - { - _displayLink.Invalidate(); - _displayLink.Dispose(); - _displayLink = null; - - if (Element != null) - Element.DisplayRequested -= Display; - } - - base.Dispose(disposing); - } - - protected override void OnElementChanged(ElementChangedEventArgs e) - { - if (e.OldElement != null) - e.OldElement.DisplayRequested -= Display; - - if (e.NewElement != null) - { - var context = new EAGLContext(EAGLRenderingAPI.OpenGLES2); - var glkView = new GLKView(RectangleF.Empty) - { - Context = context, - DrawableDepthFormat = GLKViewDrawableDepthFormat.Format24, - Delegate = new Delegate(e.NewElement) - }; - SetNativeControl(glkView); - - e.NewElement.DisplayRequested += Display; - - SetupRenderLoop(false); - } - - base.OnElementChanged(e); - } - - protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) - { - base.OnElementPropertyChanged(sender, e); - - if (e.PropertyName == OpenGLView.HasRenderLoopProperty.PropertyName) - SetupRenderLoop(false); - } - - void SetupRenderLoop(bool oneShot) - { - if (_displayLink != null) - return; - if (!oneShot && !Element.HasRenderLoop) - return; - - _displayLink = CADisplayLink.Create(() => - { - var control = Control; - var model = Element; - if (control != null) - control.Display(); - if (control == null || model == null || !model.HasRenderLoop) - { - _displayLink?.Invalidate(); - _displayLink?.Dispose(); - _displayLink = null; - } - }); - _displayLink.AddToRunLoop(NSRunLoop.Current, NSRunLoopMode.Common); - } - - class Delegate : GLKViewDelegate, IGLKViewDelegate - { - readonly OpenGLView _model; - - public Delegate(OpenGLView model) - { - _model = model; - } - - public override void DrawInRect(GLKView view, RectangleF rect) - { - var onDisplay = _model.OnDisplay; - if (onDisplay == null) - return; - onDisplay(rect.ToRectangle()); - } - } - } -} -#endif \ No newline at end of file diff --git a/src/Controls/docs/Microsoft.Maui.Controls/OpenGLView.xml b/src/Controls/docs/Microsoft.Maui.Controls/OpenGLView.xml deleted file mode 100644 index 417a4d53bf3b..000000000000 --- a/src/Controls/docs/Microsoft.Maui.Controls/OpenGLView.xml +++ /dev/null @@ -1,314 +0,0 @@ - - - - - - - Microsoft.Maui.Controls.Core - 0.0.0.0 - 1.0.0.0 - 1.1.0.0 - 1.2.0.0 - 1.3.0.0 - 1.4.0.0 - 1.5.0.0 - 2.0.0.0 - - - Microsoft.Maui.Controls.View - - - - Microsoft.Maui.Controls.IElementConfiguration<Microsoft.Maui.Controls.OpenGLView> - - - Microsoft.Maui.Controls.IElementController - - - Microsoft.Maui.Controls.IOpenGlViewController - - - Microsoft.Maui.Controls.IViewController - - - Microsoft.Maui.Controls.IVisualElementController - - - - - Microsoft.Maui.Controls.RenderWith(typeof(Microsoft.Maui.Controls.Platform._OpenGLViewRenderer)) - - - - A that displays OpenGL content. - - - s are easiest to program using Shared Projects, in which case the reference to OpenTK is straightforward. The following example shows a simple OpenGL app with a render loop: - - { - - 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.Clicked += (s, a) => view.Display (); - - var stack = new StackLayout { - Padding = new Size (20, 20), - Children = {view, toggle, button} - }; - - Content = stack; - } - } -} - - ]]> - - - - - - - - - - - - Constructor - - 0.0.0.0 - 1.0.0.0 - 1.1.0.0 - 1.2.0.0 - 1.3.0.0 - 1.4.0.0 - 1.5.0.0 - 2.0.0.0 - Microsoft.Maui.Controls.Core - - - - Creates a new object with default values. - To be added. - - - - - - - - Method - - 0.0.0.0 - 1.0.0.0 - 1.1.0.0 - 1.2.0.0 - 1.3.0.0 - 1.4.0.0 - 1.5.0.0 - 2.0.0.0 - Microsoft.Maui.Controls.Core - - - System.Void - - - - Called prior to rendering. - To be added. - - - - - - - - Event - - E:Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested - - - 0.0.0.0 - 2.0.0.0 - Microsoft.Maui.Controls.Core - - - - System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) - - - - System.EventHandler - - - For internal use by the Microsoft.Maui.Controls platform. - To be added. - - - - - - - - Property - - 0.0.0.0 - 1.0.0.0 - 1.1.0.0 - 1.2.0.0 - 1.3.0.0 - 1.4.0.0 - 1.5.0.0 - 2.0.0.0 - Microsoft.Maui.Controls.Core - - - System.Boolean - - - Whether this has a custom rendering loop. - To be added. - To be added. - - - - - - - - Field - - 0.0.0.0 - 1.0.0.0 - 1.1.0.0 - 1.2.0.0 - 1.3.0.0 - 1.4.0.0 - 1.5.0.0 - 2.0.0.0 - Microsoft.Maui.Controls.Core - - - Microsoft.Maui.Controls.BindableProperty - - - Identifies the bindable property. - To be added. - - - - - - - - Method - - M:Microsoft.Maui.Controls.IElementConfiguration`1.On``1 - - - 0.0.0.0 - 2.0.0.0 - Microsoft.Maui.Controls.Core - - - Microsoft.Maui.Controls.IPlatformElementConfiguration<T,Microsoft.Maui.Controls.OpenGLView> - - - - - Microsoft.Maui.Controls.IConfigPlatform - - - - - - To be added. - Returns the platform-specific instance of this , on which a platform-specific method may be called. - To be added. - To be added. - - - - - - - - Property - - 0.0.0.0 - 1.0.0.0 - 1.1.0.0 - 1.2.0.0 - 1.3.0.0 - 1.4.0.0 - 1.5.0.0 - 2.0.0.0 - Microsoft.Maui.Controls.Core - - - System.Action<Microsoft.Maui.Controls.Shapes.Rectangle> - - - Overridden to create a custom rendering loop. - To be added. - - When overridden, creates a custom renderer: - - { - - 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; - }; - ]]> - - - - - - diff --git a/src/Controls/src/Core/IOpenGlViewController.cs b/src/Controls/src/Core/IOpenGlViewController.cs deleted file mode 100644 index 8ac7988436ec..000000000000 --- a/src/Controls/src/Core/IOpenGlViewController.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace Microsoft.Maui.Controls -{ - public interface IOpenGlViewController : IViewController - { - event EventHandler DisplayRequested; - } -} \ No newline at end of file diff --git a/src/Controls/src/Core/OpenGLView.cs b/src/Controls/src/Core/OpenGLView.cs deleted file mode 100644 index aef1f2201294..000000000000 --- a/src/Controls/src/Core/OpenGLView.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.ComponentModel; -using Microsoft.Maui.Graphics; - -namespace Microsoft.Maui.Controls -{ - /// - [Obsolete("OpenGLView is obsolete as of .NET 7. To enable this view you will need to call `builder.UseMauiCompatibility` but it is currently untested and unsupported.")] - public sealed class OpenGLView : View, IOpenGlViewController, IElementConfiguration - { - #region Statics - - /// - public static readonly BindableProperty HasRenderLoopProperty = BindableProperty.Create("HasRenderLoop", typeof(bool), typeof(OpenGLView), default(bool)); - - readonly Lazy> _platformConfigurationRegistry; - - #endregion - - /// - public bool HasRenderLoop - { - get { return (bool)GetValue(HasRenderLoopProperty); } - set { SetValue(HasRenderLoopProperty, value); } - } - - /// - public Action OnDisplay { get; set; } - - /// - public void Display() - => DisplayRequested?.Invoke(this, EventArgs.Empty); - - [EditorBrowsable(EditorBrowsableState.Never)] - public event EventHandler DisplayRequested; - - /// - public OpenGLView() - { - _platformConfigurationRegistry = new Lazy>(() => new PlatformConfigurationRegistry(this)); - } - - /// - public IPlatformElementConfiguration On() where T : IConfigPlatform - { - return _platformConfigurationRegistry.Value.On(); - } - } -} \ No newline at end of file diff --git a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Shipped.txt b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Shipped.txt index 882898f18662..53c958660235 100644 --- a/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Shipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Shipped.txt @@ -1227,9 +1227,6 @@ ~Microsoft.Maui.Controls.On.Value.get -> object ~Microsoft.Maui.Controls.On.Value.set -> void ~Microsoft.Maui.Controls.OnPlatform.Platforms.get -> System.Collections.Generic.IList -~Microsoft.Maui.Controls.OpenGLView.On() -> Microsoft.Maui.Controls.IPlatformElementConfiguration -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.get -> System.Action -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.set -> void ~Microsoft.Maui.Controls.Page.BackgroundImageSource.get -> Microsoft.Maui.Controls.ImageSource ~Microsoft.Maui.Controls.Page.BackgroundImageSource.set -> void ~Microsoft.Maui.Controls.Page.DisplayActionSheet(string title, string cancel, string destruction, Microsoft.Maui.FlowDirection flowDirection, params string[] buttons) -> System.Threading.Tasks.Task @@ -3716,7 +3713,6 @@ ~static readonly Microsoft.Maui.Controls.NavigationPage.RootPageProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleViewProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.OpenGLView.HasRenderLoopProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.OrientationStateTrigger.OrientationProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.BackgroundImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.IconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty @@ -5567,8 +5563,6 @@ Microsoft.Maui.Controls.Internals.TypedBinding Microsoft.Maui.Controls.Internals.TypedBindingBase Microsoft.Maui.Controls.InvalidNavigationException Microsoft.Maui.Controls.InvalidNavigationException.InvalidNavigationException() -> void -Microsoft.Maui.Controls.IOpenGlViewController -Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested -> System.EventHandler Microsoft.Maui.Controls.IPaddingElement Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Microsoft.Maui.Thickness oldValue, Microsoft.Maui.Thickness newValue) -> void Microsoft.Maui.Controls.IPaddingElement.Padding.get -> Microsoft.Maui.Thickness @@ -5947,12 +5941,6 @@ Microsoft.Maui.Controls.OnPlatform Microsoft.Maui.Controls.OnPlatform.Default.get -> T Microsoft.Maui.Controls.OnPlatform.Default.set -> void Microsoft.Maui.Controls.OnPlatform.OnPlatform() -> void -Microsoft.Maui.Controls.OpenGLView -Microsoft.Maui.Controls.OpenGLView.Display() -> void -Microsoft.Maui.Controls.OpenGLView.DisplayRequested -> System.EventHandler -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.get -> bool -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.set -> void -Microsoft.Maui.Controls.OpenGLView.OpenGLView() -> void Microsoft.Maui.Controls.OpenRequestedEventArgs Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.get -> bool Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.set -> void diff --git a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Shipped.txt b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Shipped.txt index 55f95f980316..fb23210250fc 100644 --- a/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Shipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Shipped.txt @@ -1209,9 +1209,6 @@ ~Microsoft.Maui.Controls.On.Value.get -> object ~Microsoft.Maui.Controls.On.Value.set -> void ~Microsoft.Maui.Controls.OnPlatform.Platforms.get -> System.Collections.Generic.IList -~Microsoft.Maui.Controls.OpenGLView.On() -> Microsoft.Maui.Controls.IPlatformElementConfiguration -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.get -> System.Action -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.set -> void ~Microsoft.Maui.Controls.Page.BackgroundImageSource.get -> Microsoft.Maui.Controls.ImageSource ~Microsoft.Maui.Controls.Page.BackgroundImageSource.set -> void ~Microsoft.Maui.Controls.Page.DisplayActionSheet(string title, string cancel, string destruction, Microsoft.Maui.FlowDirection flowDirection, params string[] buttons) -> System.Threading.Tasks.Task @@ -3764,7 +3761,6 @@ ~static readonly Microsoft.Maui.Controls.NavigationPage.RootPageProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleViewProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.OpenGLView.HasRenderLoopProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.OrientationStateTrigger.OrientationProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.BackgroundImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.IconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty @@ -5605,8 +5601,6 @@ Microsoft.Maui.Controls.Internals.TypedBinding Microsoft.Maui.Controls.Internals.TypedBindingBase Microsoft.Maui.Controls.InvalidNavigationException Microsoft.Maui.Controls.InvalidNavigationException.InvalidNavigationException() -> void -Microsoft.Maui.Controls.IOpenGlViewController -Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested -> System.EventHandler Microsoft.Maui.Controls.IPaddingElement Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Microsoft.Maui.Thickness oldValue, Microsoft.Maui.Thickness newValue) -> void Microsoft.Maui.Controls.IPaddingElement.Padding.get -> Microsoft.Maui.Thickness @@ -5985,12 +5979,6 @@ Microsoft.Maui.Controls.OnPlatform Microsoft.Maui.Controls.OnPlatform.Default.get -> T Microsoft.Maui.Controls.OnPlatform.Default.set -> void Microsoft.Maui.Controls.OnPlatform.OnPlatform() -> void -Microsoft.Maui.Controls.OpenGLView -Microsoft.Maui.Controls.OpenGLView.Display() -> void -Microsoft.Maui.Controls.OpenGLView.DisplayRequested -> System.EventHandler -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.get -> bool -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.set -> void -Microsoft.Maui.Controls.OpenGLView.OpenGLView() -> void Microsoft.Maui.Controls.OpenRequestedEventArgs Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.get -> bool Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.set -> void diff --git a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt index 55f95f980316..fb23210250fc 100644 --- a/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt @@ -1209,9 +1209,6 @@ ~Microsoft.Maui.Controls.On.Value.get -> object ~Microsoft.Maui.Controls.On.Value.set -> void ~Microsoft.Maui.Controls.OnPlatform.Platforms.get -> System.Collections.Generic.IList -~Microsoft.Maui.Controls.OpenGLView.On() -> Microsoft.Maui.Controls.IPlatformElementConfiguration -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.get -> System.Action -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.set -> void ~Microsoft.Maui.Controls.Page.BackgroundImageSource.get -> Microsoft.Maui.Controls.ImageSource ~Microsoft.Maui.Controls.Page.BackgroundImageSource.set -> void ~Microsoft.Maui.Controls.Page.DisplayActionSheet(string title, string cancel, string destruction, Microsoft.Maui.FlowDirection flowDirection, params string[] buttons) -> System.Threading.Tasks.Task @@ -3764,7 +3761,6 @@ ~static readonly Microsoft.Maui.Controls.NavigationPage.RootPageProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleViewProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.OpenGLView.HasRenderLoopProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.OrientationStateTrigger.OrientationProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.BackgroundImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.IconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty @@ -5605,8 +5601,6 @@ Microsoft.Maui.Controls.Internals.TypedBinding Microsoft.Maui.Controls.Internals.TypedBindingBase Microsoft.Maui.Controls.InvalidNavigationException Microsoft.Maui.Controls.InvalidNavigationException.InvalidNavigationException() -> void -Microsoft.Maui.Controls.IOpenGlViewController -Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested -> System.EventHandler Microsoft.Maui.Controls.IPaddingElement Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Microsoft.Maui.Thickness oldValue, Microsoft.Maui.Thickness newValue) -> void Microsoft.Maui.Controls.IPaddingElement.Padding.get -> Microsoft.Maui.Thickness @@ -5985,12 +5979,6 @@ Microsoft.Maui.Controls.OnPlatform Microsoft.Maui.Controls.OnPlatform.Default.get -> T Microsoft.Maui.Controls.OnPlatform.Default.set -> void Microsoft.Maui.Controls.OnPlatform.OnPlatform() -> void -Microsoft.Maui.Controls.OpenGLView -Microsoft.Maui.Controls.OpenGLView.Display() -> void -Microsoft.Maui.Controls.OpenGLView.DisplayRequested -> System.EventHandler -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.get -> bool -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.set -> void -Microsoft.Maui.Controls.OpenGLView.OpenGLView() -> void Microsoft.Maui.Controls.OpenRequestedEventArgs Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.get -> bool Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.set -> void diff --git a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Shipped.txt b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Shipped.txt index 2924415bce3b..73857a6133ae 100644 --- a/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Shipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-tizen/PublicAPI.Shipped.txt @@ -1116,9 +1116,6 @@ ~Microsoft.Maui.Controls.On.Value.get -> object ~Microsoft.Maui.Controls.On.Value.set -> void ~Microsoft.Maui.Controls.OnPlatform.Platforms.get -> System.Collections.Generic.IList -~Microsoft.Maui.Controls.OpenGLView.On() -> Microsoft.Maui.Controls.IPlatformElementConfiguration -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.get -> System.Action -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.set -> void ~Microsoft.Maui.Controls.Page.BackgroundImageSource.get -> Microsoft.Maui.Controls.ImageSource ~Microsoft.Maui.Controls.Page.BackgroundImageSource.set -> void ~Microsoft.Maui.Controls.Page.DisplayActionSheet(string title, string cancel, string destruction, Microsoft.Maui.FlowDirection flowDirection, params string[] buttons) -> System.Threading.Tasks.Task @@ -3394,7 +3391,6 @@ ~static readonly Microsoft.Maui.Controls.NavigationPage.RootPageProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleViewProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.OpenGLView.HasRenderLoopProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.OrientationStateTrigger.OrientationProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.BackgroundImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.IconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty @@ -5137,8 +5133,6 @@ Microsoft.Maui.Controls.Internals.TypedBinding Microsoft.Maui.Controls.Internals.TypedBindingBase Microsoft.Maui.Controls.InvalidNavigationException Microsoft.Maui.Controls.InvalidNavigationException.InvalidNavigationException() -> void -Microsoft.Maui.Controls.IOpenGlViewController -Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested -> System.EventHandler Microsoft.Maui.Controls.IPaddingElement Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Microsoft.Maui.Thickness oldValue, Microsoft.Maui.Thickness newValue) -> void Microsoft.Maui.Controls.IPaddingElement.Padding.get -> Microsoft.Maui.Thickness @@ -5517,12 +5511,6 @@ Microsoft.Maui.Controls.OnPlatform Microsoft.Maui.Controls.OnPlatform.Default.get -> T Microsoft.Maui.Controls.OnPlatform.Default.set -> void Microsoft.Maui.Controls.OnPlatform.OnPlatform() -> void -Microsoft.Maui.Controls.OpenGLView -Microsoft.Maui.Controls.OpenGLView.Display() -> void -Microsoft.Maui.Controls.OpenGLView.DisplayRequested -> System.EventHandler -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.get -> bool -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.set -> void -Microsoft.Maui.Controls.OpenGLView.OpenGLView() -> void Microsoft.Maui.Controls.OpenRequestedEventArgs Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.get -> bool Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.set -> void diff --git a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Shipped.txt b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Shipped.txt index 99bb3ec26933..545b66dbed9c 100644 --- a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Shipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Shipped.txt @@ -1128,9 +1128,6 @@ ~Microsoft.Maui.Controls.On.Value.get -> object ~Microsoft.Maui.Controls.On.Value.set -> void ~Microsoft.Maui.Controls.OnPlatform.Platforms.get -> System.Collections.Generic.IList -~Microsoft.Maui.Controls.OpenGLView.On() -> Microsoft.Maui.Controls.IPlatformElementConfiguration -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.get -> System.Action -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.set -> void ~Microsoft.Maui.Controls.Page.BackgroundImageSource.get -> Microsoft.Maui.Controls.ImageSource ~Microsoft.Maui.Controls.Page.BackgroundImageSource.set -> void ~Microsoft.Maui.Controls.Page.DisplayActionSheet(string title, string cancel, string destruction, Microsoft.Maui.FlowDirection flowDirection, params string[] buttons) -> System.Threading.Tasks.Task @@ -3533,7 +3530,6 @@ ~static readonly Microsoft.Maui.Controls.NavigationPage.RootPageProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleViewProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.OpenGLView.HasRenderLoopProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.OrientationStateTrigger.OrientationProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.BackgroundImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.IconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty @@ -5238,8 +5234,6 @@ Microsoft.Maui.Controls.Internals.TypedBinding Microsoft.Maui.Controls.Internals.TypedBindingBase Microsoft.Maui.Controls.InvalidNavigationException Microsoft.Maui.Controls.InvalidNavigationException.InvalidNavigationException() -> void -Microsoft.Maui.Controls.IOpenGlViewController -Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested -> System.EventHandler Microsoft.Maui.Controls.IPaddingElement Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Microsoft.Maui.Thickness oldValue, Microsoft.Maui.Thickness newValue) -> void Microsoft.Maui.Controls.IPaddingElement.Padding.get -> Microsoft.Maui.Thickness @@ -5618,12 +5612,6 @@ Microsoft.Maui.Controls.OnPlatform Microsoft.Maui.Controls.OnPlatform.Default.get -> T Microsoft.Maui.Controls.OnPlatform.Default.set -> void Microsoft.Maui.Controls.OnPlatform.OnPlatform() -> void -Microsoft.Maui.Controls.OpenGLView -Microsoft.Maui.Controls.OpenGLView.Display() -> void -Microsoft.Maui.Controls.OpenGLView.DisplayRequested -> System.EventHandler -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.get -> bool -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.set -> void -Microsoft.Maui.Controls.OpenGLView.OpenGLView() -> void Microsoft.Maui.Controls.OpenRequestedEventArgs Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.get -> bool Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.set -> void diff --git a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Shipped.txt b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Shipped.txt index 7b5250b2d7f1..462ecb3e9d89 100644 --- a/src/Controls/src/Core/PublicAPI/net/PublicAPI.Shipped.txt +++ b/src/Controls/src/Core/PublicAPI/net/PublicAPI.Shipped.txt @@ -1112,9 +1112,6 @@ ~Microsoft.Maui.Controls.On.Value.get -> object ~Microsoft.Maui.Controls.On.Value.set -> void ~Microsoft.Maui.Controls.OnPlatform.Platforms.get -> System.Collections.Generic.IList -~Microsoft.Maui.Controls.OpenGLView.On() -> Microsoft.Maui.Controls.IPlatformElementConfiguration -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.get -> System.Action -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.set -> void ~Microsoft.Maui.Controls.Page.BackgroundImageSource.get -> Microsoft.Maui.Controls.ImageSource ~Microsoft.Maui.Controls.Page.BackgroundImageSource.set -> void ~Microsoft.Maui.Controls.Page.DisplayActionSheet(string title, string cancel, string destruction, Microsoft.Maui.FlowDirection flowDirection, params string[] buttons) -> System.Threading.Tasks.Task @@ -3364,7 +3361,6 @@ ~static readonly Microsoft.Maui.Controls.NavigationPage.RootPageProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleViewProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.OpenGLView.HasRenderLoopProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.OrientationStateTrigger.OrientationProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.BackgroundImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.IconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty @@ -4995,8 +4991,6 @@ Microsoft.Maui.Controls.Internals.TypedBinding Microsoft.Maui.Controls.Internals.TypedBindingBase Microsoft.Maui.Controls.InvalidNavigationException Microsoft.Maui.Controls.InvalidNavigationException.InvalidNavigationException() -> void -Microsoft.Maui.Controls.IOpenGlViewController -Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested -> System.EventHandler Microsoft.Maui.Controls.IPaddingElement Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Microsoft.Maui.Thickness oldValue, Microsoft.Maui.Thickness newValue) -> void Microsoft.Maui.Controls.IPaddingElement.Padding.get -> Microsoft.Maui.Thickness @@ -5375,12 +5369,6 @@ Microsoft.Maui.Controls.OnPlatform Microsoft.Maui.Controls.OnPlatform.Default.get -> T Microsoft.Maui.Controls.OnPlatform.Default.set -> void Microsoft.Maui.Controls.OnPlatform.OnPlatform() -> void -Microsoft.Maui.Controls.OpenGLView -Microsoft.Maui.Controls.OpenGLView.Display() -> void -Microsoft.Maui.Controls.OpenGLView.DisplayRequested -> System.EventHandler -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.get -> bool -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.set -> void -Microsoft.Maui.Controls.OpenGLView.OpenGLView() -> void Microsoft.Maui.Controls.OpenRequestedEventArgs Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.get -> bool Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.set -> void diff --git a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Shipped.txt b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Shipped.txt index 7b5250b2d7f1..462ecb3e9d89 100644 --- a/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Shipped.txt +++ b/src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Shipped.txt @@ -1112,9 +1112,6 @@ ~Microsoft.Maui.Controls.On.Value.get -> object ~Microsoft.Maui.Controls.On.Value.set -> void ~Microsoft.Maui.Controls.OnPlatform.Platforms.get -> System.Collections.Generic.IList -~Microsoft.Maui.Controls.OpenGLView.On() -> Microsoft.Maui.Controls.IPlatformElementConfiguration -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.get -> System.Action -~Microsoft.Maui.Controls.OpenGLView.OnDisplay.set -> void ~Microsoft.Maui.Controls.Page.BackgroundImageSource.get -> Microsoft.Maui.Controls.ImageSource ~Microsoft.Maui.Controls.Page.BackgroundImageSource.set -> void ~Microsoft.Maui.Controls.Page.DisplayActionSheet(string title, string cancel, string destruction, Microsoft.Maui.FlowDirection flowDirection, params string[] buttons) -> System.Threading.Tasks.Task @@ -3364,7 +3361,6 @@ ~static readonly Microsoft.Maui.Controls.NavigationPage.RootPageProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleIconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.NavigationPage.TitleViewProperty -> Microsoft.Maui.Controls.BindableProperty -~static readonly Microsoft.Maui.Controls.OpenGLView.HasRenderLoopProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.OrientationStateTrigger.OrientationProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.BackgroundImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty ~static readonly Microsoft.Maui.Controls.Page.IconImageSourceProperty -> Microsoft.Maui.Controls.BindableProperty @@ -4995,8 +4991,6 @@ Microsoft.Maui.Controls.Internals.TypedBinding Microsoft.Maui.Controls.Internals.TypedBindingBase Microsoft.Maui.Controls.InvalidNavigationException Microsoft.Maui.Controls.InvalidNavigationException.InvalidNavigationException() -> void -Microsoft.Maui.Controls.IOpenGlViewController -Microsoft.Maui.Controls.IOpenGlViewController.DisplayRequested -> System.EventHandler Microsoft.Maui.Controls.IPaddingElement Microsoft.Maui.Controls.IPaddingElement.OnPaddingPropertyChanged(Microsoft.Maui.Thickness oldValue, Microsoft.Maui.Thickness newValue) -> void Microsoft.Maui.Controls.IPaddingElement.Padding.get -> Microsoft.Maui.Thickness @@ -5375,12 +5369,6 @@ Microsoft.Maui.Controls.OnPlatform Microsoft.Maui.Controls.OnPlatform.Default.get -> T Microsoft.Maui.Controls.OnPlatform.Default.set -> void Microsoft.Maui.Controls.OnPlatform.OnPlatform() -> void -Microsoft.Maui.Controls.OpenGLView -Microsoft.Maui.Controls.OpenGLView.Display() -> void -Microsoft.Maui.Controls.OpenGLView.DisplayRequested -> System.EventHandler -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.get -> bool -Microsoft.Maui.Controls.OpenGLView.HasRenderLoop.set -> void -Microsoft.Maui.Controls.OpenGLView.OpenGLView() -> void Microsoft.Maui.Controls.OpenRequestedEventArgs Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.get -> bool Microsoft.Maui.Controls.OpenRequestedEventArgs.Animated.set -> void diff --git a/src/Controls/tests/Core.UnitTests/NotifiedPropertiesTests.cs b/src/Controls/tests/Core.UnitTests/NotifiedPropertiesTests.cs index 02adc4d0ca2f..4ee4088e2c37 100644 --- a/src/Controls/tests/Core.UnitTests/NotifiedPropertiesTests.cs +++ b/src/Controls/tests/Core.UnitTests/NotifiedPropertiesTests.cs @@ -117,7 +117,6 @@ public override string DebugName new PropertyTestCase ("IsShowingUser", v => v.IsShowingUser, (v, o) => v.IsShowingUser = o, () => false, true), new PropertyTestCase ("IsScrollEnabled", v => v.IsScrollEnabled, (v, o) => v.IsScrollEnabled = o, () => true, false), new PropertyTestCase ("IsZoomEnabled", v => v.IsZoomEnabled, (v, o) => v.IsZoomEnabled = o, () => true, false), - new PropertyTestCase ("HasRenderLoop", v => v.HasRenderLoop, (v, o) => v.HasRenderLoop = o, () => false, true), new PropertyTestCase ("BackgroundImageSource", v => v.BackgroundImageSource, (v, o) => v.BackgroundImageSource = o, () => null, "Foo"), new PropertyTestCase ("BackgroundColor", v => v.BackgroundColor, (v, o) => v.BackgroundColor = o, () => default(Color), new Color (0, 1, 0)), new PropertyTestCase ("Title", v => v.Title, (v, o) => v.Title = o, () => null, "Foo"), diff --git a/src/Controls/tests/Core.UnitTests/OpenGLViewUnitTests.cs b/src/Controls/tests/Core.UnitTests/OpenGLViewUnitTests.cs deleted file mode 100644 index 6836cdfa15ad..000000000000 --- a/src/Controls/tests/Core.UnitTests/OpenGLViewUnitTests.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Xunit; - -namespace Microsoft.Maui.Controls.Core.UnitTests -{ - - public class OpenGLViewUnitTests : BaseTestFixture - { - [Fact] - public void Display() - { - var view = new OpenGLView(); - bool displayed = false; - - view.DisplayRequested += (s, o) => displayed = true; - - view.Display(); - Assert.True(displayed); - } - } -} From 99389f1fefbca1cba4e046d16956484c8eb67fa2 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Thu, 12 Jan 2023 13:49:10 +0100 Subject: [PATCH 2/2] Restore accidentally deleted files --- .../ActivityIndicatorCoreGalleryPage.cs | 43 +++ .../CoreGalleryPages/ButtonCoreGalleryPage.cs | 129 +++++++ .../CarouselViewCoreGalleryPage.cs | 111 ++++++ .../CheckBoxCoreGalleryPage.cs | 64 ++++ .../CollectionViewCoreGalleryPage.cs | 26 ++ .../CoreBoxViewGalleryPage.cs | 43 +++ .../Core/CoreGalleryPages/CoreGalleryPage.cs | 266 +++++++++++++++ .../DatePickerCoreGalleryPage.cs | 64 ++++ .../CoreGalleryPages/EditorCoreGalleryPage.cs | 66 ++++ .../CoreGalleryPages/EntryCoreGalleryPage.cs | 152 +++++++++ .../CoreGalleryPages/FrameCoreGalleryPage.cs | 49 +++ .../ImageButtonCoreGalleryPage.cs | 136 ++++++++ .../CoreGalleryPages/ImageCoreGalleryPage.cs | 42 +++ .../KeyboardCoreGalleryPage.cs | 53 +++ .../CoreGalleryPages/LabelCoreGalleryPage.cs | 319 +++++++++++++++++ .../ListViewCoreGalleryPage.cs | 321 ++++++++++++++++++ .../CoreGalleryPages/PickerCoreGalleryPage.cs | 101 ++++++ .../ProgressBarCoreGalleryPage.cs | 31 ++ .../RadioButtonCoreGalleryPage.cs | 97 ++++++ .../RefreshViewCoreGalleyPage.cs | 121 +++++++ .../SearchBarCoreGalleryPage.cs | 121 +++++++ .../CoreGalleryPages/SliderCoreGalleryPage.cs | 46 +++ .../StepperCoreGalleryPage.cs | 29 ++ .../SwipeViewCoreGalleryPage.cs | 119 +++++++ .../CoreGalleryPages/SwitchCoreGalleryPage.cs | 52 +++ .../TableViewCoreGalleryPage.cs | 45 +++ .../TimePickerCoreGalleryPage.cs | 49 +++ .../WebViewCoreGalleryPage.cs | 173 ++++++++++ .../WkWebViewCoreGalleryPage.cs | 149 ++++++++ 29 files changed, 3017 insertions(+) create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CarouselViewCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CheckBoxCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CollectionViewCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CoreBoxViewGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/CoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/DatePickerCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/EditorCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/EntryCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/FrameCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ImageButtonCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ImageCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/KeyboardCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/LabelCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ListViewCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/PickerCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ProgressBarCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/RadioButtonCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/RefreshViewCoreGalleyPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SearchBarCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SliderCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/StepperCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SwipeViewCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/SwitchCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/TableViewCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/TimePickerCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WebViewCoreGalleryPage.cs create mode 100644 src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs diff --git a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs new file mode 100644 index 000000000000..5afc952c6b8c --- /dev/null +++ b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ActivityIndicatorCoreGalleryPage.cs @@ -0,0 +1,43 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Graphics; + +namespace Microsoft.Maui.Controls.Compatibility.ControlGallery +{ + internal class ActivityIndicatorCoreGalleryPage : CoreGalleryPage + { + protected override bool SupportsTapGestureRecognizer + { + get { return true; } + } + + protected override void InitializeElement(ActivityIndicator element) + { + element.IsRunning = true; + } + + protected override void Build(StackLayout stackLayout) + { + base.Build(stackLayout); + + var colorContainer = new ViewContainer(Test.ActivityIndicator.Color, new ActivityIndicator + { + Color = Colors.Lime, + IsRunning = true + + }); + + var isRunningContainer = new StateViewContainer(Test.ActivityIndicator.IsRunning, new ActivityIndicator + { + IsRunning = true + }); + + isRunningContainer.StateChangeButton.Clicked += (sender, args) => + { + isRunningContainer.View.IsRunning = !isRunningContainer.View.IsRunning; + }; + + Add(colorContainer); + Add(isRunningContainer); + } + } +} \ No newline at end of file diff --git a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs new file mode 100644 index 000000000000..bbedf862deff --- /dev/null +++ b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/ButtonCoreGalleryPage.cs @@ -0,0 +1,129 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Graphics; + +namespace Microsoft.Maui.Controls.Compatibility.ControlGallery +{ + internal class ButtonCoreGalleryPage : CoreGalleryPage + +" + }, + HeightRequest = 200 + }; + + jsAlertWebView.On().SetIsJavaScriptAlertEnabled(true); + + var javascriptAlertWebSourceContainer = new ViewContainer(Test.WebView.JavaScriptAlert, + jsAlertWebView + ); + + var evaluateJsWebView = new WebView + { + Source = new UrlWebViewSource { Url = "https://www.google.com/" }, + HeightRequest = 50 + }; + var evaluateJsWebViewSourceContainer = new ViewContainer(Test.WebView.EvaluateJavaScript, + evaluateJsWebView + ); + + var resultsLabel = new Label(); + var execButton = new Button(); + execButton.Text = "Evaluate Javascript"; + execButton.Command = new Command(async () => resultsLabel.Text = await evaluateJsWebView.EvaluateJavaScriptAsync( + "var test = function(){ return 'This string came from Javascript!'; }; test();")); + + evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(resultsLabel); + evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(execButton); + + + Add(urlWebViewSourceContainer); + Add(htmlWebViewSourceContainer); + Add(htmlFileWebSourceContainer); + Add(javascriptAlertWebSourceContainer); + Add(evaluateJsWebViewSourceContainer); + } + } +} \ No newline at end of file diff --git a/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs new file mode 100644 index 000000000000..71cf9fa85962 --- /dev/null +++ b/src/Compatibility/ControlGallery/src/Core/CoreGalleryPages/WkWebViewCoreGalleryPage.cs @@ -0,0 +1,149 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; +using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific; +using Microsoft.Maui.Devices; + +using WindowsOS = Microsoft.Maui.Controls.PlatformConfiguration.Windows; + +namespace Microsoft.Maui.Controls.Compatibility.ControlGallery +{ + internal class WkWebViewCoreGalleryPage : CoreGalleryPage + { + protected override bool SupportsFocus + { + get { return false; } + } + + protected override void InitializeElement(WkWebView element) + { + element.HeightRequest = 200; + + element.Source = new UrlWebViewSource { Url = "http://xamarin.com/" }; + } + + protected override void Build(StackLayout stackLayout) + { + base.Build(stackLayout); + + var urlWebViewSourceContainer = new ViewContainer(Test.WebView.UrlWebViewSource, + new WkWebView + { + Source = new UrlWebViewSource { Url = "https://www.google.com/" }, + HeightRequest = 200 + } + ); + + const string html = "" + + "" + + "

I am raw html

"; + + var htmlWebViewSourceContainer = new ViewContainer(Test.WebView.HtmlWebViewSource, + new WkWebView + { + Source = new HtmlWebViewSource { Html = html }, + HeightRequest = 200 + } + ); + + var htmlFileWebSourceContainer = new ViewContainer(Test.WebView.LoadHtml, + new WkWebView + { + Source = new HtmlWebViewSource + { + Html = @" + + + + + +

Xamarin.Forms

+

The CSS and image are loaded from local files!

+ +

next page

+ +" + }, + HeightRequest = 200 + } + ); + + // NOTE: Currently the ability to programmatically enable/disable mixed content only exists on Android + if (DeviceInfo.Platform == DevicePlatform.Android) + { + var mixedContentTestPage = "https://mixed-content-test.appspot.com/"; + + var mixedContentDisallowedWebView = new WkWebView() { HeightRequest = 1000 }; + mixedContentDisallowedWebView.On().SetMixedContentMode(MixedContentHandling.NeverAllow); + mixedContentDisallowedWebView.Source = new UrlWebViewSource + { + Url = mixedContentTestPage + }; + + var mixedContentAllowedWebView = new WkWebView() { HeightRequest = 1000 }; + mixedContentAllowedWebView.On().SetMixedContentMode(MixedContentHandling.AlwaysAllow); + mixedContentAllowedWebView.Source = new UrlWebViewSource + { + Url = mixedContentTestPage + }; + + var mixedContentDisallowedContainer = new ViewContainer(Test.WebView.MixedContentDisallowed, + mixedContentDisallowedWebView); + var mixedContentAllowedContainer = new ViewContainer(Test.WebView.MixedContentAllowed, + mixedContentAllowedWebView); + + Add(mixedContentDisallowedContainer); + Add(mixedContentAllowedContainer); + } + + + var jsAlertWebView = new WkWebView + { + Source = new HtmlWebViewSource + { + Html = @" + + + + + + + +" + }, + HeightRequest = 200 + }; + + jsAlertWebView.On().SetIsJavaScriptAlertEnabled(true); + + var javascriptAlertWebSourceContainer = new ViewContainer(Test.WebView.JavaScriptAlert, + jsAlertWebView + ); + + var evaluateJsWebView = new WkWebView + { + Source = new UrlWebViewSource { Url = "https://www.google.com/" }, + HeightRequest = 50 + }; + var evaluateJsWebViewSourceContainer = new ViewContainer(Test.WebView.EvaluateJavaScript, + evaluateJsWebView + ); + + var resultsLabel = new Label(); + var execButton = new Button(); + execButton.Text = "Evaluate Javascript"; + execButton.Command = new Command(async () => resultsLabel.Text = await evaluateJsWebView.EvaluateJavaScriptAsync( + "var test = function(){ return 'This string came from Javascript!'; }; test();")); + + evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(resultsLabel); + evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(execButton); + + + Add(urlWebViewSourceContainer); + Add(htmlWebViewSourceContainer); + Add(htmlFileWebSourceContainer); + Add(javascriptAlertWebSourceContainer); + Add(evaluateJsWebViewSourceContainer); + } + } +} \ No newline at end of file