diff --git a/src/Uno.UWP/ApplicationModel/Core/CoreApplication.cs b/src/Uno.UWP/ApplicationModel/Core/CoreApplication.cs index 41102fa7f3e4..01027663a7d6 100644 --- a/src/Uno.UWP/ApplicationModel/Core/CoreApplication.cs +++ b/src/Uno.UWP/ApplicationModel/Core/CoreApplication.cs @@ -1,59 +1,85 @@ #pragma warning disable 108 // new keyword hiding #pragma warning disable 114 // new keyword hiding + +using System; using System.Collections.Generic; using Uno.Helpers.Theming; -namespace Windows.ApplicationModel.Core +namespace Windows.ApplicationModel.Core; + +public partial class CoreApplication { - public partial class CoreApplication + private static CoreApplicationView _currentView; + private static List _views; + + static CoreApplication() { - private static CoreApplicationView _currentView; - private static List _views; + _currentView = new CoreApplicationView(); + } - public static event global::System.EventHandler Resuming; + /// + /// Occurs when an app is resuming. + /// + public static event EventHandler Resuming; - public static event global::System.EventHandler Suspending; + /// + /// Occurs when the app is suspending. + /// + public static event EventHandler Suspending; - static CoreApplication() - { - _currentView = new CoreApplicationView(); - } + /// + /// Fired when the app enters the running in the background state. + /// + public static event EventHandler EnteredBackground; + + /// + /// Fired just before application UI becomes visible. + /// + public static event EventHandler LeavingBackground; - /// - /// Raises the event - /// - internal static void RaiseResuming() - => Resuming?.Invoke(null, null); + /// + /// Raises the event. + /// + internal static void OnResuming() => Resuming?.Invoke(null, null); - /// - /// Raises the event - /// - internal static void RaiseSuspending(SuspendingEventArgs args) - => Suspending?.Invoke(null, args); + /// + /// Raises the event. + /// + /// Suspending event args. + internal static void OnSuspending(SuspendingEventArgs args) => Suspending?.Invoke(null, args); - public static CoreApplicationView GetCurrentView() - => _currentView; + /// + /// Raises the event. + /// + /// Entered background event args. + internal static void OnEnteredBackground(EnteredBackgroundEventArgs args) => EnteredBackground?.Invoke(null, args); - public static global::Windows.ApplicationModel.Core.CoreApplicationView MainView - => _currentView; + /// + /// Raises the event. + /// + /// Leaving background event args. + internal static void OnLeavingBackground(LeavingBackgroundEventArgs args) => LeavingBackground?.Invoke(null, args); - public static IReadOnlyList Views + public static CoreApplicationView GetCurrentView() => _currentView; + + public static CoreApplicationView MainView => _currentView; + + public static IReadOnlyList Views + { + get { - get + if (_views == null) { - if(_views == null) - { - _views = new List { _currentView }; - } - - return _views; + _views = new List { _currentView }; } - } - /// - /// This property is kept in sync with the Application.RequestedTheme to enable - /// native UI elements in non Uno.UWP to resolve the currently set Application theme. - /// - internal static SystemTheme RequestedTheme { get; set; } + return _views; + } } + + /// + /// This property is kept in sync with the Application.RequestedTheme to enable + /// native UI elements in non Uno.UWP to resolve the currently set Application theme. + /// + internal static SystemTheme RequestedTheme { get; set; } } diff --git a/src/Uno.UWP/Generated/3.0.0.0/Windows.ApplicationModel.Core/CoreApplication.cs b/src/Uno.UWP/Generated/3.0.0.0/Windows.ApplicationModel.Core/CoreApplication.cs index 4adfa3d0426b..7d9ef8286ef3 100644 --- a/src/Uno.UWP/Generated/3.0.0.0/Windows.ApplicationModel.Core/CoreApplication.cs +++ b/src/Uno.UWP/Generated/3.0.0.0/Windows.ApplicationModel.Core/CoreApplication.cs @@ -173,38 +173,8 @@ public static void RunWithActivationFactories( global::Windows.Foundation.IGetAc } } #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ - [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] - public static event global::System.EventHandler EnteredBackground - { - [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] - add - { - global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.ApplicationModel.Core.CoreApplication", "event EventHandler CoreApplication.EnteredBackground"); - } - [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] - remove - { - global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.ApplicationModel.Core.CoreApplication", "event EventHandler CoreApplication.EnteredBackground"); - } - } - #endif - #if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ - [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] - public static event global::System.EventHandler LeavingBackground - { - [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] - add - { - global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.ApplicationModel.Core.CoreApplication", "event EventHandler CoreApplication.LeavingBackground"); - } - [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] - remove - { - global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.ApplicationModel.Core.CoreApplication", "event EventHandler CoreApplication.LeavingBackground"); - } - } - #endif + // Skipping already declared event Windows.ApplicationModel.Core.CoreApplication.EnteredBackground + // Skipping already declared event Windows.ApplicationModel.Core.CoreApplication.LeavingBackground // Skipping already declared event Windows.ApplicationModel.Core.CoreApplication.Resuming // Skipping already declared event Windows.ApplicationModel.Core.CoreApplication.Suspending }