using System; using System.ComponentModel; using Xamarin.Forms.Platform; namespace Xamarin.Forms { [RenderWith(typeof(_OpenGLViewRenderer))] 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() { EventHandler handler = DisplayRequested; if (handler != null) handler(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(); } } }