using System.Diagnostics.CodeAnalysis; namespace Terminal.Gui.App; public static partial class Application // Run (Begin -> Run -> Layout/Draw -> End -> Stop) { private static Key _quitKey = Key.Esc; // Resources/config.json overrides /// Gets or sets the key to quit the application. [ConfigurationProperty (Scope = typeof (SettingsScope))] public static Key QuitKey { get => _quitKey; set { Key oldValue = _quitKey; _quitKey = value; QuitKeyChanged?.Invoke (null, new ValueChangedEventArgs (oldValue, _quitKey)); } } /// Raised when changes. public static event EventHandler>? QuitKeyChanged; private static Key _arrangeKey = Key.F5.WithCtrl; // Resources/config.json overrides /// Gets or sets the key to activate arranging views using the keyboard. [ConfigurationProperty (Scope = typeof (SettingsScope))] public static Key ArrangeKey { get => _arrangeKey; set { Key oldValue = _arrangeKey; _arrangeKey = value; ArrangeKeyChanged?.Invoke (null, new ValueChangedEventArgs (oldValue, _arrangeKey)); } } /// Raised when changes. public static event EventHandler>? ArrangeKeyChanged; /// [Obsolete ("The legacy static Application object is going away.")] public static SessionToken Begin (Toplevel toplevel) => ApplicationImpl.Instance.Begin (toplevel); /// [Obsolete ("The legacy static Application object is going away.")] public static bool PositionCursor () => ApplicationImpl.Instance.PositionCursor (); /// [RequiresUnreferencedCode ("AOT")] [RequiresDynamicCode ("AOT")] [Obsolete ("The legacy static Application object is going away.")] public static Toplevel Run (Func? errorHandler = null, string? driverName = null) => ApplicationImpl.Instance.Run (errorHandler, driverName); /// [RequiresUnreferencedCode ("AOT")] [RequiresDynamicCode ("AOT")] [Obsolete ("The legacy static Application object is going away.")] public static TView Run (Func? errorHandler = null, string? driverName = null) where TView : Toplevel, new() => ApplicationImpl.Instance.Run (errorHandler, driverName); /// [Obsolete ("The legacy static Application object is going away.")] public static void Run (Toplevel view, Func? errorHandler = null) => ApplicationImpl.Instance.Run (view, errorHandler); /// [Obsolete ("The legacy static Application object is going away.")] public static object? AddTimeout (TimeSpan time, Func callback) => ApplicationImpl.Instance.AddTimeout (time, callback); /// [Obsolete ("The legacy static Application object is going away.")] public static bool RemoveTimeout (object token) => ApplicationImpl.Instance.RemoveTimeout (token); /// /// [Obsolete ("The legacy static Application object is going away.")] public static ITimedEvents? TimedEvents => ApplicationImpl.Instance?.TimedEvents; /// [Obsolete ("The legacy static Application object is going away.")] public static void Invoke (Action action) => ApplicationImpl.Instance.Invoke (action); /// [Obsolete ("The legacy static Application object is going away.")] public static void Invoke (Action action) => ApplicationImpl.Instance.Invoke (action); /// [Obsolete ("The legacy static Application object is going away.")] public static void LayoutAndDraw (bool forceRedraw = false) => ApplicationImpl.Instance.LayoutAndDraw (forceRedraw); /// [Obsolete ("The legacy static Application object is going away.")] public static bool StopAfterFirstIteration { get => ApplicationImpl.Instance.StopAfterFirstIteration; set => ApplicationImpl.Instance.StopAfterFirstIteration = value; } /// [Obsolete ("The legacy static Application object is going away.")] public static void RequestStop (Toplevel? top = null) => ApplicationImpl.Instance.RequestStop (top); /// [Obsolete ("The legacy static Application object is going away.")] public static void End (SessionToken sessionToken) => ApplicationImpl.Instance.End (sessionToken); /// [Obsolete ("The legacy static Application object is going away.")] public static event EventHandler>? Iteration { add => ApplicationImpl.Instance.Iteration += value; remove => ApplicationImpl.Instance.Iteration -= value; } /// [Obsolete ("The legacy static Application object is going away.")] public static event EventHandler? SessionBegun { add => ApplicationImpl.Instance.SessionBegun += value; remove => ApplicationImpl.Instance.SessionBegun -= value; } /// [Obsolete ("The legacy static Application object is going away.")] public static event EventHandler? SessionEnded { add => ApplicationImpl.Instance.SessionEnded += value; remove => ApplicationImpl.Instance.SessionEnded -= value; } }