From 094a1d2efd01fba2cc64a07a104ca375e65bcafa Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Thu, 29 Jul 2021 14:02:25 -0500 Subject: [PATCH] Abstracted RenderWindow for platform-specific implementations --- UIX.RenderApi.Skia/AssemblyInfo.cs | 3 + .../Iris/Render/Graphics/ITreeOwner.cs | 2 +- .../Microsoft/Iris/Render/Graphics/Sprite.cs | 2 +- .../Microsoft/Iris/Render/Graphics/Visual.cs | 4 +- .../Iris/Render/Graphics/VisualContainer.cs | 2 +- .../Microsoft/Iris/Render/Internal/Display.cs | 2 +- .../Iris/Render/Internal/RenderEngine.cs | 5 +- .../Iris/Render/Internal/RenderSession.cs | 2 +- .../Iris/Render/Internal/RenderWindow.cs | 887 ++++++++---------- .../Microsoft/Iris/Render/IrisEngineInfo.cs | 11 +- .../Rendering/RemoteAnimationManager.cs | 6 +- .../Microsoft/Iris/Render/RenderWindowBase.cs | 118 +++ .../Iris/Render/WpfRenderWindow.WPF.cs | 316 +++++++ .../Iris/Render/XamlRenderWindow.UWP.cs | 297 ++++++ UIX.RenderApi.Skia/UIX.RenderApi.Skia.csproj | 39 +- UIX.Skia/Microsoft/Iris/Application.cs | 4 +- UIX.Skia/Microsoft/Iris/Session/UISession.cs | 7 +- Xune.Uno/IrisCoreWindow.cs | 275 ++++++ .../Xune.Uno.UWP/Xune.Uno.Uwp.csproj | 6 +- Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs | 264 +----- Xune.Wpf/App.xaml | 9 + Xune.Wpf/App.xaml.cs | 17 + Xune.Wpf/AssemblyInfo.cs | 10 + Xune.Wpf/MainWindow.xaml | 13 + Xune.Wpf/MainWindow.xaml.cs | 41 + Xune.Wpf/Xune.Wpf.csproj | 15 + Xune.sln | 35 +- 27 files changed, 1591 insertions(+), 801 deletions(-) create mode 100644 UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderWindowBase.cs create mode 100644 UIX.RenderApi.Skia/Microsoft/Iris/Render/WpfRenderWindow.WPF.cs create mode 100644 UIX.RenderApi.Skia/Microsoft/Iris/Render/XamlRenderWindow.UWP.cs create mode 100644 Xune.Uno/IrisCoreWindow.cs create mode 100644 Xune.Wpf/App.xaml create mode 100644 Xune.Wpf/App.xaml.cs create mode 100644 Xune.Wpf/AssemblyInfo.cs create mode 100644 Xune.Wpf/MainWindow.xaml create mode 100644 Xune.Wpf/MainWindow.xaml.cs create mode 100644 Xune.Wpf/Xune.Wpf.csproj diff --git a/UIX.RenderApi.Skia/AssemblyInfo.cs b/UIX.RenderApi.Skia/AssemblyInfo.cs index 2663a57..bfb9a31 100644 --- a/UIX.RenderApi.Skia/AssemblyInfo.cs +++ b/UIX.RenderApi.Skia/AssemblyInfo.cs @@ -16,3 +16,6 @@ using System.Security.Permissions; [assembly: AssemblyCompany("Microsoft Corporation")] [assembly: AssemblyVersion("4.8.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] + +// Allow platform-specific extensions to access internals +[assembly: InternalsVisibleTo("UIX.RenderAPI.Skia.Uno")] diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs index 6a8238f..3047955 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/ITreeOwner.cs @@ -8,6 +8,6 @@ namespace Microsoft.Iris.Render.Graphics { internal interface ITreeOwner { - TreeNode Root { get; } + internal TreeNode Root { get; } } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs index 234378b..a91bd89 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Sprite.cs @@ -18,7 +18,7 @@ namespace Microsoft.Iris.Render.Graphics private RemoteSprite m_remoteSprite; private Effect m_effect; - public Sprite(RenderSession session, RenderWindow window, object objOwnerData) + public Sprite(RenderSession session, RenderWindowBase window, object objOwnerData) : base(session, window, objOwnerData) { this.m_remoteSprite = session.BuildRemoteSprite(this, window); diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs index 61564f2..bcbebd4 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/Visual.cs @@ -33,7 +33,7 @@ namespace Microsoft.Iris.Render.Graphics public static readonly string RotationProperty = nameof(Rotation); public static readonly string ScaleProperty = nameof(Scale); public static readonly string SizeProperty = nameof(Size); - protected RenderWindow m_window; + protected RenderWindowBase m_window; protected RemoteVisual m_remoteVisual; private Vector3 m_vecPosition; private Vector2 m_vecSize; @@ -83,7 +83,7 @@ namespace Microsoft.Iris.Render.Graphics s_sectionPropIDMap[9] = s_bvsNineGrid; } - internal Visual(RenderSession session, RenderWindow window, object objOwnerData) + internal Visual(RenderSession session, RenderWindowBase window, object objOwnerData) : base(window) { Debug2.Validate(session != null, typeof(ArgumentNullException), "Must have valid session"); diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs index 4e5fb7d..dbffc73 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Graphics/VisualContainer.cs @@ -25,7 +25,7 @@ namespace Microsoft.Iris.Render.Graphics internal VisualContainer( bool isRoot, RenderSession session, - RenderWindow window, + RenderWindowBase window, object objOwnerData, out RemoteVisual remoteVisual) : base(session, window, objOwnerData) diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs index 532f335..c2c9685 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/Display.cs @@ -156,7 +156,7 @@ namespace Microsoft.Iris.Render.Internal Interlaced = this.m_modeCurrent.fInterlaced }, this.m_modeCurrent.fTvMode); flag = true; - this.m_engine.Window.NotifyDisplayReconfigured(); + //this.m_engine.Window.NotifyDisplayReconfigured(); } return flag; } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs index 702c043..2686de4 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderEngine.cs @@ -19,6 +19,7 @@ namespace Microsoft.Iris.Render.Internal private RenderCaps m_renderCaps; private GraphicsDeviceType m_typeGraphics; private SoundDeviceType m_typeSound; + private RenderWindowBase m_renderWindow; private InputSystem m_inputSystem; private SoundDevice m_soundDevice; private ContextID m_localContextId; @@ -98,7 +99,9 @@ namespace Microsoft.Iris.Render.Internal internal RenderSession Session => m_renderSession; - IRenderWindow IRenderEngine.Window => null; + IRenderWindow IRenderEngine.Window => m_renderWindow; + + internal RenderWindowBase Window => m_renderWindow; IDisplayManager IRenderEngine.DisplayManager => null; diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs index bb7c2ab..a65e1e0 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderSession.cs @@ -307,7 +307,7 @@ namespace Microsoft.Iris.Render.Internal internal RemoteVisualContainer BuildRemoteVisualContainer(Visual visual) => this.RenderingProtocol.BuildRemoteVisualContainer(visual); - internal RemoteSprite BuildRemoteSprite(Sprite sprite, RenderWindow window) + internal RemoteSprite BuildRemoteSprite(Sprite sprite, RenderWindowBase window) { switch (window.GraphicsDeviceType) { diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs index eb0d7e5..c2117aa 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Internal/RenderWindow.cs @@ -19,11 +19,7 @@ using System.Security; namespace Microsoft.Iris.Render.Internal { [SuppressUnmanagedCodeSecurity] - internal sealed class RenderWindow : - IRenderWindow, - ITreeOwner, - IFormWindowCallback, - IRenderHandleOwner + internal sealed class RenderWindow : RenderWindowBase, IFormWindowCallback, IRenderHandleOwner { private const uint ACT_INACTIVE = 0; private const uint ACT_ACTIVE = 1; @@ -78,7 +74,7 @@ namespace Microsoft.Iris.Render.Internal private Stack m_stkWaitCursors; private HWND m_hwnd; private RemoteFormWindow m_remoteWindow; - private RenderWindow.RenderFlags m_renderFlags; + private RenderFlags m_renderFlags; private bool m_fPreProcessedInput; private int m_nMouseLockCount; private ArrayList m_partialDropData; @@ -87,7 +83,7 @@ namespace Microsoft.Iris.Render.Internal private uint m_nDragOverResult; private bool m_fIsDragInProgress; private FormPlacement m_finalPlacement; - private SmartMap m_mapShutdownHooks; + private SmartMap m_mapShutdownHooks; private ushort m_nextShutdownHookId; internal RenderWindow( @@ -99,29 +95,29 @@ namespace Microsoft.Iris.Render.Internal Debug2.Validate(session != null, typeof(ArgumentNullException), "must pass a valid session"); session.AssertOwningThread(); Debug2.Validate(displayManager != null, typeof(ArgumentNullException), "must pass a valid DisplayManager"); - this.m_session = session; - this.m_displayManager = displayManager; - this.CreateGraphicsDevice(session, graphicsDeviceType, renderingQuality); - this.m_device.RegisterWindow(this); - this.m_clrBackground = new ColorF(0.0f, 0.0f, 0.0f); - this.m_remoteWindow = this.m_session.BuildRemoteFormWindow(this, this.m_displayManager); - this.m_fPreProcessedInput = false; - this.m_cursor = Cursor.Default; - this.m_cursorIdle = Cursor.Default; - this.m_nWindowState = WindowState.Normal; - this.m_fRightToLeft = false; - this.m_fSessionHasDisplay = true; - this.m_fSessionLocked = false; - this.m_szDefault = new Size(640, 480); - this.m_clrOutlineAllColor = new ColorF(byte.MaxValue, 0, byte.MaxValue, 0); - this.m_clrOutlineMarkedColor = new ColorF(byte.MaxValue, byte.MaxValue, 0, 0); - this.m_mapShutdownHooks = new SmartMap(); - this.m_nextShutdownHookId = 1; - this.m_nMouseLockCount = 0; - this.SetFullScreenExclusive(false); + m_session = session; + m_displayManager = displayManager; + CreateGraphicsDevice(session, graphicsDeviceType, renderingQuality); + m_device.RegisterWindow(this); + m_clrBackground = new ColorF(0.0f, 0.0f, 0.0f); + m_remoteWindow = m_session.BuildRemoteFormWindow(this, m_displayManager); + m_fPreProcessedInput = false; + m_cursor = Cursor.Default; + m_cursorIdle = Cursor.Default; + m_nWindowState = WindowState.Normal; + m_fRightToLeft = false; + m_fSessionHasDisplay = true; + m_fSessionLocked = false; + m_szDefault = new Size(640, 480); + m_clrOutlineAllColor = new ColorF(byte.MaxValue, 0, byte.MaxValue, 0); + m_clrOutlineMarkedColor = new ColorF(byte.MaxValue, byte.MaxValue, 0, 0); + m_mapShutdownHooks = new SmartMap(); + m_nextShutdownHookId = 1; + m_nMouseLockCount = 0; + SetFullScreenExclusive(false); } - public void Initialize() => this.BuildRootContainer(); + public override void Initialize() => BuildRootContainer(); private GraphicsDevice CreateGraphicsDevice( RenderSession session, @@ -130,14 +126,14 @@ namespace Microsoft.Iris.Render.Internal { GraphicsDevice graphicsDevice = null; EngineApi.IFC(FormApi.SpGdiplusInit()); - this.m_graphicsDeviceType = graphicsDeviceType; - switch (this.m_graphicsDeviceType) + m_graphicsDeviceType = graphicsDeviceType; + switch (m_graphicsDeviceType) { case GraphicsDeviceType.Gdi: - this.m_device = new GdiGraphicsDevice(session); + m_device = new GdiGraphicsDevice(session); break; case GraphicsDeviceType.Direct3D9: - this.m_device = new NtGraphicsDevice(session, renderingQuality); + m_device = new NtGraphicsDevice(session, renderingQuality); break; } return graphicsDevice; @@ -145,456 +141,358 @@ namespace Microsoft.Iris.Render.Internal internal void Dispose() { - this.Visible = false; - this.m_remoteWindow.SendSetRoot(null); - this.m_rootVisual.UnregisterUsage(this); - this.StopRendering(); + Visible = false; + m_remoteWindow.SendSetRoot(null); + m_rootVisual.UnregisterUsage(this); + StopRendering(); } internal void StopRendering() { - if (this.m_device != null) + if (m_device != null) { - this.m_device.Dispose(); - this.m_device = null; + m_device.Dispose(); + m_device = null; } - if (this.m_remoteWindow != null) + if (m_remoteWindow != null) { - this.m_remoteWindow.Dispose(); - this.m_remoteWindow = null; + m_remoteWindow.Dispose(); + m_remoteWindow = null; } EngineApi.IFC(FormApi.SpGdiplusUninit()); } - RENDERHANDLE IRenderHandleOwner.RenderHandle => this.m_remoteWindow.RenderHandle; + RENDERHANDLE IRenderHandleOwner.RenderHandle => m_remoteWindow.RenderHandle; - void IRenderHandleOwner.OnDisconnect() => this.m_remoteWindow = null; + void IRenderHandleOwner.OnDisconnect() => m_remoteWindow = null; - internal RemoteFormWindow RemoteStub => this.m_remoteWindow; + internal RemoteFormWindow RemoteStub => m_remoteWindow; - public int Left => this.m_nX; + public override int Left => m_nX; - public int Top => this.m_nY; + public override int Top => m_nY; - public int Right => this.m_nX + this.m_nWidth; + public override int Right => m_nX + m_nWidth; - public int Bottom => this.m_nY + this.m_nHeight; + public override int Bottom => m_nY + m_nHeight; - public int Width => this.m_nWidth; + public override int Width => m_nWidth; - public int Height => this.m_nHeight; + public override int Height => m_nHeight; - public HWND WindowHandle => this.m_hwnd; + public override HWND WindowHandle => m_hwnd; - public Size ClientSize + public override Size ClientSize { - get => new Size(this.m_nWidth, this.m_nHeight); + get => new Size(m_nWidth, m_nHeight); set { - if (this.m_nWidth == value.Width && this.m_nHeight == value.Height || !this.m_session.IsValid) + if (m_nWidth == value.Width && m_nHeight == value.Height || !m_session.IsValid) return; - this.m_remoteWindow.SendSetSize(value); + m_remoteWindow.SendSetSize(value); } } - public Size InitialClientSize + public override Size InitialClientSize { - get => this.m_szDefault; - set => this.m_szDefault = value; + get => m_szDefault; + set => m_szDefault = value; } - public FormPlacement InitialPlacement + public override FormPlacement InitialPlacement { set { - if (!this.m_session.IsValid || this.m_remoteWindow == null || !(this.m_hwnd == HWND.NULL)) + if (!m_session.IsValid || m_remoteWindow == null || !(m_hwnd == HWND.NULL)) return; - this.m_remoteWindow.SendSetInitialPlacement(value.ShowState, value.NormalPosition, value.MaximizedLocation); + m_remoteWindow.SendSetInitialPlacement(value.ShowState, value.NormalPosition, value.MaximizedLocation); } } - public FormPlacement FinalPlacement => this.m_finalPlacement; + public override FormPlacement FinalPlacement => m_finalPlacement; - public int MinResizeWidth + public override int MinResizeWidth { - get => this.m_nMinResizeWidth; + get => m_nMinResizeWidth; set { - if (this.m_nMinResizeWidth == value) + if (m_nMinResizeWidth == value) return; - this.m_nMinResizeWidth = value; - if (!this.m_session.IsValid) + m_nMinResizeWidth = value; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetMinResizeWidth(this.m_nMinResizeWidth); + m_remoteWindow.SendSetMinResizeWidth(m_nMinResizeWidth); } } - public int MaxResizeWidth + public override int MaxResizeWidth { - get => this.m_nMaxResizeWidth; + get => m_nMaxResizeWidth; set { - if (this.m_nMaxResizeWidth == value) + if (m_nMaxResizeWidth == value) return; - this.m_nMaxResizeWidth = value; - if (!this.m_session.IsValid) + m_nMaxResizeWidth = value; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetMaxResizeWidth(this.m_nMaxResizeWidth); + m_remoteWindow.SendSetMaxResizeWidth(m_nMaxResizeWidth); } } - public Point Position + public override Point Position { - get => new Point(this.m_nX, this.m_nY); + get => new Point(m_nX, m_nY); set { - if (this.m_nX == value.X && this.m_nY == value.Y || !this.m_session.IsValid) + if (m_nX == value.X && m_nY == value.Y || !m_session.IsValid) return; - this.m_remoteWindow.SendSetPosition(value); + m_remoteWindow.SendSetPosition(value); } } - public string Text + public override string Text { - get => this.m_stText == null ? "" : this.m_stText; + get => m_stText == null ? "" : m_stText; set { - this.m_stText = value; - this.UpdateText(true); + m_stText = value; + UpdateText(true); } } - public Cursor Cursor + public override Cursor Cursor { - get => this.m_cursor; + get => m_cursor; set { - if (this.m_cursor == value) + if (m_cursor == value) return; - this.m_cursor = value; - this.UpdateCursors(); + m_cursor = value; + UpdateCursors(); } } - public Cursor IdleCursor + public override Cursor IdleCursor { - get => this.m_cursorIdle; + get => m_cursorIdle; set { - if (this.m_cursorIdle == value) + if (m_cursorIdle == value) return; - this.m_cursorIdle = value; - this.UpdateCursors(); + m_cursorIdle = value; + UpdateCursors(); } } - public bool Visible + public override bool Visible { - get => this.m_fVisible; + get => m_fVisible; set { - if (this.m_fVisible == value) + if (m_fVisible == value) return; - this.m_fVisible = value; - if (!this.m_session.IsValid) + m_fVisible = value; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetVisible(this.m_fVisible); + m_remoteWindow.SendSetVisible(m_fVisible); } } - public bool IsLoaded => this.m_fLoadEventFired; + public override bool IsLoaded => m_fLoadEventFired; - public ColorF BackgroundColor + public override ColorF BackgroundColor { - get => this.m_clrBackground; - set => this.SetBackgroundColor(value); + get => m_clrBackground; + set => SetBackgroundColor(value); } - IDisplay IRenderWindow.CurrentDisplay + public override IDisplay CurrentDisplay { - get => this.m_currentDisplay == null ? this.m_displayManager.PrimaryDisplay : m_currentDisplay; - set => this.SetCurrentDisplay(value); + get => m_currentDisplay == null ? m_displayManager.PrimaryDisplay : m_currentDisplay; + set => SetCurrentDisplay(value); } - private void SetCurrentDisplay(IDisplay inputIDisplay) + public override void SetCurrentDisplay(IDisplay inputIDisplay) { Debug2.Validate(inputIDisplay is Display, null, "CurrentDisplay.set param MUST be a valid Display object"); - Display display = this.m_displayManager.DisplayFromUniqueId((inputIDisplay as Display).UniqueId); + Display display = m_displayManager.DisplayFromUniqueId((inputIDisplay as Display).UniqueId); if (display == null) return; - this.m_currentDisplay = display; + m_currentDisplay = display; } - public bool FullScreenExclusive + public override bool FullScreenExclusive { - get => this.m_fExclusive; - set => this.SetFullScreenExclusive(value); + get => m_fExclusive; + set => SetFullScreenExclusive(value); } - private void SetFullScreenExclusive(bool fNewValue) + public override void SetFullScreenExclusive(bool fNewValue) { - switch (this.m_graphicsDeviceType) + switch (m_graphicsDeviceType) { case GraphicsDeviceType.Direct3D9: - this.m_fExclusive = fNewValue; + m_fExclusive = fNewValue; break; case GraphicsDeviceType.XeDirectX9: - this.m_fExclusive = true; + m_fExclusive = true; break; default: - this.m_fExclusive = false; + m_fExclusive = false; break; } } - public bool ActivationState => this.m_fActivation; + public override bool ActivationState => m_fActivation; - public WindowState WindowState + public override WindowState WindowState { - get => this.m_nWindowState; + get => m_nWindowState; set { - if (this.m_nWindowState == value) + if (m_nWindowState == value) return; - this.m_nWindowState = value; - if (!this.m_session.IsValid) + m_nWindowState = value; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetMode((uint)this.m_nWindowState); + m_remoteWindow.SendSetMode((uint)m_nWindowState); } } - public FormStyleInfo Styles + public override FormStyleInfo Styles { - get => this.m_windowStyles; + get => m_windowStyles; set { - this.m_windowStyles = value; - if (!this.m_session.IsValid) + m_windowStyles = value; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetStyles(value.uStyleRestored, value.uExStyleRestored, value.uStyleMinimized, value.uExStyleMinimized, value.uStyleMaximized, value.uExStyleMaximized, value.uStyleFullscreen, value.uExStyleFullscreen); + m_remoteWindow.SendSetStyles(value.uStyleRestored, value.uExStyleRestored, value.uStyleMinimized, value.uExStyleMinimized, value.uStyleMaximized, value.uExStyleMaximized, value.uStyleFullscreen, value.uExStyleFullscreen); } } - HWND IRenderWindow.AppNotifyWindow + public override HWND AppNotifyWindow { - set => this.m_remoteWindow.INPROC_SendSetAppNotifyWindow(value); + set => m_remoteWindow.INPROC_SendSetAppNotifyWindow(value); } - IVisualContainer IRenderWindow.VisualRoot => m_rootVisual; + public override IVisualContainer VisualRoot => m_rootVisual; - TreeNode ITreeOwner.Root => m_rootVisual; + internal TreeNode Root => m_rootVisual; - internal bool IsClosing => this.m_fClosing; + internal override bool IsClosing => m_fClosing; - internal bool IsSessionActive => this.m_fSessionHasDisplay && !this.m_fSessionLocked; + internal override bool IsSessionActive => m_fSessionHasDisplay && !m_fSessionLocked; - internal bool IsSessionRemote => false; + internal override bool IsSessionRemote => false; - internal bool IsSpanningMonitors => this.m_fSpanningMonitors; + internal override bool IsSpanningMonitors => m_fSpanningMonitors; - internal bool IsOnSecondaryMonitor => this.m_fOnSecondaryMonitor; + internal override bool IsOnSecondaryMonitor => m_fOnSecondaryMonitor; - internal ColorF OutlineAllColor + internal override ColorF OutlineAllColor { - get => this.m_clrOutlineAllColor; + get => m_clrOutlineAllColor; set { - if (!(this.m_clrOutlineAllColor != value)) + if (!(m_clrOutlineAllColor != value)) return; - this.m_clrOutlineAllColor = value; - this.m_remoteWindow.SendSetOutlineAllColor(value); + m_clrOutlineAllColor = value; + m_remoteWindow.SendSetOutlineAllColor(value); } } - internal ColorF OutlineMarkedColor + internal override ColorF OutlineMarkedColor { - get => this.m_clrOutlineMarkedColor; + get => m_clrOutlineMarkedColor; set { - if (!(this.m_clrOutlineMarkedColor != value)) + if (!(m_clrOutlineMarkedColor != value)) return; - this.m_clrOutlineMarkedColor = value; - this.m_remoteWindow.SendSetOutlineMarkedColor(value); + m_clrOutlineMarkedColor = value; + m_remoteWindow.SendSetOutlineMarkedColor(value); } } - internal GraphicsDevice GraphicsDevice => this.m_device; + internal override GraphicsDevice GraphicsDevice => m_device; - internal RenderSession Session => this.m_session; + internal override RenderSession Session => m_session; - internal GraphicsDeviceType GraphicsDeviceType => this.m_graphicsDeviceType; + internal override GraphicsDeviceType GraphicsDeviceType => m_graphicsDeviceType; - internal bool IsRightToLeft => this.m_fRightToLeft; + internal override bool IsRightToLeft => m_fRightToLeft; - public event LocationChangedHandler LocationChangedEvent; - - public event SizeChangedHandler SizeChangedEvent; - - public event MonitorChangedHandler MonitorChangedEvent; - - public event WindowStateChangedHandler WindowStateChangedEvent; - - public event CloseHandler CloseEvent; - - public event CloseRequestHandler CloseRequestEvent; - - public event SysCommandHandler SysCommandEvent; - - public event MouseIdleHandler MouseIdleEvent; - - public event ShowHandler ShowEvent; - - public event ActivationChangeHandler ActivationChangeEvent; - - public event SessionActivateHandler SessionActivateEvent; - - public event SessionConnectHandler SessionConnectEvent; - - public event SetFocusHandler SetFocusEvent; - - public event LoadHandler LoadEvent; - - public event ForwardMessageHandler ForwardMessageEvent; - - public event RenderWindow.RendererSuspendedHandler RendererSuspendedEvent; + public event RendererSuspendedHandler RendererSuspendedEvent; internal event EventHandler WindowCreatedEvent; private void OnCreated() { - if (this.WindowCreatedEvent == null) + if (WindowCreatedEvent == null) return; - this.WindowCreatedEvent(this, EventArgs.Empty); + WindowCreatedEvent(this, EventArgs.Empty); } - private void OnForwardWndMsg(uint msg, IntPtr wParam, IntPtr lParam) + private new void FireLoadEvent() { - if (this.ForwardMessageEvent == null) + if (m_fLoadEventFired || !m_fLoadComplete || m_nWidth == 0 && m_nHeight == 0) return; - this.ForwardMessageEvent(msg, wParam, lParam); + base.FireLoadEvent(); + m_fLoadEventFired = true; } - private void FireLoadEvent() - { - if (this.m_fLoadEventFired || !this.m_fLoadComplete || this.m_nWidth == 0 && this.m_nHeight == 0) - return; - if (this.LoadEvent != null) - this.LoadEvent(); - this.m_fLoadEventFired = true; - } + internal void NotifyDisplayReconfigured() => OnSizeChanged(); - private void OnLocationChanged() + private new void OnSizeChanged() { - if (this.LocationChangedEvent == null) - return; - this.LocationChangedEvent(this.Position); - } - - internal void NotifyDisplayReconfigured() => this.OnSizeChanged(); - - private void OnSizeChanged() - { - this.FireLoadEvent(); - if (this.SizeChangedEvent == null) - return; - this.SizeChangedEvent(); - } - - private void OnMonitorChanged() - { - if (this.MonitorChangedEvent == null) - return; - this.MonitorChangedEvent(); - } - - private void OnWindowStateChanged(bool fUnplanned) - { - if (this.WindowStateChangedEvent == null) - return; - this.WindowStateChangedEvent(fUnplanned); + FireLoadEvent(); + base.OnSizeChanged(); } private void OnDestroyed() { } - private void OnSysCommand(IntPtr uParam1, IntPtr uParam2) - { - if (this.SysCommandEvent == null) - return; - this.SysCommandEvent(uParam1, uParam2); - } - - private void OnMouseIdle(bool fIdle) - { - if (this.MouseIdleEvent == null) - return; - this.MouseIdleEvent(fIdle); - } - - private void OnShow(bool fShow, bool fFirstShow) - { - if (this.ShowEvent == null) - return; - this.ShowEvent(fShow, fFirstShow); - } - - private void OnActivationChange() - { - if (this.ActivationChangeEvent == null) - return; - this.ActivationChangeEvent(); - } - private void OnTermSessionChange(uint uParam) { bool flag = false; - bool isSessionActive = this.IsSessionActive; + bool isSessionActive = IsSessionActive; switch (uParam) { case 1: case 3: - this.m_fSessionHasDisplay = true; + m_fSessionHasDisplay = true; break; case 2: case 4: - this.m_fSessionHasDisplay = false; + m_fSessionHasDisplay = false; break; case 7: - this.m_fSessionLocked = true; - this.m_fExplicitlyLocked = true; + m_fSessionLocked = true; + m_fExplicitlyLocked = true; break; case 8: - this.m_fSessionLocked = false; - flag = flag || !this.m_fExplicitlyLocked; + m_fSessionLocked = false; + flag = flag || !m_fExplicitlyLocked; break; } - if (this.IsSessionActive != isSessionActive || flag) - this.FireSessionActivate(this.IsSessionActive); + if (IsSessionActive != isSessionActive || flag) + FireSessionActivate(IsSessionActive); if (uParam != 2U && uParam != 1U && (uParam != 4U && uParam != 3U)) return; - this.FireSessionConnect(uParam == 1U || uParam == 3U); + FireSessionConnect(uParam == 1U || uParam == 3U); } - public void FireSessionActivate(bool fIsActive) => this.OnSessionActivate(fIsActive); + public void FireSessionActivate(bool fIsActive) => OnSessionActivate(fIsActive); - private void OnSessionActivate(bool fIsActive) + private new void OnSessionActivate(bool fIsActive) { - if (fIsActive && this.Visible && this.m_fExclusive) + if (fIsActive && Visible && m_fExclusive) { - this.Focus(); - this.m_remoteWindow.SendSetForeground(false); + Focus(); + m_remoteWindow.SendSetForeground(false); } - if (this.SessionActivateEvent == null) - return; - this.SessionActivateEvent(fIsActive); - } - - private void FireSessionConnect(bool fIsConnected) - { - if (this.SessionConnectEvent == null) - return; - this.SessionConnectEvent(fIsConnected); + base.OnSessionActivate(fIsActive); } private void OnNativeScreensave(bool fStart) @@ -605,52 +503,44 @@ namespace Microsoft.Iris.Render.Internal { } - public void EnableShellShutdownHook(string hookName, EventHandler handler) => this.GetShutdownHookInfo(hookName, true).Handler += handler; + public void EnableShellShutdownHook(string hookName, EventHandler handler) => GetShutdownHookInfo(hookName, true).Handler += handler; - private RenderWindow.ShutdownHookInfo GetShutdownHookInfo( - string hookName, - bool fCanAdd) + private ShutdownHookInfo GetShutdownHookInfo(string hookName, bool fCanAdd) { RenderWindow.ShutdownHookInfo desired = new RenderWindow.ShutdownHookInfo(hookName); - if (this.m_mapShutdownHooks.Lookup(desired, out uint _)) + if (m_mapShutdownHooks.Lookup(desired, out uint _)) return desired; if (fCanAdd) { - ushort uIdMsg = this.m_nextShutdownHookId++; - this.m_mapShutdownHooks.SetValue(uIdMsg, desired); - this.m_remoteWindow.SendEnableShellShutdownHook(hookName, uIdMsg); + ushort uIdMsg = m_nextShutdownHookId++; + m_mapShutdownHooks.SetValue(uIdMsg, desired); + m_remoteWindow.SendEnableShellShutdownHook(hookName, uIdMsg); } else desired = null; return desired; } - void IFormWindowCallback.OnTerminalSessionChange( - RENDERHANDLE target, - IntPtr wParam, - IntPtr lParam) + void IFormWindowCallback.OnTerminalSessionChange(RENDERHANDLE target, IntPtr wParam, IntPtr lParam) { - this.OnTermSessionChange((uint)wParam.ToInt32()); + OnTermSessionChange((uint)wParam.ToInt32()); } - void IFormWindowCallback.OnPrivateSysCommand( - RENDERHANDLE target, - IntPtr wParam, - IntPtr lParam) + void IFormWindowCallback.OnPrivateSysCommand(RENDERHANDLE target, IntPtr wParam, IntPtr lParam) { - this.OnSysCommand(wParam, lParam); + OnSysCommand(wParam, lParam); } - void IFormWindowCallback.OnMouseIdle(RENDERHANDLE target, bool fNewIdle) => this.OnMouseIdle(fNewIdle); + void IFormWindowCallback.OnMouseIdle(RENDERHANDLE target, bool fNewIdle) => OnMouseIdle(fNewIdle); - void IFormWindowCallback.OnCloseRequested(RENDERHANDLE target) => this.EngineCloseRequest(); + void IFormWindowCallback.OnCloseRequested(RENDERHANDLE target) => EngineCloseRequest(); void IFormWindowCallback.OnLoad(RENDERHANDLE target) { - this.m_fLoadComplete = true; - if (this.m_fClosing) + m_fLoadComplete = true; + if (m_fClosing) return; - this.FireLoadEvent(); + FireLoadEvent(); } void IFormWindowCallback.OnWindowDestroyed( @@ -659,321 +549,303 @@ namespace Microsoft.Iris.Render.Internal Rectangle rcFinalPosition, Point ptFinalMaximizedLocation) { - this.m_finalPlacement.NormalPosition = rcFinalPosition; - this.m_finalPlacement.MaximizedLocation = ptFinalMaximizedLocation; - this.m_finalPlacement.ShowState = nFinalShowState; - this.m_hwnd = HWND.NULL; - this.m_fClosing = true; - if (this.CloseEvent == null) - return; - this.CloseEvent(); + m_finalPlacement.NormalPosition = rcFinalPosition; + m_finalPlacement.MaximizedLocation = ptFinalMaximizedLocation; + m_finalPlacement.ShowState = nFinalShowState; + m_hwnd = HWND.NULL; + m_fClosing = true; + base.OnClose(); } void IFormWindowCallback.OnWindowCreated(RENDERHANDLE target, HWND hWnd) { - this.m_hwnd = hWnd; - this.m_device.PostCreate(); - this.UpdateText(false); - this.OnCreated(); + m_hwnd = hWnd; + m_device.PostCreate(); + UpdateText(false); + OnCreated(); } - unsafe void IFormWindowCallback.OnStateChange( - RENDERHANDLE target, - Message* pmsgRaw) + unsafe void IFormWindowCallback.OnStateChange(RENDERHANDLE target, Message* pmsgRaw) { RenderWindow.FormStateCallbackMsg* stateCallbackMsgPtr = (RenderWindow.FormStateCallbackMsg*)pmsgRaw; - if (this.m_session.IsForeignByteOrderOnWindowing) + if (m_session.IsForeignByteOrderOnWindowing) MarshalHelper.SwapByteOrder((byte*)stateCallbackMsgPtr, ref s_ByteOrder_FormStateCallbackMsg, typeof(RenderWindow.FormStateCallbackMsg), 0, 0); uint num = 0; - if (this.m_currentDisplay != null) - num = this.m_currentDisplay.UniqueId; + if (m_currentDisplay != null) + num = m_currentDisplay.UniqueId; bool flag1 = stateCallbackMsgPtr->fOnSecondaryMonitor != 0; bool flag2 = stateCallbackMsgPtr->cSpanningMonitors > 1U; bool flag3 = false; if (stateCallbackMsgPtr->idDisplay != uint.MaxValue) - flag3 = (int)num != (int)stateCallbackMsgPtr->idDisplay || this.m_fOnSecondaryMonitor != flag1 || this.m_fSpanningMonitors != flag2; - bool flag4 = this.m_nX != stateCallbackMsgPtr->rcWindowGlobal_left || this.m_nY != stateCallbackMsgPtr->rcWindowGlobal_top; - bool flag5 = this.m_nWidth != stateCallbackMsgPtr->szClientDims_cx || this.m_nHeight != stateCallbackMsgPtr->szClientDims_cy; - this.m_nX = stateCallbackMsgPtr->rcWindowGlobal_left; - this.m_nY = stateCallbackMsgPtr->rcWindowGlobal_top; - this.m_nWidth = stateCallbackMsgPtr->szClientDims_cx; - this.m_nHeight = stateCallbackMsgPtr->szClientDims_cy; - this.m_nWindowState = (WindowState)stateCallbackMsgPtr->uCurrentMode; - this.m_fVisible = stateCallbackMsgPtr->fVisible != 0; - this.m_fSpanningMonitors = flag2; - this.m_fOnSecondaryMonitor = flag1; - this.SetFullScreenExclusive(stateCallbackMsgPtr->fExclusive != 0); - bool fActivation = this.m_fActivation; - this.m_fActivation = stateCallbackMsgPtr->uActivation == 1U; + flag3 = (int)num != (int)stateCallbackMsgPtr->idDisplay || m_fOnSecondaryMonitor != flag1 || m_fSpanningMonitors != flag2; + bool flag4 = m_nX != stateCallbackMsgPtr->rcWindowGlobal_left || m_nY != stateCallbackMsgPtr->rcWindowGlobal_top; + bool flag5 = m_nWidth != stateCallbackMsgPtr->szClientDims_cx || m_nHeight != stateCallbackMsgPtr->szClientDims_cy; + m_nX = stateCallbackMsgPtr->rcWindowGlobal_left; + m_nY = stateCallbackMsgPtr->rcWindowGlobal_top; + m_nWidth = stateCallbackMsgPtr->szClientDims_cx; + m_nHeight = stateCallbackMsgPtr->szClientDims_cy; + m_nWindowState = (WindowState)stateCallbackMsgPtr->uCurrentMode; + m_fVisible = stateCallbackMsgPtr->fVisible != 0; + m_fSpanningMonitors = flag2; + m_fOnSecondaryMonitor = flag1; + SetFullScreenExclusive(stateCallbackMsgPtr->fExclusive != 0); + bool fActivation = m_fActivation; + m_fActivation = stateCallbackMsgPtr->uActivation == 1U; if (flag3) - this.m_currentDisplay = this.m_displayManager.DisplayFromUniqueId(stateCallbackMsgPtr->idDisplay); + m_currentDisplay = m_displayManager.DisplayFromUniqueId(stateCallbackMsgPtr->idDisplay); if (flag3) - this.OnMonitorChanged(); + OnMonitorChanged(); if (flag4) - this.OnLocationChanged(); + OnLocationChanged(); if (flag5) { - this.m_rootVisual.Size = new Vector2(m_nWidth, m_nHeight); - this.OnSizeChanged(); + m_rootVisual.Size = new Vector2(m_nWidth, m_nHeight); + OnSizeChanged(); } if (((int)stateCallbackMsgPtr->uRecentlyChanged & 1) != 0) - this.OnWindowStateChanged(((int)stateCallbackMsgPtr->uRecentlyChanged & 256) != 0); + OnWindowStateChanged(((int)stateCallbackMsgPtr->uRecentlyChanged & 256) != 0); if (((int)stateCallbackMsgPtr->uRecentlyChanged & 4) != 0) { - bool fFirstShow = this.m_fVisible && !this.m_fShownBefore; - if (this.m_fVisible) - this.m_fShownBefore = true; - this.OnShow(this.m_fVisible, fFirstShow); + bool fFirstShow = m_fVisible && !m_fShownBefore; + if (m_fVisible) + m_fShownBefore = true; + OnShow(m_fVisible, fFirstShow); } - if (((int)stateCallbackMsgPtr->uRecentlyChanged & 2) == 0 || this.m_fActivation == fActivation) + if (((int)stateCallbackMsgPtr->uRecentlyChanged & 2) == 0 || m_fActivation == fActivation) return; - this.OnActivationChange(); + OnActivationChange(); } void IFormWindowCallback.OnPartialDrop(RENDERHANDLE target, string file) { - if (this.m_partialDropData == null) - this.m_partialDropData = new ArrayList(); - this.m_partialDropData.Add(file); + if (m_partialDropData == null) + m_partialDropData = new ArrayList(); + m_partialDropData.Add(file); } void IFormWindowCallback.OnDropComplete(RENDERHANDLE target) { - if (this.m_partialDropData == null || this.m_partialDropData.Count <= 0) + if (m_partialDropData == null || m_partialDropData.Count <= 0) return; IEnumerable partialDropData = m_partialDropData; - this.m_partialDropData = null; - this.OnDroppedFiles(partialDropData); + m_partialDropData = null; + OnDroppedFiles(partialDropData); } - void IFormWindowCallback.OnSetFocus( - RENDERHANDLE target, - bool focused, - HWND hwndFocusChange) + void IFormWindowCallback.OnSetFocus(RENDERHANDLE target, bool focused, HWND hwndFocusChange) { - this.m_fFocused = focused; - int num = focused ? 1 : 0; - if (this.SetFocusEvent == null) - return; - this.SetFocusEvent(focused); + m_fFocused = focused; + base.OnSetFocus(focused); } - void IFormWindowCallback.OnShellShutdownHook( - RENDERHANDLE target, - ushort hookId) + void IFormWindowCallback.OnShellShutdownHook(RENDERHANDLE target, ushort hookId) { RenderWindow.ShutdownHookInfo shutdownHookInfo; - if (!this.m_mapShutdownHooks.TryGetValue(hookId, out shutdownHookInfo)) + if (!m_mapShutdownHooks.TryGetValue(hookId, out shutdownHookInfo)) return; shutdownHookInfo.OnHook(this, EventArgs.Empty); } - void IFormWindowCallback.OnNativeScreensave( - RENDERHANDLE target, - bool fStartScreensave) + void IFormWindowCallback.OnNativeScreensave(RENDERHANDLE target, bool fStartScreensave) { - this.m_session.DeferredInvoke(new DeferredHandler(this.DoNativeScreensave), fStartScreensave, DeferredInvokePriority.Idle); + m_session.DeferredInvoke(new DeferredHandler(DoNativeScreensave), fStartScreensave, DeferredInvokePriority.Idle); } - private void DoNativeScreensave(object objParam) => this.OnNativeScreensave((bool)objParam); + private void DoNativeScreensave(object objParam) => OnNativeScreensave((bool)objParam); private void DoPopAnimations(object objParam) { } - void IFormWindowCallback.OnRendererSuspended( - RENDERHANDLE target, - bool fSuspended) + void IFormWindowCallback.OnRendererSuspended(RENDERHANDLE target, bool fSuspended) { - this.FireRendererSuspended(fSuspended); + FireRendererSuspended(fSuspended); } private void FireRendererSuspended(bool fSuspended) { - if (this.RendererSuspendedEvent == null) + if (RendererSuspendedEvent == null) return; - this.RendererSuspendedEvent(m_device, new RenderWindow.RendererSuspendedArgs(fSuspended)); + RendererSuspendedEvent(m_device, new RenderWindow.RendererSuspendedArgs(fSuspended)); } - internal RenderWindow.RenderFlags GlobalRenderFlags + internal RenderFlags GlobalRenderFlags { - get => this.m_renderFlags; - set => this.SetGlobalRenderFlags(value, RenderFlags.All); + get => m_renderFlags; + set => SetGlobalRenderFlags(value, RenderFlags.All); } - internal bool SetGlobalRenderFlags( - RenderWindow.RenderFlags flags, - RenderWindow.RenderFlags mask) + internal bool SetGlobalRenderFlags(RenderFlags flags, RenderFlags mask) { bool flag = false; - RenderWindow.RenderFlags renderFlags = this.m_renderFlags & ~mask | flags & mask; - if (this.m_renderFlags != renderFlags) + RenderWindow.RenderFlags renderFlags = m_renderFlags & ~mask | flags & mask; + if (m_renderFlags != renderFlags) { - this.m_renderFlags = renderFlags; + m_renderFlags = renderFlags; flag = true; - this.m_remoteWindow.SendChangeDataBits((uint)flags, (uint)mask); + m_remoteWindow.SendChangeDataBits((uint)flags, (uint)mask); } return flag; } - public void SetWindowOptions(WindowOptions optionMask, bool enable) + public override void SetWindowOptions(WindowOptions optionMask, bool enable) { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetOptions((uint)optionMask, enable ? (uint)optionMask : 0U); + m_remoteWindow.SendSetOptions((uint)optionMask, enable ? (uint)optionMask : 0U); } - public void SetMouseIdleOptions(Size mouseIdleTolerance, uint mouseIdleDelay) + public override void SetMouseIdleOptions(Size mouseIdleTolerance, uint mouseIdleDelay) { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetMouseIdleOptions(mouseIdleTolerance, mouseIdleDelay); + m_remoteWindow.SendSetMouseIdleOptions(mouseIdleTolerance, mouseIdleDelay); } public void ForwardWindowMessage(ref Win32Api.MSG msg) { if (msg.message < 256U || msg.message > 265U) return; - this.OnForwardWndMsg(msg.message, msg.wParam, msg.lParam); + OnForwardWndMsg(msg.message, msg.wParam, msg.lParam); } private void BuildRootContainer() { - this.m_remoteWindow.SendSetSize(this.m_szDefault); - this.m_remoteWindow.SendCreateRootContainer(); - this.m_remoteWindow.SendSetHitMasks(1U, 2U, 4U, 8U); + m_remoteWindow.SendSetSize(m_szDefault); + m_remoteWindow.SendCreateRootContainer(); + m_remoteWindow.SendSetHitMasks(1U, 2U, 4U, 8U); RemoteVisual remoteVisual; - this.m_rootVisual = new VisualContainer(true, this.m_session, this, null, out remoteVisual); - this.m_rootVisual.RegisterUsage(this); - this.m_remoteWindow.SendSetRoot(remoteVisual); - this.m_rootVisual.Size = new Vector2(m_nWidth, m_nHeight); + m_rootVisual = new VisualContainer(true, m_session, this, null, out remoteVisual); + m_rootVisual.RegisterUsage(this); + m_remoteWindow.SendSetRoot(remoteVisual); + m_rootVisual.Size = new Vector2(m_nWidth, m_nHeight); } - void IRenderWindow.ClientToScreen(ref Point point) + public override void ClientToScreen(ref Point point) { Win32Api.POINT pt; - pt.x = !this.m_fRightToLeft ? point.X : this.ClientSize.Width - point.X; + pt.x = !m_fRightToLeft ? point.X : ClientSize.Width - point.X; pt.y = point.Y; - Win32Api.ClientToScreen(this.m_hwnd, ref pt); + Win32Api.ClientToScreen(m_hwnd, ref pt); point.X = pt.x; point.Y = pt.y; } - void IRenderWindow.ScreenToClient(ref Point point) + public override void ScreenToClient(ref Point point) { Win32Api.POINT pt; pt.x = point.X; pt.y = point.Y; - Win32Api.ScreenToClient(this.m_hwnd, ref pt); - point.X = !this.m_fRightToLeft ? pt.x : this.ClientSize.Width - pt.x; + Win32Api.ScreenToClient(m_hwnd, ref pt); + point.X = !m_fRightToLeft ? pt.x : ClientSize.Width - pt.x; point.Y = pt.y; } - void IRenderWindow.TakeFocus() => this.Focus(); + public override void TakeFocus() => Focus(); private void Focus() { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendTakeFocus(); + m_remoteWindow.SendTakeFocus(); } - void IRenderWindow.TakeForeground(bool fForce) + public override void TakeForeground(bool fForce) { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetForeground(fForce); + m_remoteWindow.SendSetForeground(fForce); } - void IRenderWindow.BringToTop() + public override void BringToTop() { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendBringToTop(); + m_remoteWindow.SendBringToTop(); } - void IRenderWindow.RefreshHitTarget() + public override void RefreshHitTarget() { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendRefreshHitTarget(); + m_remoteWindow.SendRefreshHitTarget(); } private void EngineCloseRequest() { - if (this.CloseRequestEvent != null) - this.CloseRequestEvent(); + if (CatchCloseRequests) + base.OnCloseRequest(); else - this.Close(FormCloseReason.RendererRequest); + Close(FormCloseReason.RendererRequest); } - public void Close(FormCloseReason nReason) + public override void Close(FormCloseReason nReason) { - if (this.m_fClosing) + if (m_fClosing) return; - this.ForceCloseWorker(nReason); + ForceCloseWorker(nReason); } - private void ForceClose() => this.ForceCloseWorker(FormCloseReason.ForcedClose); + private void ForceClose() => ForceCloseWorker(FormCloseReason.ForcedClose); private void ForceCloseWorker(FormCloseReason nReason) { - if (this.m_fClosing) + if (m_fClosing) return; - this.m_fClosing = true; - if (!this.m_session.IsValid) + m_fClosing = true; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendDestroy(); + m_remoteWindow.SendDestroy(); } public void PushWaitCursor(Cursor cursor) { - if (this.m_stkWaitCursors == null) - this.m_stkWaitCursors = new Stack(); - this.m_stkWaitCursors.Push(cursor); - this.UpdateCursors(); + if (m_stkWaitCursors == null) + m_stkWaitCursors = new Stack(); + m_stkWaitCursors.Push(cursor); + UpdateCursors(); } public void PopWaitCursor() { - this.m_stkWaitCursors.Pop(); - this.UpdateCursors(); + m_stkWaitCursors.Pop(); + UpdateCursors(); } - public void ForceMouseIdle(bool fIdle) + public override void ForceMouseIdle(bool fIdle) { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendForceMouseIdle(fIdle); + m_remoteWindow.SendForceMouseIdle(fIdle); } - public void SetCapture(IRawInputSite captureSite, bool state) + public override void SetCapture(IRawInputSite captureSite, bool state) { if (captureSite == null) return; - this.m_remoteWindow.SendSetCapture((captureSite as Visual).RemoteStub, state); + m_remoteWindow.SendSetCapture((captureSite as Visual).RemoteStub, state); } public void SetBackgroundColor(ColorF color) { - if (!(this.m_clrBackground != color)) + if (!(m_clrBackground != color)) return; - this.m_clrBackground = color; - if (!this.m_session.IsValid) + m_clrBackground = color; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetBackgroundColor(color); + m_remoteWindow.SendSetBackgroundColor(color); } - public void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) + public override void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetIcon(sModuleName, nResourceID, (uint)nOptions); + m_remoteWindow.SendSetIcon(sModuleName, nResourceID, (uint)nOptions); } - public void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) + public override void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; Debug2.Validate(edges != null, null, "Must pass non-null edges set"); Debug2.Validate(edges.Length == 4, null, "Must pass exactly 4 edges, LTRB"); @@ -988,104 +860,97 @@ namespace Microsoft.Iris.Render.Internal Debug2.Validate(edges[0].SplitPoints == edges[2].SplitPoints, null, "L+R splits differ - not supported"); Debug2.Validate(edges[1].SplitPoints == edges[3].SplitPoints, null, "T+B splits differ - not supported"); Inset insetSplits = new Inset(edges[1].SplitPoints.Left, edges[0].SplitPoints.Top, edges[1].SplitPoints.Right, edges[0].SplitPoints.Bottom); - this.m_remoteWindow.SendSetEdgeImageParts(fActiveEdges, edges[0].ModuleName, edges[0].ResourceName, edges[1].ResourceName, edges[2].ResourceName, edges[3].ResourceName, insetSplits); + m_remoteWindow.SendSetEdgeImageParts(fActiveEdges, edges[0].ModuleName, edges[0].ResourceName, edges[1].ResourceName, edges[2].ResourceName, edges[3].ResourceName, insetSplits); } - public bool EnableExternalDragDrop + public override bool EnableExternalDragDrop { - get => this.m_fEnableExternalDragDrop; + get => m_fEnableExternalDragDrop; set { - if (this.m_fEnableExternalDragDrop == value) + if (m_fEnableExternalDragDrop == value) return; - this.m_fEnableExternalDragDrop = value; - if (!this.m_session.IsValid) + m_fEnableExternalDragDrop = value; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendEnableExternalDragDrop(value); + m_remoteWindow.SendEnableExternalDragDrop(value); } } - public void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) + public override void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) { - if ((int)this.m_nDragOverResult == (int)nDragOverResult && (int)this.m_nDragDropResult == (int)nDragDropResult) + if ((int)m_nDragOverResult == (int)nDragOverResult && (int)m_nDragDropResult == (int)nDragDropResult) return; - this.m_nDragDropResult = nDragDropResult; - this.m_nDragOverResult = nDragOverResult; - if (!this.m_session.IsValid) + m_nDragDropResult = nDragDropResult; + m_nDragOverResult = nDragOverResult; + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetDragDropResult(nDragOverResult, nDragDropResult); + m_remoteWindow.SendSetDragDropResult(nDragOverResult, nDragDropResult); } - public bool IsDragInProgress + public override bool IsDragInProgress { - get => this.m_fIsDragInProgress; + get => m_fIsDragInProgress; set { - if (this.m_fIsDragInProgress == value) + if (m_fIsDragInProgress == value) return; - this.m_fIsDragInProgress = value; - if (!this.m_session.IsValid) + m_fIsDragInProgress = value; + if (!m_session.IsValid) return; - if (this.m_fIsDragInProgress) - this.m_remoteWindow.SendEnterInternalDrag(); + if (m_fIsDragInProgress) + m_remoteWindow.SendEnterInternalDrag(); else - this.m_remoteWindow.SendExitInternalDrag(); + m_remoteWindow.SendExitInternalDrag(); } } - public void Restore() + public override void Restore() { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendRestore(); + m_remoteWindow.SendRestore(); } - public void TemporarilyExitExclusiveMode() + public override void TemporarilyExitExclusiveMode() { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendTemporarilyExitExclusiveMode(); + m_remoteWindow.SendTemporarilyExitExclusiveMode(); } - public IHwndHostWindow CreateHwndHostWindow() => new HwndHostWindow(this); + public override IHwndHostWindow CreateHwndHostWindow() => new HwndHostWindow(this); public void UnlockForegroundWindow() { - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendUpdateForegroundLockState(); + m_remoteWindow.SendUpdateForegroundLockState(); } - public void BringToTop() - { - if (!this.m_session.IsValid) - return; - this.m_remoteWindow.SendBringToTop(); - } - - public void LockMouseActive(bool fLock) + public override void LockMouseActive(bool fLock) { if (fLock) { - ++this.m_nMouseLockCount; - if (this.m_nMouseLockCount != 1) + ++m_nMouseLockCount; + if (m_nMouseLockCount != 1) return; - this.SetWindowOptions(WindowOptions.LockMouseActive, true); + SetWindowOptions(WindowOptions.LockMouseActive, true); } else { - this.m_nMouseLockCount = Math.Max(this.m_nMouseLockCount - 1, 0); - if (this.m_nMouseLockCount != 0) + m_nMouseLockCount = Math.Max(m_nMouseLockCount - 1, 0); + if (m_nMouseLockCount != 0) return; - this.SetWindowOptions(WindowOptions.LockMouseActive, false); + SetWindowOptions(WindowOptions.LockMouseActive, false); } } private void UpdateText(bool fChanged) { - if (!(this.m_hwnd != HWND.NULL) || this.m_stText == null && !fChanged || !this.m_session.IsValid) + if (!(m_hwnd != HWND.NULL) || m_stText == null && !fChanged || !m_session.IsValid) return; - this.m_remoteWindow.SendSetText(this.Text); + m_remoteWindow.SendSetText(Text); } private void UpdateCursors() @@ -1093,8 +958,8 @@ namespace Microsoft.Iris.Render.Internal Cursor cursor1 = Cursor.NullCursor; Cursor nullCursor = Cursor.NullCursor; Cursor cursor2 = null; - if (this.m_stkWaitCursors != null && this.m_stkWaitCursors.Count > 0) - cursor2 = this.m_stkWaitCursors.Peek() as Cursor; + if (m_stkWaitCursors != null && m_stkWaitCursors.Count > 0) + cursor2 = m_stkWaitCursors.Peek() as Cursor; Cursor cursor3; if (cursor2 != null) { @@ -1102,51 +967,49 @@ namespace Microsoft.Iris.Render.Internal } else { - if (this.m_cursor != null) - cursor1 = this.m_cursor; - cursor3 = this.m_cursorIdle == null ? cursor1 : this.m_cursorIdle; + if (m_cursor != null) + cursor1 = m_cursor; + cursor3 = m_cursorIdle == null ? cursor1 : m_cursorIdle; } - if (!this.m_session.IsValid) + if (!m_session.IsValid) return; - this.m_remoteWindow.SendSetCursors(cursor1.ResourceId, cursor3.ResourceId); + m_remoteWindow.SendSetCursors(cursor1.ResourceId, cursor3.ResourceId); } - public bool IsPreProcessedInput => this.m_fPreProcessedInput; + public bool IsPreProcessedInput => m_fPreProcessedInput; - public delegate void RendererSuspendedHandler( - object sender, - RenderWindow.RendererSuspendedArgs args); + public delegate void RendererSuspendedHandler(object sender, RendererSuspendedArgs args); internal class ShutdownHookInfo { private string m_stHookId; - public ShutdownHookInfo(string stHookId) => this.m_stHookId = stHookId; + public ShutdownHookInfo(string stHookId) => m_stHookId = stHookId; public event EventHandler Handler; public void OnHook(object sender, EventArgs args) { - if (this.Handler == null) + if (Handler == null) return; - this.Handler(sender, args); + Handler(sender, args); } - public override bool Equals(object obj) => obj is RenderWindow.ShutdownHookInfo shutdownHookInfo && this.m_stHookId == shutdownHookInfo.m_stHookId; + public override bool Equals(object obj) => obj is ShutdownHookInfo shutdownHookInfo && m_stHookId == shutdownHookInfo.m_stHookId; - public override int GetHashCode() => this.m_stHookId.GetHashCode(); + public override int GetHashCode() => m_stHookId.GetHashCode(); } internal class RendererSuspendedArgs : EventArgs { private bool m_fSuspended; - public RendererSuspendedArgs(bool fSuspended) => this.m_fSuspended = fSuspended; + public RendererSuspendedArgs(bool fSuspended) => m_fSuspended = fSuspended; - public bool Suspended => this.m_fSuspended; + public bool Suspended => m_fSuspended; } - [System.Flags] + [Flags] internal enum RenderFlags { None = 0, diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs index 0c8adcc..72d4be9 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/IrisEngineInfo.cs @@ -12,23 +12,26 @@ namespace Microsoft.Iris.Render { public sealed class IrisEngineInfo : EngineInfo { + private RenderWindowBase m_renderWindow; private SKSurface m_skSurface; private ConnectionInfo m_connectionInfo; - public static EngineInfo CreateLocal(SKSurface skSurface) => new IrisEngineInfo(skSurface, true); + public static EngineInfo CreateLocal(SKSurface skSurface, RenderWindowBase renderWindow) => new IrisEngineInfo(skSurface, renderWindow, true); - public static EngineInfo CreateRemote(SKSurface skSurface) => new IrisEngineInfo(skSurface, true, TransportProtocol.TCP, "127.0.0.1", false); + public static EngineInfo CreateRemote(SKSurface skSurface, RenderWindowBase renderWindow) => new IrisEngineInfo(skSurface, renderWindow, true, TransportProtocol.TCP, "127.0.0.1", false); - internal IrisEngineInfo(SKSurface skSurface, bool isPrimary) : base(EngineType.Iris) + internal IrisEngineInfo(SKSurface skSurface, RenderWindowBase renderWindow, bool isPrimary) : base(EngineType.Iris) { if (!isPrimary) throw new NotImplementedException("Local connections to an existing engine are not supported yet"); this.m_connectionInfo = new LocalConnectionInfo(); + this.m_renderWindow = renderWindow; this.m_skSurface = skSurface; } internal IrisEngineInfo( SKSurface skSurface, + RenderWindowBase renderWindow, bool isPrimary, TransportProtocol protocol, string sessionName, @@ -38,10 +41,12 @@ namespace Microsoft.Iris.Render if (!isPrimary) throw new NotImplementedException("Local connections to an existing engine are not supported yet"); this.m_connectionInfo = new RemoteConnectionInfo(protocol, sessionName, swapByteOrder); + this.m_renderWindow = renderWindow; this.m_skSurface = skSurface; } internal ConnectionInfo ConnectionInfo => this.m_connectionInfo; + internal RenderWindowBase Window => this.m_renderWindow; internal SKSurface Surface => this.m_skSurface; } } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs index cc3a916..ef82cd7 100644 --- a/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/Protocols/Splash/Rendering/RemoteAnimationManager.cs @@ -28,15 +28,15 @@ namespace Microsoft.Iris.Render.Protocols.Splash.Rendering RenderPort port = _priv_protocolInstance.Port; RENDERHANDLE managerClassHandle = _priv_protocolInstance.AnimationManager_ClassHandle; RemoteAnimationManager animationManager = new RemoteAnimationManager(port, _priv_owner); - uint num = (uint)sizeof(RemoteAnimationManager.Msg3_Create); + uint num = (uint)sizeof(Msg3_Create); // ISSUE: untyped stack allocation byte* pMem = stackalloc byte[(int)num]; - RemoteAnimationManager.Msg3_Create* msg3CreatePtr = (RemoteAnimationManager.Msg3_Create*)pMem; + Msg3_Create* msg3CreatePtr = (Msg3_Create*)pMem; msg3CreatePtr->_priv_size = num; msg3CreatePtr->_priv_msgid = 3U; msg3CreatePtr->_priv_idObjectSubject = animationManager.m_renderHandle; if (port.ForeignByteOrder) - MarshalHelper.SwapByteOrder(pMem, ref s_priv_ByteOrder_Msg3_Create, typeof(RemoteAnimationManager.Msg3_Create), 0, 0); + MarshalHelper.SwapByteOrder(pMem, ref s_priv_ByteOrder_Msg3_Create, typeof(Msg3_Create), 0, 0); port.CreateRemoteObject(managerClassHandle, animationManager.m_renderHandle, (Message*)msg3CreatePtr); return animationManager; } diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderWindowBase.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderWindowBase.cs new file mode 100644 index 0000000..5f842d3 --- /dev/null +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/RenderWindowBase.cs @@ -0,0 +1,118 @@ +using Microsoft.Iris.Input; +using Microsoft.Iris.Render.Graphics; +using Microsoft.Iris.Render.Internal; +using System; + +namespace Microsoft.Iris.Render +{ + public abstract class RenderWindowBase : IRenderWindow, ITreeOwner + { + public abstract int Left { get; } + public abstract int Top { get; } + public abstract int Right { get; } + public abstract int Bottom { get; } + public abstract int Width { get; } + public abstract int Height { get; } + public abstract HWND WindowHandle { get; } + public abstract Size ClientSize { get; set; } + public abstract Size InitialClientSize { get; set; } + public abstract FormPlacement InitialPlacement { set; } + public abstract FormPlacement FinalPlacement { get; } + public abstract int MinResizeWidth { get; set; } + public abstract int MaxResizeWidth { get; set; } + public abstract Point Position { get; set; } + public abstract string Text { get; set; } + public abstract Cursor Cursor { get; set; } + public abstract Cursor IdleCursor { get; set; } + public abstract bool Visible { get; set; } + public abstract bool IsLoaded { get; } + public abstract ColorF BackgroundColor { get; set; } + public abstract bool EnableExternalDragDrop { get; set; } + public abstract bool IsDragInProgress { get; set; } + public abstract IDisplay CurrentDisplay { get; set; } + public abstract bool FullScreenExclusive { get; set; } + public abstract bool ActivationState { get; } + public abstract WindowState WindowState { get; set; } + public abstract FormStyleInfo Styles { get; set; } + public abstract HWND AppNotifyWindow { set; } + public abstract IVisualContainer VisualRoot { get; } + TreeNode ITreeOwner.Root { get; } + public bool CatchCloseRequests => CloseRequestEvent != null; + + internal abstract bool IsClosing { get; } + + internal abstract bool IsSessionActive { get; } + + internal abstract bool IsSessionRemote { get; } + + internal abstract bool IsSpanningMonitors { get; } + + internal abstract bool IsOnSecondaryMonitor { get; } + + internal abstract ColorF OutlineAllColor { get; set; } + + internal abstract ColorF OutlineMarkedColor { get; set; } + + internal abstract GraphicsDevice GraphicsDevice { get; } + + internal abstract RenderSession Session { get; } + + internal abstract GraphicsDeviceType GraphicsDeviceType { get; } + + internal abstract bool IsRightToLeft { get; } + + public event LocationChangedHandler LocationChangedEvent; + public event SizeChangedHandler SizeChangedEvent; + public event MonitorChangedHandler MonitorChangedEvent; + public event WindowStateChangedHandler WindowStateChangedEvent; + public event SysCommandHandler SysCommandEvent; + public event MouseIdleHandler MouseIdleEvent; + public event ShowHandler ShowEvent; + public event ActivationChangeHandler ActivationChangeEvent; + public event SessionActivateHandler SessionActivateEvent; + public event SessionConnectHandler SessionConnectEvent; + public event SetFocusHandler SetFocusEvent; + public event LoadHandler LoadEvent; + public event CloseHandler CloseEvent; + public event CloseRequestHandler CloseRequestEvent; + public event ForwardMessageHandler ForwardMessageEvent; + + public abstract void BringToTop(); + public abstract void ClientToScreen(ref Point point); + public abstract void Close(FormCloseReason fcrCloseReason); + public abstract IHwndHostWindow CreateHwndHostWindow(); + public abstract void ForceMouseIdle(bool fIdle); + public abstract void Initialize(); + public abstract void LockMouseActive(bool fActive); + public abstract void RefreshHitTarget(); + public abstract void Restore(); + public abstract void ScreenToClient(ref Point point); + public abstract void SetCapture(IRawInputSite captureSite, bool state); + public abstract void SetCurrentDisplay(IDisplay inputIDisplay); + public abstract void SetDragDropResult(uint nDragOverResult, uint nDragDropResult); + public abstract void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges); + public abstract void SetFullScreenExclusive(bool fNewValue); + public abstract void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions); + public abstract void SetMouseIdleOptions(Size sizeMouseIdleTolerance, uint nMouseIdleDelay); + public abstract void SetWindowOptions(WindowOptions options, bool enable); + public abstract void TakeFocus(); + public abstract void TakeForeground(bool fForce); + public abstract void TemporarilyExitExclusiveMode(); + + protected virtual void OnForwardWndMsg(uint msg, IntPtr wParam, IntPtr lParam) => ForwardMessageEvent?.Invoke(msg, wParam, lParam); + protected virtual void FireLoadEvent() => LoadEvent?.Invoke(); + protected virtual void OnLocationChanged() => LocationChangedEvent?.Invoke(Position); + protected virtual void OnSizeChanged() => SizeChangedEvent?.Invoke(); + protected virtual void OnMonitorChanged() => MonitorChangedEvent?.Invoke(); + protected virtual void OnWindowStateChanged(bool fUnplanned) => WindowStateChangedEvent?.Invoke(fUnplanned); + protected virtual void OnSysCommand(IntPtr uParam1, IntPtr uParam2) => SysCommandEvent?.Invoke(uParam1, uParam2); + protected virtual void OnMouseIdle(bool fIdle) => MouseIdleEvent?.Invoke(fIdle); + protected virtual void OnShow(bool fShow, bool fFirstShow) => ShowEvent?.Invoke(fShow, fFirstShow); + protected virtual void OnActivationChange() => ActivationChangeEvent?.Invoke(); + protected virtual void OnSessionActivate(bool fIsActive) => SessionActivateEvent?.Invoke(fIsActive); + protected virtual void FireSessionConnect(bool fIsConnected) => SessionConnectEvent?.Invoke(fIsConnected); + protected virtual void OnClose() => CloseEvent?.Invoke(); + protected virtual void OnCloseRequest() => CloseRequestEvent?.Invoke(); + protected virtual void OnSetFocus(bool focused) => SetFocusEvent?.Invoke(focused); + } +} diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/WpfRenderWindow.WPF.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WpfRenderWindow.WPF.cs new file mode 100644 index 0000000..1c437e9 --- /dev/null +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/WpfRenderWindow.WPF.cs @@ -0,0 +1,316 @@ +#if WPF + +using Microsoft.Iris.Input; +using Microsoft.Iris.Render.Graphics; +using Microsoft.Iris.Render.Internal; +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Interop; +using System.Windows.Media; + +namespace Microsoft.Iris.Render +{ + public sealed class WpfRenderWindow : RenderWindowBase + { + private bool isDragging; + private bool isFullscreen; + private Window WpfWindow { get; set; } + private WindowInteropHelper InteropHelper { get; set; } + + public WpfRenderWindow(Window window) + { + WpfWindow = window; + InteropHelper = new WindowInteropHelper(window); + + WpfWindow.SizeChanged += WpfWindow_SizeChanged; + WpfWindow.Activated += WpfWindow_Activated; + WpfWindow.GotFocus += WpfWindow_GotFocus; + WpfWindow.LostFocus += WpfWindow_LostFocus; + WpfWindow.Closed += WpfWindow_Closed; + WpfWindow.Closing += WpfWindow_Closing; + WpfWindow.DragEnter += WpfWindow_DragStarting; + //WpfWindow.DropCompleted += XamlWindowContent_DropCompleted; + WpfWindow.Loaded += WpfWindow_Loaded; + } + + public override int Left => (int)WpfWindow.Left; + + public override int Top => (int)WpfWindow.Top; + + public override int Right => (int)(WpfWindow.Left + WpfWindow.Width); + + public override int Bottom => (int)(WpfWindow.Left + WpfWindow.Height); + + public override int Width => (int)WpfWindow.Width; + + public override int Height => (int)WpfWindow.Height; + + public override HWND WindowHandle => new HWND(InteropHelper.Handle); + + public override Size ClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override Size InitialClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override FormPlacement InitialPlacement { set => throw new NotImplementedException(); } + + public override FormPlacement FinalPlacement => throw new NotImplementedException(); + + public override int MinResizeWidth + { + get => (int)WpfWindow.MinWidth; + set => WpfWindow.MinWidth = value; + } + public override int MaxResizeWidth { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override Point Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override string Text + { + get => WpfWindow.Title; + set => WpfWindow.Title = value; + } + public override Cursor Cursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override Cursor IdleCursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override bool Visible + { + get => WpfWindow.IsVisible; + set + { + if (value) + WpfWindow.Show(); + else + WpfWindow.Hide(); + } + } + + public override bool IsLoaded => WpfWindow.IsLoaded; + + public override ColorF BackgroundColor + { + get + { + Color color = Colors.Transparent; + if (WpfWindow.Content is Control ctl && ctl.Background is SolidColorBrush brush) + color = brush.Color; + + return new ColorF(color.A / 255, color.R / 255, color.G / 255, color.B / 255); + } + set + { + if (WpfWindow.Content is Control ctl) + { + ctl.Background = new SolidColorBrush(Color.FromArgb( + (byte)(value.A * 255), + (byte)(value.R * 255), + (byte)(value.G * 255), + (byte)(value.B * 255) + )); + } + } + } + public override bool EnableExternalDragDrop + { + get => WpfWindow.AllowDrop; + set => WpfWindow.AllowDrop = true; + } + public override bool IsDragInProgress { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override IDisplay CurrentDisplay { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override bool FullScreenExclusive + { + get => isFullscreen; + set + { + isFullscreen = value; + if (isFullscreen) + { + WpfWindow.WindowStyle = WindowStyle.None; + WpfWindow.WindowState = System.Windows.WindowState.Maximized; + } + else + { + WpfWindow.WindowStyle = WindowStyle.SingleBorderWindow; + WpfWindow.WindowState = System.Windows.WindowState.Normal; + } + } + } + + public override bool ActivationState => WpfWindow.IsActive; + + public override WindowState WindowState + { + get + { + switch (WpfWindow.WindowState) + { + case System.Windows.WindowState.Normal: + return WindowState.Normal; + + case System.Windows.WindowState.Minimized: + return WindowState.Minimized; + + case System.Windows.WindowState.Maximized: + return WindowState.Maximized; + + default: + throw new InvalidOperationException("Unknown window state"); + } + } + set + { + switch (value) + { + case WindowState.Normal: + WpfWindow.WindowState = System.Windows.WindowState.Normal; + break; + case WindowState.Minimized: + WpfWindow.WindowState = System.Windows.WindowState.Minimized; + break; + case WindowState.Maximized: + WpfWindow.WindowState = System.Windows.WindowState.Maximized; + break; + } + } + } + public override FormStyleInfo Styles { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override HWND AppNotifyWindow { set => throw new NotImplementedException(); } + + public override IVisualContainer VisualRoot => throw new NotImplementedException(); + + TreeNode Root => throw new NotImplementedException(); + + private bool _IsClosing = false; + internal override bool IsClosing => _IsClosing; + + internal override bool IsSessionActive => throw new NotImplementedException(); + + internal override bool IsSessionRemote => false; + + internal override bool IsSpanningMonitors => throw new NotImplementedException(); + + internal override bool IsOnSecondaryMonitor => throw new NotImplementedException(); + + internal override ColorF OutlineAllColor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + internal override ColorF OutlineMarkedColor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + internal override GraphicsDevice GraphicsDevice => throw new NotImplementedException(); + + internal override RenderSession Session => throw new NotImplementedException(); + + internal override GraphicsDeviceType GraphicsDeviceType => GraphicsDeviceType.Skia; + + internal override bool IsRightToLeft => CultureInfo.CurrentCulture.TextInfo.IsRightToLeft; + + private void WpfWindow_SizeChanged(object sender, EventArgs e) => OnSizeChanged(); + private void WpfWindow_Activated(object sender, EventArgs e) + { + OnShow(true, WpfWindow.ShowActivated); + OnActivationChange(); + } + private void WpfWindow_Loaded(object sender, RoutedEventArgs e) => FireLoadEvent(); + private void WpfWindow_GotFocus(object sender, RoutedEventArgs e) => OnSetFocus(true); + private void WpfWindow_LostFocus(object sender, RoutedEventArgs e) => OnSetFocus(false); + private void WpfWindow_Closed(object sender, EventArgs e) => OnClose(); + private void WpfWindow_Closing(object sender, EventArgs e) => _IsClosing = true; + private void XamlWindowContent_DropCompleted(object sender, EventArgs e) => isDragging = false; + private void WpfWindow_DragStarting(object sender, DragEventArgs args) => isDragging = true; + + public override void BringToTop() => WpfWindow.Activate(); + + public override void ClientToScreen(ref Point point) + { + var p = WpfWindow.PointToScreen(new System.Windows.Point(point.X, point.Y)); + point = new Point((int)p.X, (int)p.Y); + } + + public override void Close(FormCloseReason fcrCloseReason) => WpfWindow.Close(); + + public override IHwndHostWindow CreateHwndHostWindow() + { + throw new NotImplementedException(); + } + + public override void ForceMouseIdle(bool fIdle) + { + throw new NotImplementedException(); + } + + public override void Initialize() + { + + } + + public override void LockMouseActive(bool fActive) + { + throw new NotImplementedException(); + } + + public override void RefreshHitTarget() + { + throw new NotImplementedException(); + } + + public override void Restore() + { + WpfWindow.WindowState = System.Windows.WindowState.Normal; + } + + public override void ScreenToClient(ref Point point) + { + var p = WpfWindow.PointFromScreen(new System.Windows.Point(point.X, point.Y)); + point = new Point((int)p.X, (int)p.Y); + } + + public override void SetCapture(IRawInputSite captureSite, bool state) + { + if (state) + WpfWindow.CaptureMouse(); + else + WpfWindow.ReleaseMouseCapture(); + } + + public override void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) + { + throw new NotImplementedException(); + } + + public override void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) + { + throw new NotImplementedException(); + } + + public override void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) + { + WpfWindow.Icon = new System.Windows.Media.Imaging.BitmapImage(new Uri(sModuleName)); + } + + public override void SetMouseIdleOptions(Size sizeMouseIdleTolerance, uint nMouseIdleDelay) + { + throw new NotImplementedException(); + } + + public override void SetWindowOptions(WindowOptions options, bool enable) + { + if (options.HasFlag(WindowOptions.FreeformResize)) + WpfWindow.ResizeMode = enable ? ResizeMode.CanResize : ResizeMode.NoResize; + if (options.HasFlag(WindowOptions.EnableCursor)) + WpfWindow.Cursor = enable ? System.Windows.Input.Cursors.Arrow : System.Windows.Input.Cursors.None; + } + + public override void TakeFocus() => WpfWindow.Focus(); + + public override void TakeForeground(bool fForce) + { + if (fForce) + WpfWindow.Activate(); + } + + public override void TemporarilyExitExclusiveMode() + { + throw new NotImplementedException(); + } + + public override void SetCurrentDisplay(IDisplay inputIDisplay) => CurrentDisplay = inputIDisplay; + + public override void SetFullScreenExclusive(bool fNewValue) => FullScreenExclusive = fNewValue; + } +} + +#endif diff --git a/UIX.RenderApi.Skia/Microsoft/Iris/Render/XamlRenderWindow.UWP.cs b/UIX.RenderApi.Skia/Microsoft/Iris/Render/XamlRenderWindow.UWP.cs new file mode 100644 index 0000000..8c8914a --- /dev/null +++ b/UIX.RenderApi.Skia/Microsoft/Iris/Render/XamlRenderWindow.UWP.cs @@ -0,0 +1,297 @@ +#if UWP + +using Microsoft.Iris.Input; +using Microsoft.Iris.Render.Graphics; +using Microsoft.Iris.Render.Internal; +using System; +using System.Globalization; +using Windows.Foundation; +using Windows.UI.Core; +using Windows.UI.ViewManagement; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Media; + +namespace Microsoft.Iris.Render +{ + public sealed class XamlRenderWindow : RenderWindowBase + { + private bool isDragging = false; + private Window XamlWindow { get; set; } + private ApplicationView CurrentView => ApplicationView.GetForCurrentView(); + private Rect VisibleBounds => CurrentView.VisibleBounds; + + public XamlRenderWindow(Window window) + { + XamlWindow = window; + + XamlWindow.SizeChanged += XamlWindow_SizeChanged; + XamlWindow.Activated += XamlWindow_Activated; + XamlWindow.Content.GotFocus += XamlWindowContent_GotFocus; + XamlWindow.Content.LostFocus += XamlWindowContent_LostFocus; + XamlWindow.Closed += XamlWindow_Closed; + XamlWindow.Content.DragStarting += XamlWindowContent_DragStarting; + XamlWindow.Content.DropCompleted += XamlWindowContent_DropCompleted; + if (XamlWindow.Content is FrameworkElement elem) + { + elem.Loaded += XamlWindowContent_Loaded; + } + } + + public override int Left => (int)VisibleBounds.Left; + + public override int Top => (int)VisibleBounds.Top; + + public override int Right => (int)VisibleBounds.Right; + + public override int Bottom => (int)VisibleBounds.Bottom; + + public override int Width => (int)VisibleBounds.Width; + + public override int Height => (int)VisibleBounds.Height; + + public override HWND WindowHandle => throw new PlatformNotSupportedException("UWP cannot use HWNDs directly"); + + public override Size ClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override Size InitialClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override FormPlacement InitialPlacement { set => throw new NotImplementedException(); } + + public override FormPlacement FinalPlacement => throw new NotImplementedException(); + + public override int MinResizeWidth + { + get => (int)ApplicationView.PreferredLaunchViewSize.Width; + set => CurrentView.SetPreferredMinSize(new Windows.Foundation.Size(value, 320)); + } + public override int MaxResizeWidth { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override Point Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override string Text + { + get => CurrentView.Title; + set => CurrentView.Title = value; + } + public override Cursor Cursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override Cursor IdleCursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override bool Visible + { + get => XamlWindow.Visible; + set => XamlWindow.Content.Visibility = value ? Visibility.Visible : Visibility.Collapsed; + } + + public override bool IsLoaded => XamlWindow != null; + + public override ColorF BackgroundColor + { + get + { + Windows.UI.Color color = Windows.UI.Colors.Transparent; + if (XamlWindow.Content is Control ctl && ctl.Background is SolidColorBrush brush) + color = brush.Color; + + return new ColorF(color.A / 255, color.R / 255, color.G / 255, color.B / 255); + } + set + { + if (XamlWindow.Content is Control ctl) + { + ctl.Background = new SolidColorBrush(new Windows.UI.Color + { + A = (byte)(value.A * 255), + R = (byte)(value.R * 255), + G = (byte)(value.G * 255), + B = (byte)(value.B * 255), + }); + } + } + } + public override bool EnableExternalDragDrop + { + get => XamlWindow.Content.AllowDrop; + set => XamlWindow.Content.AllowDrop = true; + } + public override bool IsDragInProgress { get => isDragging; set => throw new NotImplementedException(); } + public override IDisplay CurrentDisplay { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override bool FullScreenExclusive + { + get => CurrentView.IsFullScreenMode; + set + { + if (value) + CurrentView.TryEnterFullScreenMode(); + else + CurrentView.ExitFullScreenMode(); + } + } + + public override bool ActivationState => XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedInForeground; + + public override WindowState WindowState + { + get + { + if (CurrentView.ViewMode == ApplicationViewMode.CompactOverlay) + return WindowState.Normal; + else if (XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedNotForeground + || XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.Deactivated + || !XamlWindow.Visible) + return WindowState.Minimized; + else if (CurrentView.AdjacentToLeftDisplayEdge && CurrentView.AdjacentToRightDisplayEdge) + return WindowState.Maximized; + + return WindowState.Normal; + } + set + { + switch (value) + { + case WindowState.Normal: + XamlWindow.Content.Visibility = Visibility.Visible; + CurrentView.TryEnterViewModeAsync(ApplicationViewMode.Default); + break; + case WindowState.Minimized: + XamlWindow.Content.Visibility = Visibility.Collapsed; + break; + case WindowState.Maximized: + XamlWindow.Content.Visibility = Visibility.Visible; + break; + } + } + } + public override FormStyleInfo Styles { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public override HWND AppNotifyWindow { set => throw new NotImplementedException(); } + + public override IVisualContainer VisualRoot => throw new NotImplementedException(); + + TreeNode Root => throw new NotImplementedException(); + + internal override bool IsClosing => throw new NotImplementedException(); + + internal override bool IsSessionActive => throw new NotImplementedException(); + + internal override bool IsSessionRemote => false; + + internal override bool IsSpanningMonitors => throw new NotImplementedException(); + + internal override bool IsOnSecondaryMonitor => throw new NotImplementedException(); + + internal override ColorF OutlineAllColor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + internal override ColorF OutlineMarkedColor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + + internal override GraphicsDevice GraphicsDevice => throw new NotImplementedException(); + + internal override RenderSession Session => throw new NotImplementedException(); + + internal override GraphicsDeviceType GraphicsDeviceType => GraphicsDeviceType.Skia; + + internal override bool IsRightToLeft => CultureInfo.CurrentCulture.TextInfo.IsRightToLeft; + + private void XamlWindow_SizeChanged(object sender, WindowSizeChangedEventArgs e) => OnSizeChanged(); + private void XamlWindow_Activated(object sender, WindowActivatedEventArgs e) + { + OnShow(true, e.WindowActivationState == CoreWindowActivationState.CodeActivated); + OnActivationChange(); + } + private void XamlWindowContent_Loaded(object sender, RoutedEventArgs e) => FireLoadEvent(); + private void XamlWindowContent_GotFocus(object sender, RoutedEventArgs e) => OnSetFocus(true); + private void XamlWindowContent_LostFocus(object sender, RoutedEventArgs e) => OnSetFocus(false); + private void XamlWindow_Closed(object sender, CoreWindowEventArgs e) => OnClose(); + private void XamlWindowContent_DropCompleted(object sender, DropCompletedEventArgs e) => isDragging = false; + private void XamlWindowContent_DragStarting(UIElement sender, DragStartingEventArgs args) => isDragging = true; + + public override void BringToTop() => XamlWindow.Activate(); + + public override void ClientToScreen(ref Point point) + { + throw new NotImplementedException(); + } + + public override void Close(FormCloseReason fcrCloseReason) => XamlWindow.Close(); + + public override IHwndHostWindow CreateHwndHostWindow() + { + throw new NotImplementedException(); + } + + public override void ForceMouseIdle(bool fIdle) + { + throw new NotImplementedException(); + } + + public override void Initialize() + { + + } + + public override void LockMouseActive(bool fActive) + { + throw new NotImplementedException(); + } + + public override void RefreshHitTarget() + { + throw new NotImplementedException(); + } + + public override void Restore() + { + throw new NotImplementedException(); + } + + public override void ScreenToClient(ref Point point) + { + throw new NotImplementedException(); + } + + public override void SetCapture(IRawInputSite captureSite, bool state) + { + if (state) + XamlWindow.CoreWindow.SetPointerCapture(); + else + XamlWindow.CoreWindow.ReleasePointerCapture(); + } + + public override void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) + { + throw new NotImplementedException(); + } + + public override void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) + { + throw new NotImplementedException(); + } + + public override void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) + { + throw new NotImplementedException(); + } + + public override void SetMouseIdleOptions(Size sizeMouseIdleTolerance, uint nMouseIdleDelay) + { + throw new NotImplementedException(); + } + + public override void SetWindowOptions(WindowOptions options, bool enable) + { + + } + + public override void TakeFocus() => XamlWindow.Activate(); + + public override void TakeForeground(bool fForce) + { + if (fForce) + XamlWindow.Activate(); + } + + public override void TemporarilyExitExclusiveMode() + { + throw new NotImplementedException(); + } + + public override void SetCurrentDisplay(IDisplay inputIDisplay) => CurrentDisplay = inputIDisplay; + + public override void SetFullScreenExclusive(bool fNewValue) => FullScreenExclusive = fNewValue; + } +} + +#endif diff --git a/UIX.RenderApi.Skia/UIX.RenderApi.Skia.csproj b/UIX.RenderApi.Skia/UIX.RenderApi.Skia.csproj index 4851494..b7a687d 100644 --- a/UIX.RenderApi.Skia/UIX.RenderApi.Skia.csproj +++ b/UIX.RenderApi.Skia/UIX.RenderApi.Skia.csproj @@ -1,7 +1,7 @@  - + - netstandard2.0 + netstandard2.0;uap10.0.19041;net5.0-windows {CB2B7609-C7B8-4E2A-82D8-DD631B70B621} Library UIX.RenderApi.Skia @@ -11,7 +11,42 @@ + + + + + + + + + + $(DefineConstants);UWP + + + + + + + + + 6.2.11 + + + + + + $(DefineConstants);WPF + true + + + + + diff --git a/UIX.Skia/Microsoft/Iris/Application.cs b/UIX.Skia/Microsoft/Iris/Application.cs index 482fcc6..6ae9134 100644 --- a/UIX.Skia/Microsoft/Iris/Application.cs +++ b/UIX.Skia/Microsoft/Iris/Application.cs @@ -137,7 +137,7 @@ namespace Microsoft.Iris public static bool IsDebug { get; set; } - public static void Initialize(SkiaSharp.SKSurface skSurface) + public static void Initialize(SkiaSharp.SKSurface skSurface, RenderWindowBase renderWindow) { if (IsInitialized) throw new InvalidOperationException("Application already initialized"); @@ -145,7 +145,7 @@ namespace Microsoft.Iris Debug.Assert.IsNotNull(skSurface, nameof(skSurface)); VerifyTrustedEnvironment(); - s_session = new UISession(skSurface); + s_session = new UISession(skSurface, renderWindow); s_session.IsRtl = s_IsRTL; s_session.InputManager.KeyCoalescePolicy = new KeyCoalesceFilter(QueryKeyCoalesce); GraphicsDeviceType graphicsType = ChooseRenderingGraphicsDevice(s_renderType); diff --git a/UIX.Skia/Microsoft/Iris/Session/UISession.cs b/UIX.Skia/Microsoft/Iris/Session/UISession.cs index 8df5b42..b904137 100644 --- a/UIX.Skia/Microsoft/Iris/Session/UISession.cs +++ b/UIX.Skia/Microsoft/Iris/Session/UISession.cs @@ -46,13 +46,14 @@ namespace Microsoft.Iris.Session private static readonly DeferredHandler s_deferredPlaySound = new DeferredHandler(DeferredPlaySound); private static readonly DeferredHandler s_deferredPlaySystemSound = new DeferredHandler(DeferredPlaySystemSound); - public UISession(SKSurface skSurface) - : this(skSurface, null, null, 0U) + public UISession(SKSurface skSurface, RenderWindowBase renderWindow) + : this(skSurface, renderWindow, null, null, 0U) { } public UISession( SKSurface skSurface, + RenderWindowBase renderWindow, EventHandler rendererConnectedCallback, TimeoutHandler handlerTimeout, uint timeoutSecValue) @@ -69,7 +70,7 @@ namespace Microsoft.Iris.Session int pdwDefaultLayout; Win32Api.IFWIN32(Win32Api.GetProcessDefaultLayout(out pdwDefaultLayout)); _rtl = pdwDefaultLayout == 1; - _engine = RenderApi.CreateEngine(IrisEngineInfo.CreateLocal(skSurface), Dispatcher); + _engine = RenderApi.CreateEngine(IrisEngineInfo.CreateLocal(skSurface, renderWindow), Dispatcher); _session = _engine.Session; TextImageCache.Initialize(this); ScavengeImageCache.Initialize(this); diff --git a/Xune.Uno/IrisCoreWindow.cs b/Xune.Uno/IrisCoreWindow.cs new file mode 100644 index 0000000..22da581 --- /dev/null +++ b/Xune.Uno/IrisCoreWindow.cs @@ -0,0 +1,275 @@ +using Microsoft.Iris.Input; +using Microsoft.Iris.Render.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Windows.Foundation; +using Windows.UI.ViewManagement; +using Windows.UI.Xaml; + +namespace Microsoft.Iris.Render +{ + public sealed class IrisCoreWindow : RenderWindowBase + { + private bool isDragging = false; + private Window XamlWindow { get; set; } + private ApplicationView CurrentView => ApplicationView.GetForCurrentView(); + private Rect VisibleBounds => CurrentView.VisibleBounds; + + public IrisCoreWindow(Window window) + { + XamlWindow = window; + + XamlWindow.SizeChanged += XamlWindow_SizeChanged; + XamlWindow.Activated += XamlWindow_Activated; + XamlWindow.Content.GotFocus += XamlWindowContent_GotFocus; + XamlWindow.Content.LostFocus += XamlWindowContent_LostFocus; + XamlWindow.Closed += XamlWindow_Closed; + XamlWindow.Content.DragStarting += XamlWindowContent_DragStarting; + XamlWindow.Content.DropCompleted += XamlWindowContent_DropCompleted; + if (XamlWindow.Content is FrameworkElement elem) + { + elem.Loaded += XamlWindowContent_Loaded; + } + } + + public int Left => (int)VisibleBounds.Left; + + public int Top => (int)VisibleBounds.Top; + + public int Right => (int)VisibleBounds.Right; + + public int Bottom => (int)VisibleBounds.Bottom; + + public int Width => (int)VisibleBounds.Width; + + public int Height => (int)VisibleBounds.Height; + + public HWND WindowHandle => throw new PlatformNotSupportedException("UWP cannot use HWNDs directly"); + + public Microsoft.Iris.Render.Size ClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public Microsoft.Iris.Render.Size InitialClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public FormPlacement InitialPlacement { set => throw new NotImplementedException(); } + + public FormPlacement FinalPlacement => throw new NotImplementedException(); + + public int MinResizeWidth + { + get => (int)ApplicationView.PreferredLaunchViewSize.Width; + set => CurrentView.SetPreferredMinSize(new Windows.Foundation.Size(value, 320)); + } + public int MaxResizeWidth { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public Microsoft.Iris.Render.Point Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public string Text + { + get => CurrentView.Title; + set => CurrentView.Title = value; + } + public Cursor Cursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public Cursor IdleCursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool Visible + { + get => XamlWindow.Visible; + set => XamlWindow.Visible = value; + } + + public bool IsLoaded => XamlWindow != null; + + public ColorF BackgroundColor + { + get + { + Windows.UI.Color color = Windows.UI.Colors.Transparent; + if (XamlWindow.Content is FrameworkElement elem && elem.Background is SolidColorBrush brush) + color = brush.Color; + + return new ColorF(color.A / 255, color.R / 255, color.G / 255, color.B / 255); + } + set + { + if (XamlWindow.Content is FrameworkElement elem) + { + elem.Background = new SolidColorBrush(new Windows.UI.Color + { + A = (byte)(value.A * 255), + R = (byte)(value.R * 255), + G = (byte)(value.G * 255), + B = (byte)(value.B * 255), + }); + } + } + } + public bool EnableExternalDragDrop + { + get => XamlWindow.Content.AllowDrop; + set => XamlWindow.Content.AllowDrop = true; + } + public bool IsDragInProgress { get => isDragging; set => throw new NotImplementedException(); } + public IDisplay CurrentDisplay { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public bool FullScreenExclusive + { + get => CurrentView.IsFullScreenMode; + set => CurrentView.TryEnterFullScreenMode(); + } + + public bool ActivationState => XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedInForeground; + + public WindowState WindowState + { + get + { + if (CurrentView.ViewMode == ApplicationViewMode.CompactOverlay) + return WindowState.Normal; + else if (XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedNotForeground + || XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.Deactivated + || !XamlWindow.Visible) + return WindowState.Minimized; + else if (CurrentView.AdjacentToLeftDisplayEdge && CurrentView.AdjacentToRightDisplayEdge) + return WindowState.Maximized; + + return WindowState.Normal; + } + set + { + switch (value) + { + case WindowState.Normal: + XamlWindow.Visible = true; + CurrentView.TryEnterViewModeAsync(ApplicationViewMode.Default); + break; + case WindowState.Minimized: + XamlWindow.Visible = false; + break; + case WindowState.Maximized: + XamlWindow.Visible = true; + break; + } + } + } + public FormStyleInfo Styles { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } + public HWND AppNotifyWindow { set => throw new NotImplementedException(); } + + public IVisualContainer VisualRoot => throw new NotImplementedException(); + + public event LocationChangedHandler LocationChangedEvent; + public event SizeChangedHandler SizeChangedEvent; + public event MonitorChangedHandler MonitorChangedEvent; + public event WindowStateChangedHandler WindowStateChangedEvent; + public event SysCommandHandler SysCommandEvent; + public event MouseIdleHandler MouseIdleEvent; + public event ShowHandler ShowEvent; + public event ActivationChangeHandler ActivationChangeEvent; + public event SessionActivateHandler SessionActivateEvent; + public event SessionConnectHandler SessionConnectEvent; + public event SetFocusHandler SetFocusEvent; + public event LoadHandler LoadEvent; + public event CloseHandler CloseEvent; + public event CloseRequestHandler CloseRequestEvent; + public event ForwardMessageHandler ForwardMessageEvent; + + private void XamlWindow_SizeChanged(object sender, WindowSizeChangedEventArgs e) => SizeChangedEvent?.Invoke(); + private void XamlWindow_Activated(object sender, WindowActivatedEventArgs e) + { + ShowEvent?.Invoke(true, e.WindowActivationState == CoreWindowActivationState.CodeActivated); + ActivationChangeEvent?.Invoke(); + } + private void XamlWindowContent_Loaded(object sender, RoutedEventArgs e) => LoadEvent?.Invoke(); + private void XamlWindowContent_GotFocus(object sender, RoutedEventArgs e) => SetFocusEvent?.Invoke(true); + private void XamlWindowContent_LostFocus(object sender, RoutedEventArgs e) => SetFocusEvent?.Invoke(false); + private void XamlWindow_Closed(object sender, CoreWindowEventArgs e) => CloseEvent?.Invoke(); + private void XamlWindowContent_DropCompleted(object sender, DropCompletedEventArgs e) => isDragging = false; + private void XamlWindowContent_DragStarting(UIElement sender, DragStartingEventArgs args) => isDragging = true; + + public void BringToTop() => XamlWindow.Activate(); + + public void ClientToScreen(ref Microsoft.Iris.Render.Point point) + { + throw new NotImplementedException(); + } + + public void Close(FormCloseReason fcrCloseReason) => XamlWindow.Close(); + + public IHwndHostWindow CreateHwndHostWindow() + { + throw new NotImplementedException(); + } + + public void ForceMouseIdle(bool fIdle) + { + throw new NotImplementedException(); + } + + public void Initialize() + { + + } + + public void LockMouseActive(bool fActive) + { + throw new NotImplementedException(); + } + + public void RefreshHitTarget() + { + throw new NotImplementedException(); + } + + public void Restore() + { + throw new NotImplementedException(); + } + + public void ScreenToClient(ref Microsoft.Iris.Render.Point point) + { + throw new NotImplementedException(); + } + + public void SetCapture(IRawInputSite captureSite, bool state) + { + if (state) + XamlWindow.CoreWindow.SetPointerCapture(); + else + XamlWindow.CoreWindow.ReleasePointerCapture(); + } + + public void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) + { + throw new NotImplementedException(); + } + + public void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) + { + throw new NotImplementedException(); + } + + public void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) + { + throw new NotImplementedException(); + } + + public void SetMouseIdleOptions(Microsoft.Iris.Render.Size sizeMouseIdleTolerance, uint nMouseIdleDelay) + { + throw new NotImplementedException(); + } + + public void SetWindowOptions(WindowOptions options, bool enable) + { + + } + + public void TakeFocus() => XamlWindow.Activate(); + + public void TakeForeground(bool fForce) + { + if (fForce) + XamlWindow.Activate(); + } + + public void TemporarilyExitExclusiveMode() + { + throw new NotImplementedException(); + } + } +} diff --git a/Xune.Uno/Platforms/Xune.Uno.UWP/Xune.Uno.Uwp.csproj b/Xune.Uno/Platforms/Xune.Uno.UWP/Xune.Uno.Uwp.csproj index ecc7ba9..054a713 100644 --- a/Xune.Uno/Platforms/Xune.Uno.UWP/Xune.Uno.Uwp.csproj +++ b/Xune.Uno/Platforms/Xune.Uno.UWP/Xune.Uno.Uwp.csproj @@ -8,7 +8,7 @@ you need to make sure that the version provided here matches https://github.com/novotnyllc/MSBuildSdkExtras/blob/main/Source/MSBuild.Sdk.Extras/DefaultItems/ImplicitPackages.targets#L11. This is not an issue when libraries are referenced through nuget packages. See https://github.com/unoplatform/uno/issues/446 for more details. --> - 6.2.12 + 6.2.11 @@ -29,8 +29,8 @@ Xune.Uno en-US UAP - 10.0.18362.0 - 10.0.18362.0 + 10.0.22000.0 + 10.0.19041.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs b/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs index 71e65cc..b8a2ebc 100644 --- a/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs +++ b/Xune.Uno/Xune.Uno.Shared/MainPage.xaml.cs @@ -43,7 +43,7 @@ namespace Xune.Uno if (Microsoft.Iris.Application.IsInitialized || Microsoft.Iris.Application.IsInitializing) return; - Microsoft.Iris.Application.Initialize(e.Surface); + Microsoft.Iris.Application.Initialize(e.Surface, new XamlRenderWindow(Window.Current)); } //private unsafe void nothing() @@ -51,266 +51,4 @@ namespace Xune.Uno // void*** ptr = (void***)GCHandle.Alloc(new void*[1], GCHandleType.Pinned).AddrOfPinnedObject(); //} } - - public sealed class IrisCoreWindow : IRenderWindow - { - private bool isDragging = false; - private Window XamlWindow { get; set; } - private ApplicationView CurrentView => ApplicationView.GetForCurrentView(); - private Rect VisibleBounds => CurrentView.VisibleBounds; - - public IrisCoreWindow(Window window) - { - XamlWindow = window; - - XamlWindow.SizeChanged += XamlWindow_SizeChanged; - XamlWindow.Activated += XamlWindow_Activated; - XamlWindow.Content.GotFocus += XamlWindowContent_GotFocus; - XamlWindow.Content.LostFocus += XamlWindowContent_LostFocus; - XamlWindow.Closed += XamlWindow_Closed; - XamlWindow.Content.DragStarting += XamlWindowContent_DragStarting; - XamlWindow.Content.DropCompleted += XamlWindowContent_DropCompleted; - if (XamlWindow.Content is FrameworkElement elem) - { - elem.Loaded += XamlWindowContent_Loaded; - } - } - - public int Left => (int)VisibleBounds.Left; - - public int Top => (int)VisibleBounds.Top; - - public int Right => (int)VisibleBounds.Right; - - public int Bottom => (int)VisibleBounds.Bottom; - - public int Width => (int)VisibleBounds.Width; - - public int Height => (int)VisibleBounds.Height; - - public HWND WindowHandle => throw new PlatformNotSupportedException("UWP cannot use HWNDs directly"); - - public Microsoft.Iris.Render.Size ClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public Microsoft.Iris.Render.Size InitialClientSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public FormPlacement InitialPlacement { set => throw new NotImplementedException(); } - - public FormPlacement FinalPlacement => throw new NotImplementedException(); - - public int MinResizeWidth - { - get => (int)ApplicationView.PreferredLaunchViewSize.Width; - set => CurrentView.SetPreferredMinSize(new Windows.Foundation.Size(value, 320)); - } - public int MaxResizeWidth { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public Microsoft.Iris.Render.Point Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public string Text - { - get => CurrentView.Title; - set => CurrentView.Title = value; - } - public Cursor Cursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public Cursor IdleCursor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public bool Visible - { - get => XamlWindow.Visible; - set => XamlWindow.Visible = value; - } - - public bool IsLoaded => XamlWindow != null; - - public ColorF BackgroundColor - { - get - { - Windows.UI.Color color = Windows.UI.Colors.Transparent; - if (XamlWindow.Content is FrameworkElement elem && elem.Background is SolidColorBrush brush) - color = brush.Color; - - return new ColorF(color.A / 255, color.R / 255, color.G / 255, color.B / 255); - } - set - { - if (XamlWindow.Content is FrameworkElement elem) - { - elem.Background = new SolidColorBrush(new Windows.UI.Color - { - A = (byte)(value.A * 255), - R = (byte)(value.R * 255), - G = (byte)(value.G * 255), - B = (byte)(value.B * 255), - }); - } - } - } - public bool EnableExternalDragDrop - { - get => XamlWindow.Content.AllowDrop; - set => XamlWindow.Content.AllowDrop = true; - } - public bool IsDragInProgress { get => isDragging; set => throw new NotImplementedException(); } - public IDisplay CurrentDisplay { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public bool FullScreenExclusive - { - get => CurrentView.IsFullScreenMode; - set => CurrentView.TryEnterFullScreenMode(); - } - - public bool ActivationState => XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedInForeground; - - public WindowState WindowState - { - get - { - if (CurrentView.ViewMode == ApplicationViewMode.CompactOverlay) - return WindowState.Normal; - else if (XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.ActivatedNotForeground - || XamlWindow.CoreWindow.ActivationMode == CoreWindowActivationMode.Deactivated - || !XamlWindow.Visible) - return WindowState.Minimized; - else if (CurrentView.AdjacentToLeftDisplayEdge && CurrentView.AdjacentToRightDisplayEdge) - return WindowState.Maximized; - - return WindowState.Normal; - } - set - { - switch (value) - { - case WindowState.Normal: - XamlWindow.Visible = true; - CurrentView.TryEnterViewModeAsync(ApplicationViewMode.Default); - break; - case WindowState.Minimized: - XamlWindow.Visible = false; - break; - case WindowState.Maximized: - XamlWindow.Visible = true; - break; - } - } - } - public FormStyleInfo Styles { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } - public HWND AppNotifyWindow { set => throw new NotImplementedException(); } - - public IVisualContainer VisualRoot => throw new NotImplementedException(); - - public event LocationChangedHandler LocationChangedEvent; - public event SizeChangedHandler SizeChangedEvent; - public event MonitorChangedHandler MonitorChangedEvent; - public event WindowStateChangedHandler WindowStateChangedEvent; - public event SysCommandHandler SysCommandEvent; - public event MouseIdleHandler MouseIdleEvent; - public event ShowHandler ShowEvent; - public event ActivationChangeHandler ActivationChangeEvent; - public event SessionActivateHandler SessionActivateEvent; - public event SessionConnectHandler SessionConnectEvent; - public event SetFocusHandler SetFocusEvent; - public event LoadHandler LoadEvent; - public event CloseHandler CloseEvent; - public event CloseRequestHandler CloseRequestEvent; - public event ForwardMessageHandler ForwardMessageEvent; - - private void XamlWindow_SizeChanged(object sender, WindowSizeChangedEventArgs e) => SizeChangedEvent?.Invoke(); - private void XamlWindow_Activated(object sender, WindowActivatedEventArgs e) - { - ShowEvent?.Invoke(true, e.WindowActivationState == CoreWindowActivationState.CodeActivated); - ActivationChangeEvent?.Invoke(); - } - private void XamlWindowContent_Loaded(object sender, RoutedEventArgs e) => LoadEvent?.Invoke(); - private void XamlWindowContent_GotFocus(object sender, RoutedEventArgs e) => SetFocusEvent?.Invoke(true); - private void XamlWindowContent_LostFocus(object sender, RoutedEventArgs e) => SetFocusEvent?.Invoke(false); - private void XamlWindow_Closed(object sender, CoreWindowEventArgs e) => CloseEvent?.Invoke(); - private void XamlWindowContent_DropCompleted(object sender, DropCompletedEventArgs e) => isDragging = false; - private void XamlWindowContent_DragStarting(UIElement sender, DragStartingEventArgs args) => isDragging = true; - - public void BringToTop() => XamlWindow.Activate(); - - public void ClientToScreen(ref Microsoft.Iris.Render.Point point) - { - throw new NotImplementedException(); - } - - public void Close(FormCloseReason fcrCloseReason) => XamlWindow.Close(); - - public IHwndHostWindow CreateHwndHostWindow() - { - throw new NotImplementedException(); - } - - public void ForceMouseIdle(bool fIdle) - { - throw new NotImplementedException(); - } - - public void Initialize() - { - - } - - public void LockMouseActive(bool fActive) - { - throw new NotImplementedException(); - } - - public void RefreshHitTarget() - { - throw new NotImplementedException(); - } - - public void Restore() - { - throw new NotImplementedException(); - } - - public void ScreenToClient(ref Microsoft.Iris.Render.Point point) - { - throw new NotImplementedException(); - } - - public void SetCapture(IRawInputSite captureSite, bool state) - { - if (state) - XamlWindow.CoreWindow.SetPointerCapture(); - else - XamlWindow.CoreWindow.ReleasePointerCapture(); - } - - public void SetDragDropResult(uint nDragOverResult, uint nDragDropResult) - { - throw new NotImplementedException(); - } - - public void SetEdgeImages(bool fActiveEdges, ShadowEdgePart[] edges) - { - throw new NotImplementedException(); - } - - public void SetIcon(string sModuleName, uint nResourceID, IconFlags nOptions) - { - throw new NotImplementedException(); - } - - public void SetMouseIdleOptions(Microsoft.Iris.Render.Size sizeMouseIdleTolerance, uint nMouseIdleDelay) - { - throw new NotImplementedException(); - } - - public void SetWindowOptions(WindowOptions options, bool enable) - { - - } - - public void TakeFocus() => XamlWindow.Activate(); - - public void TakeForeground(bool fForce) - { - if (fForce) - XamlWindow.Activate(); - } - - public void TemporarilyExitExclusiveMode() - { - throw new NotImplementedException(); - } - } } diff --git a/Xune.Wpf/App.xaml b/Xune.Wpf/App.xaml new file mode 100644 index 0000000..5428080 --- /dev/null +++ b/Xune.Wpf/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Xune.Wpf/App.xaml.cs b/Xune.Wpf/App.xaml.cs new file mode 100644 index 0000000..9f1e423 --- /dev/null +++ b/Xune.Wpf/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Xune.Wpf +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/Xune.Wpf/AssemblyInfo.cs b/Xune.Wpf/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/Xune.Wpf/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Xune.Wpf/MainWindow.xaml b/Xune.Wpf/MainWindow.xaml new file mode 100644 index 0000000..72f8c3a --- /dev/null +++ b/Xune.Wpf/MainWindow.xaml @@ -0,0 +1,13 @@ + + + + + diff --git a/Xune.Wpf/MainWindow.xaml.cs b/Xune.Wpf/MainWindow.xaml.cs new file mode 100644 index 0000000..aa394ca --- /dev/null +++ b/Xune.Wpf/MainWindow.xaml.cs @@ -0,0 +1,41 @@ +using Microsoft.Iris.Render; +using SkiaSharp.Views.Desktop; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Xune.Wpf +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + + Canvas.PaintSurface += Canvas_PaintSurface; + } + + private void Canvas_PaintSurface(object sender, SKPaintSurfaceEventArgs e) + { + // Initialize UI framework + if (Microsoft.Iris.Application.IsInitialized || Microsoft.Iris.Application.IsInitializing) + return; + + Microsoft.Iris.Application.Initialize(e.Surface, new WpfRenderWindow(this)); + } + } +} diff --git a/Xune.Wpf/Xune.Wpf.csproj b/Xune.Wpf/Xune.Wpf.csproj new file mode 100644 index 0000000..dcb2430 --- /dev/null +++ b/Xune.Wpf/Xune.Wpf.csproj @@ -0,0 +1,15 @@ + + + + WinExe + net5.0-windows + true + + + + + + + + + diff --git a/Xune.sln b/Xune.sln index 95043c7..4fe7479 100644 --- a/Xune.sln +++ b/Xune.sln @@ -22,9 +22,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Uno", "Uno", "{10786613-309 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platforms", "Platforms", "{3F9FAF85-78F0-4FD3-8E4A-D6D5E3098F56}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIX.RenderApi.Skia", "UIX.RenderApi.Skia\UIX.RenderApi.Skia.csproj", "{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIX.RenderApi.Skia", "UIX.RenderApi.Skia\UIX.RenderApi.Skia.csproj", "{CB2B7609-C7B8-4E2A-82D8-DD631B70B621}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIX.Skia", "UIX.Skia\UIX.Skia.csproj", "{5681A1BD-B3EC-450B-BF6E-38187204B6BE}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UIX.Skia", "UIX.Skia\UIX.Skia.csproj", "{5681A1BD-B3EC-450B-BF6E-38187204B6BE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xune.Wpf", "Xune.Wpf\Xune.Wpf.csproj", "{2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution @@ -291,6 +293,34 @@ Global {5681A1BD-B3EC-450B-BF6E-38187204B6BE}.Release|x64.Build.0 = Release|Any CPU {5681A1BD-B3EC-450B-BF6E-38187204B6BE}.Release|x86.ActiveCfg = Release|Any CPU {5681A1BD-B3EC-450B-BF6E-38187204B6BE}.Release|x86.Build.0 = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|ARM.ActiveCfg = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|ARM.Build.0 = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|ARM64.Build.0 = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|iPhone.Build.0 = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|x64.ActiveCfg = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|x64.Build.0 = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|x86.ActiveCfg = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Debug|x86.Build.0 = Debug|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|Any CPU.Build.0 = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|ARM.ActiveCfg = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|ARM.Build.0 = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|ARM64.ActiveCfg = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|ARM64.Build.0 = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|iPhone.ActiveCfg = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|iPhone.Build.0 = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|x64.ActiveCfg = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|x64.Build.0 = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|x86.ActiveCfg = Release|Any CPU + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -305,6 +335,7 @@ Global {761D821E-9905-4444-9ADF-76C995FE5427} = {3F9FAF85-78F0-4FD3-8E4A-D6D5E3098F56} {10786613-309D-439C-951C-99F3A8009F3F} = {4CAF0482-C022-4D60-A300-838F5B8D49B2} {3F9FAF85-78F0-4FD3-8E4A-D6D5E3098F56} = {10786613-309D-439C-951C-99F3A8009F3F} + {2610D7CC-36E2-479F-9FA2-DF9024FC9EAA} = {4CAF0482-C022-4D60-A300-838F5B8D49B2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C7433AE2-B1A0-4C1A-887E-5CAA7AAF67A6}