diff --git a/GitVersion.yml b/GitVersion.yml index 3a183efa2..1946a6c7a 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -2,14 +2,6 @@ mode: ContinuousDeployment tag-prefix: '[vV]' continuous-delivery-fallback-tag: dev branches: - v1_develop: - mode: ContinuousDeployment - tag: dev - regex: v1_develop - source-branches: - - v1_release - pre-release-weight: 100 - v2_develop: mode: ContinuousDeployment tag: dev @@ -25,6 +17,20 @@ branches: is-release-branch: true source-branches: ['v2_develop'] + v1_develop: + mode: ContinuousDeployment + tag: dev + regex: v1_develop + source-branches: + - v1_release + pre-release-weight: 100 + + v1_release: + mode: ContinuousDeployment + regex: v1_release + is-release-branch: true + source-branches: ['v1_develop'] + pull-request: mode: ContinuousDeployment tag: PullRequest.{BranchName} @@ -32,8 +38,6 @@ branches: tag-number-pattern: '[/-](?\d+)' regex: ^(pull|pull\-requests|pr)[/-] source-branches: - - v1_develop - - v1_release - v2_develop - v2_release - feature diff --git a/NativeAot/NativeAot.csproj b/NativeAot/NativeAot.csproj new file mode 100644 index 000000000..6c5e1f136 --- /dev/null +++ b/NativeAot/NativeAot.csproj @@ -0,0 +1,22 @@ + + + + Exe + net8.0 + enable + enable + true + false + + + + + + + + + + + + + diff --git a/NativeAot/Program.cs b/NativeAot/Program.cs new file mode 100644 index 000000000..5ef38db05 --- /dev/null +++ b/NativeAot/Program.cs @@ -0,0 +1,113 @@ +// This is a test application for a native Aot file. + +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using Terminal.Gui; + +namespace NativeAot; + +public static class Program +{ + [RequiresUnreferencedCode ("Calls Terminal.Gui.Application.Init(ConsoleDriver, String)")] + [RequiresDynamicCode ("Calls Terminal.Gui.Application.Init(ConsoleDriver, String)")] + private static void Main (string [] args) + { + Application.Init (); + + #region The code in this region is not intended for use in a native Aot self-contained. It's just here to make sure there is no functionality break with localization in Terminal.Gui using self-contained + + if (Equals(Thread.CurrentThread.CurrentUICulture, CultureInfo.InvariantCulture) && Application.SupportedCultures.Count == 0) + { + // Only happens if the project has true + Debug.Assert (Application.SupportedCultures.Count == 0); + } + else + { + Debug.Assert (Application.SupportedCultures.Count > 0); + Debug.Assert (Equals (CultureInfo.CurrentCulture, Thread.CurrentThread.CurrentUICulture)); + } + + #endregion + + ExampleWindow app = new (); + Application.Run (app); + + // Dispose the app object before shutdown + app.Dispose (); + + // Before the application exits, reset Terminal.Gui for clean shutdown + Application.Shutdown (); + + // To see this output on the screen it must be done after shutdown, + // which restores the previous screen. + Console.WriteLine ($@"Username: {ExampleWindow.UserName}"); + } +} + +// Defines a top-level window with border and title +public class ExampleWindow : Window +{ + public static string? UserName; + + public ExampleWindow () + { + Title = $"Example App ({Application.QuitKey} to quit)"; + + // Create input components and labels + var usernameLabel = new Label { Text = "Username:" }; + + var userNameText = new TextField + { + // Position text field adjacent to the label + X = Pos.Right (usernameLabel) + 1, + + // Fill remaining horizontal space + Width = Dim.Fill () + }; + + var passwordLabel = new Label + { + Text = "Password:", X = Pos.Left (usernameLabel), Y = Pos.Bottom (usernameLabel) + 1 + }; + + var passwordText = new TextField + { + Secret = true, + + // align with the text box above + X = Pos.Left (userNameText), + Y = Pos.Top (passwordLabel), + Width = Dim.Fill () + }; + + // Create login button + var btnLogin = new Button + { + Text = "Login", + Y = Pos.Bottom (passwordLabel) + 1, + + // center the login button horizontally + X = Pos.Center (), + IsDefault = true + }; + + // When login button is clicked display a message popup + btnLogin.Accept += (s, e) => + { + if (userNameText.Text == "admin" && passwordText.Text == "password") + { + MessageBox.Query ("Logging In", "Login Successful", "Ok"); + UserName = userNameText.Text; + Application.RequestStop (); + } + else + { + MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok"); + } + }; + + // Add the views to the Window + Add (usernameLabel, userNameText, passwordLabel, passwordText, btnLogin); + } +} diff --git a/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml b/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml new file mode 100644 index 000000000..c883267bf --- /dev/null +++ b/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Debug.pubxml @@ -0,0 +1,18 @@ + + + + + Debug + Any CPU + bin\Debug\net8.0\publish\win-x64\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + true + false + false + + \ No newline at end of file diff --git a/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml b/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml new file mode 100644 index 000000000..79576fb52 --- /dev/null +++ b/NativeAot/Properties/PublishProfiles/FolderProfile_net8.0_win-x64_Release.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + bin\Release\net8.0\publish\win-x64\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + true + false + false + + \ No newline at end of file diff --git a/NativeAot/Publish_linux-x64_Debug.sh b/NativeAot/Publish_linux-x64_Debug.sh new file mode 100644 index 000000000..b58a83cc1 --- /dev/null +++ b/NativeAot/Publish_linux-x64_Debug.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +dotnet clean +dotnet build +dotnet publish -c Debug -r linux-x64 --self-contained diff --git a/NativeAot/Publish_linux-x64_Release.sh b/NativeAot/Publish_linux-x64_Release.sh new file mode 100644 index 000000000..3cb8feb26 --- /dev/null +++ b/NativeAot/Publish_linux-x64_Release.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +dotnet clean +dotnet build +dotnet publish -c Release -r linux-x64 --self-contained diff --git a/NativeAot/Publish_osx-x64_Debug.sh b/NativeAot/Publish_osx-x64_Debug.sh new file mode 100644 index 000000000..1fe41513c --- /dev/null +++ b/NativeAot/Publish_osx-x64_Debug.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +dotnet clean +dotnet build +dotnet publish -c Debug -r osx-x64 --self-contained diff --git a/NativeAot/Publish_osx-x64_Release.sh b/NativeAot/Publish_osx-x64_Release.sh new file mode 100644 index 000000000..06b748b79 --- /dev/null +++ b/NativeAot/Publish_osx-x64_Release.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +dotnet clean +dotnet build +dotnet publish -c Release -r osx-x64 --self-contained diff --git a/NativeAot/README.md b/NativeAot/README.md new file mode 100644 index 000000000..7a55ccfc7 --- /dev/null +++ b/NativeAot/README.md @@ -0,0 +1,10 @@ +# Terminal.Gui C# SelfContained + +This project aims to test the `Terminal.Gui` library to create a simple `native AOT` `self-container` GUI application in C#, ensuring that all its features are available. + +With `Debug` the `.csproj` is used and with `Release` the latest `nuget package` is used, either in `Solution Configurations` or in `Profile Publish` or in the `Publish_linux-x64` or in the `Publish_osx-x64` files. +Unlike self-contained single-file publishing, native AOT publishing must be generated on the same platform as the target execution version. Therefore, if the target execution is Linux, then the publishing must be generated on a Linux operating system. Attempting to generate on Windows for the Linux target will throw an exception. + +To publish the `native AOT` file in `Debug` or `Release` mode, it is not necessary to select it in the `Solution Configurations`, just choose the `Debug` or `Release` configuration in the `Publish Profile` or the `*.sh` files. + +When executing the file directly from the `native AOT` file and needing to debug it, it will be necessary to attach it to the debugger, just like any other standalone application and selecting `Native Code`. \ No newline at end of file diff --git a/Terminal.Gui/Application/Application.Keyboard.cs b/Terminal.Gui/Application/Application.Keyboard.cs index 48170eb22..21e3df5ab 100644 --- a/Terminal.Gui/Application/Application.Keyboard.cs +++ b/Terminal.Gui/Application/Application.Keyboard.cs @@ -9,7 +9,6 @@ public static partial class Application // Keyboard handling /// Alternative key to navigate forwards through views. Ctrl+Tab is the primary key. [SerializableConfigurationProperty (Scope = typeof (SettingsScope))] - [JsonConverter (typeof (KeyJsonConverter))] public static Key NextTabKey { get => _nextTabKey; @@ -27,7 +26,6 @@ public static partial class Application // Keyboard handling /// Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key. [SerializableConfigurationProperty (Scope = typeof (SettingsScope))] - [JsonConverter (typeof (KeyJsonConverter))] public static Key PrevTabKey { get => _prevTabKey; @@ -45,7 +43,6 @@ public static partial class Application // Keyboard handling /// Alternative key to navigate forwards through views. Ctrl+Tab is the primary key. [SerializableConfigurationProperty (Scope = typeof (SettingsScope))] - [JsonConverter (typeof (KeyJsonConverter))] public static Key NextTabGroupKey { get => _nextTabGroupKey; @@ -63,7 +60,6 @@ public static partial class Application // Keyboard handling /// Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key. [SerializableConfigurationProperty (Scope = typeof (SettingsScope))] - [JsonConverter (typeof (KeyJsonConverter))] public static Key PrevTabGroupKey { get => _prevTabGroupKey; @@ -81,7 +77,6 @@ public static partial class Application // Keyboard handling /// Gets or sets the key to quit the application. [SerializableConfigurationProperty (Scope = typeof (SettingsScope))] - [JsonConverter (typeof (KeyJsonConverter))] public static Key QuitKey { get => _quitKey; diff --git a/Terminal.Gui/Configuration/SourceGenerationContext.cs b/Terminal.Gui/Configuration/SourceGenerationContext.cs index ed93b68ca..85a438b83 100644 --- a/Terminal.Gui/Configuration/SourceGenerationContext.cs +++ b/Terminal.Gui/Configuration/SourceGenerationContext.cs @@ -7,17 +7,17 @@ namespace Terminal.Gui; /// [JsonSerializable (typeof (Attribute))] [JsonSerializable (typeof (Color))] -[JsonSerializable (typeof (ThemeScope))] -[JsonSerializable (typeof (ColorScheme))] -[JsonSerializable (typeof (SettingsScope))] [JsonSerializable (typeof (AppScope))] +[JsonSerializable (typeof (SettingsScope))] [JsonSerializable (typeof (Key))] [JsonSerializable (typeof (GlyphDefinitions))] -[JsonSerializable (typeof (ConfigProperty))] +[JsonSerializable (typeof (Alignment))] +[JsonSerializable (typeof (AlignmentModes))] +[JsonSerializable (typeof (LineStyle))] [JsonSerializable (typeof (ShadowStyle))] -[JsonSerializable (typeof (string))] -[JsonSerializable (typeof (bool))] [JsonSerializable (typeof (bool?))] [JsonSerializable (typeof (Dictionary))] +[JsonSerializable (typeof (Dictionary))] +[JsonSerializable (typeof (Dictionary))] internal partial class SourceGenerationContext : JsonSerializerContext { } diff --git a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs index 180745d9d..8fb1d52e8 100644 --- a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs @@ -2343,7 +2343,22 @@ internal class WindowsClipboard : ClipboardBase { private const uint CF_UNICODE_TEXT = 13; - public override bool IsSupported { get; } = IsClipboardFormatAvailable (CF_UNICODE_TEXT); + public override bool IsSupported { get; } = CheckClipboardIsAvailable (); + + private static bool CheckClipboardIsAvailable () + { + // Attempt to open the clipboard + if (OpenClipboard (nint.Zero)) + { + // Clipboard is available + // Close the clipboard after use + CloseClipboard (); + + return true; + } + // Clipboard is not available + return false; + } protected override string GetClipboardDataImpl () { diff --git a/Terminal.Gui/Drawing/Alignment.cs b/Terminal.Gui/Drawing/Alignment.cs index 6a160096f..169e4c323 100644 --- a/Terminal.Gui/Drawing/Alignment.cs +++ b/Terminal.Gui/Drawing/Alignment.cs @@ -1,10 +1,11 @@ - +using System.Text.Json.Serialization; namespace Terminal.Gui; /// /// Determines the position of items when arranged in a container. /// +[JsonConverter (typeof (JsonStringEnumConverter))] public enum Alignment { /// diff --git a/Terminal.Gui/Drawing/AlignmentModes.cs b/Terminal.Gui/Drawing/AlignmentModes.cs index b7e0bb87e..1b6e262c4 100644 --- a/Terminal.Gui/Drawing/AlignmentModes.cs +++ b/Terminal.Gui/Drawing/AlignmentModes.cs @@ -1,10 +1,11 @@ - +using System.Text.Json.Serialization; namespace Terminal.Gui; /// /// Determines alignment modes for . /// +[JsonConverter (typeof (JsonStringEnumConverter))] [Flags] public enum AlignmentModes { diff --git a/Terminal.Gui/Drawing/Color.Formatting.cs b/Terminal.Gui/Drawing/Color.Formatting.cs index e38128957..406ceff4b 100644 --- a/Terminal.Gui/Drawing/Color.Formatting.cs +++ b/Terminal.Gui/Drawing/Color.Formatting.cs @@ -284,7 +284,7 @@ public readonly partial record struct Color ), // Any string too short to possibly be any supported format. - { Length: > 0 and < 4 } => throw new ColorParseException ( + { Length: > 0 and < 3 } => throw new ColorParseException ( in text, "Text was too short to be any possible supported format.", in text diff --git a/Terminal.Gui/Drawing/LineStyle.cs b/Terminal.Gui/Drawing/LineStyle.cs index 47e37a97a..a696bc943 100644 --- a/Terminal.Gui/Drawing/LineStyle.cs +++ b/Terminal.Gui/Drawing/LineStyle.cs @@ -1,7 +1,10 @@ #nullable enable +using System.Text.Json.Serialization; + namespace Terminal.Gui; /// Defines the style of lines for a . +[JsonConverter (typeof (JsonStringEnumConverter))] public enum LineStyle { /// No border is drawn. diff --git a/Terminal.Gui/Input/Key.cs b/Terminal.Gui/Input/Key.cs index d2972bc04..5c92cc489 100644 --- a/Terminal.Gui/Input/Key.cs +++ b/Terminal.Gui/Input/Key.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; +using System.Text.Json.Serialization; namespace Terminal.Gui; @@ -448,9 +449,9 @@ public class Key : EventArgs, IEquatable #region String conversion - /// Pretty prints the KeyEvent + /// Pretty prints the Key. /// - public override string ToString () { return ToString (KeyCode, (Rune)'+'); } + public override string ToString () { return ToString (KeyCode, Separator); } private static string GetKeyString (KeyCode key) { @@ -483,7 +484,7 @@ public class Key : EventArgs, IEquatable /// The formatted string. If the key is a printable character, it will be returned as a string. Otherwise, the key /// name will be returned. /// - public static string ToString (KeyCode key) { return ToString (key, (Rune)'+'); } + public static string ToString (KeyCode key) { return ToString (key, Separator); } /// Formats a as a string. /// The key to format. @@ -584,7 +585,7 @@ public class Key : EventArgs, IEquatable key = null; // Split the string into parts - string [] parts = text.Split ('+', '-'); + string [] parts = text.Split ('+', '-', (char)Separator.Value); if (parts.Length is 0 or > 4 || parts.Any (string.IsNullOrEmpty)) { @@ -971,4 +972,20 @@ public class Key : EventArgs, IEquatable public static Key F24 => new (KeyCode.F24); #endregion + + private static Rune _separator = new ('+'); + + /// Gets or sets the separator character used when parsing and printing Keys. E.g. Ctrl+A. The default is '+'. + [SerializableConfigurationProperty (Scope = typeof (SettingsScope))] + public static Rune Separator + { + get => _separator; + set + { + if (_separator != value) + { + _separator = value == default (Rune) ? new ('+') : value; + } + } + } } diff --git a/Terminal.Gui/Input/ShortcutHelper.cs b/Terminal.Gui/Input/ShortcutHelper.cs index ea4aa2d8b..d5e776a53 100644 --- a/Terminal.Gui/Input/ShortcutHelper.cs +++ b/Terminal.Gui/Input/ShortcutHelper.cs @@ -23,7 +23,7 @@ public class ShortcutHelper } /// The keystroke combination used in the as string. - public virtual string ShortcutTag => Key.ToString (shortcut, MenuBar.ShortcutDelimiter); + public virtual string ShortcutTag => Key.ToString (shortcut, Key.Separator); /// Lookup for a on range of keys. /// The source key. @@ -59,7 +59,7 @@ public class ShortcutHelper //var hasCtrl = false; if (delimiter == default (Rune)) { - delimiter = MenuBar.ShortcutDelimiter; + delimiter = Key.Separator; } string [] keys = sCut.Split (delimiter.ToString ()); diff --git a/Terminal.Gui/Resources/config.json b/Terminal.Gui/Resources/config.json index d001326a0..adba1e584 100644 --- a/Terminal.Gui/Resources/config.json +++ b/Terminal.Gui/Resources/config.json @@ -22,6 +22,7 @@ "Application.NextTabGroupKey": "F6", "Application.PrevTabGroupKey": "Shift+F6", "Application.QuitKey": "Esc", + "Key.Separator": "+", "Theme": "Default", "Themes": [ diff --git a/Terminal.Gui/View/Adornment/ShadowStyle.cs b/Terminal.Gui/View/Adornment/ShadowStyle.cs index a410292c6..7a95e78ed 100644 --- a/Terminal.Gui/View/Adornment/ShadowStyle.cs +++ b/Terminal.Gui/View/Adornment/ShadowStyle.cs @@ -1,8 +1,11 @@ -namespace Terminal.Gui; +using System.Text.Json.Serialization; + +namespace Terminal.Gui; /// /// Defines the style of shadow to be drawn on the right and bottom sides of the . /// +[JsonConverter (typeof (JsonStringEnumConverter))] public enum ShadowStyle { /// diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs index f489a8bb4..e5845fbb5 100644 --- a/Terminal.Gui/Views/Button.cs +++ b/Terminal.Gui/Views/Button.cs @@ -5,8 +5,6 @@ // Miguel de Icaza (miguel@gnome.org) // -using System.Text.Json.Serialization; - namespace Terminal.Gui; /// Button is a that provides an item that invokes raises the event. @@ -39,8 +37,6 @@ public class Button : View, IDesignable /// Gets or sets whether s are shown with a shadow effect by default. /// [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] - [JsonConverter (typeof (JsonStringEnumConverter))] - public static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None; /// Initializes a new instance of . diff --git a/Terminal.Gui/Views/CheckBox.cs b/Terminal.Gui/Views/CheckBox.cs index c43000953..d806e7abb 100644 --- a/Terminal.Gui/Views/CheckBox.cs +++ b/Terminal.Gui/Views/CheckBox.cs @@ -1,12 +1,9 @@ #nullable enable namespace Terminal.Gui; -/// Shows a check box that can be toggled. +/// Shows a check box that can be cycled between three states. public class CheckBox : View { - private bool _allowNone; - private CheckState _checked = CheckState.UnChecked; - /// /// Initializes a new instance of . /// @@ -18,8 +15,8 @@ public class CheckBox : View CanFocus = true; // Things this view knows how to do - AddCommand (Command.Accept, OnToggle); - AddCommand (Command.HotKey, OnToggle); + AddCommand (Command.Accept, AdvanceCheckState); + AddCommand (Command.HotKey, AdvanceCheckState); // Default keybindings for this view KeyBindings.Add (Key.Space, Command.Accept); @@ -32,7 +29,7 @@ public class CheckBox : View private void CheckBox_MouseClick (object? sender, MouseEventEventArgs e) { - e.Handled = OnToggle () == true; + e.Handled = AdvanceCheckState () == true; } private void Checkbox_TitleChanged (object? sender, EventArgs e) @@ -55,8 +52,10 @@ public class CheckBox : View set => TextFormatter.HotKeySpecifier = base.HotKeySpecifier = value; } + private bool _allowNone = false; + /// - /// If allows to be . + /// If allows to be . The default is . /// public bool AllowCheckStateNone { @@ -69,13 +68,15 @@ public class CheckBox : View } _allowNone = value; - if (State == CheckState.None) + if (CheckedState == CheckState.None) { - State = CheckState.UnChecked; + CheckedState = CheckState.UnChecked; } } } + private CheckState _checkedState = CheckState.UnChecked; + /// /// The state of the . /// @@ -93,35 +94,42 @@ public class CheckBox : View /// will display the ConfigurationManager.Glyphs.CheckStateChecked character (☑). /// /// - public CheckState State + public CheckState CheckedState { - get => _checked; + get => _checkedState; set { - if (_checked == value || (value is CheckState.None && !AllowCheckStateNone)) + if (_checkedState == value || (value is CheckState.None && !AllowCheckStateNone)) { return; } - _checked = value; + _checkedState = value; UpdateTextFormatterText (); OnResizeNeeded (); } } - /// Called when the property changes. Invokes the cancelable event. + /// + /// Advances to the next value. Invokes the cancelable event. + /// /// /// - /// If the event was canceled. + /// If the event was canceled. /// - /// Toggling cycles through the states , , and . + /// + /// Cycles through the states , , and . + /// + /// + /// If the event is not canceled, the will be updated and the event will be raised. + /// /// - public bool? OnToggle () + public bool? AdvanceCheckState () { - CheckState oldValue = State; - CancelEventArgs e = new (ref _checked, ref oldValue); + CheckState oldValue = CheckedState; + CancelEventArgs e = new (in _checkedState, ref oldValue); - switch (State) + switch (CheckedState) { case CheckState.None: e.NewValue = CheckState.Checked; @@ -144,35 +152,35 @@ public class CheckBox : View break; } - Toggle?.Invoke (this, e); + CheckedStateChanging?.Invoke (this, e); if (e.Cancel) { return e.Cancel; } - // By default, Command.Accept calls OnAccept, so we need to call it here to ensure that the event is fired. + // By default, Command.Accept calls OnAccept, so we need to call it here to ensure that the Accept event is fired. if (OnAccept () == true) { return true; } - State = e.NewValue; + CheckedState = e.NewValue; return true; } - /// Toggle event, raised when the is toggled. + /// Raised when the state is changing. /// /// /// This event can be cancelled. If cancelled, the will not change its state. /// /// - public event EventHandler>? Toggle; + public event EventHandler>? CheckedStateChanging; /// protected override void UpdateTextFormatterText () { - base.UpdateTextFormatterText(); + base.UpdateTextFormatterText (); switch (TextAlignment) { case Alignment.Start: @@ -190,7 +198,7 @@ public class CheckBox : View private Rune GetCheckedGlyph () { - return State switch + return CheckedState switch { CheckState.Checked => Glyphs.CheckStateChecked, CheckState.UnChecked => Glyphs.CheckStateUnChecked, diff --git a/Terminal.Gui/Views/Dialog.cs b/Terminal.Gui/Views/Dialog.cs index c1f18e8fb..d6626659d 100644 --- a/Terminal.Gui/Views/Dialog.cs +++ b/Terminal.Gui/Views/Dialog.cs @@ -1,6 +1,4 @@ -using System.Text.Json.Serialization; - -namespace Terminal.Gui; +namespace Terminal.Gui; /// /// The is a that by default is centered and contains @@ -19,13 +17,11 @@ public class Dialog : Window /// The default for . /// This property can be set in a Theme. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] - [JsonConverter (typeof (JsonStringEnumConverter))] public static Alignment DefaultButtonAlignment { get; set; } = Alignment.End; // Default is set in config.json - /// The default for . + /// The default for . /// This property can be set in a Theme. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] - [JsonConverter (typeof (JsonStringEnumConverter))] public static AlignmentModes DefaultButtonAlignmentModes { get; set; } = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems; /// @@ -47,7 +43,6 @@ public class Dialog : Window /// Gets or sets whether all s are shown with a shadow effect by default. /// [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] - [JsonConverter (typeof (JsonStringEnumConverter))] public new static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None; // Default is set in config.json /// @@ -56,7 +51,6 @@ public class Dialog : Window /// [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] - [JsonConverter (typeof (JsonStringEnumConverter))] public new static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single; // Default is set in config.json private readonly List