fix dark mode window title bar color and support uosc exclamation mark menu syntax

This commit is contained in:
stax76
2023-11-05 11:15:35 +01:00
parent 1d3fe0a924
commit 684e103e12
3 changed files with 19 additions and 9 deletions

View File

@@ -48,7 +48,7 @@ public partial class MainForm : Form
{ {
InitializeComponent(); InitializeComponent();
if (Environment.OSVersion.Version >= new Version(10, 0, 18985)) if (Environment.OSVersion.Version >= new Version(10, 0, 18985) && Theme.DarkMode)
DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); // DWMWA_USE_IMMERSIVE_DARK_MODE = 20 DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); // DWMWA_USE_IMMERSIVE_DARK_MODE = 20
try try

View File

@@ -10,6 +10,7 @@ public class Binding : ObservableObject
public bool IsCustomMenu { get; set; } public bool IsCustomMenu { get; set; }
public bool IsMenu { get; set; } public bool IsMenu { get; set; }
public bool IsShortMenuSyntax { get; set; }
string _input = ""; string _input = "";

View File

@@ -221,7 +221,12 @@ public static class InputHelp
string comment; string comment;
if (binding.IsMenu) if (binding.IsMenu)
{
if (binding.IsShortMenuSyntax)
comment = "! " + binding.Comment.Trim();
else
comment = "menu: " + binding.Comment.Trim(); comment = "menu: " + binding.Comment.Trim();
}
else if (binding.IsCustomMenu) else if (binding.IsCustomMenu)
comment = "custom-menu: " + binding.Comment.Trim(); comment = "custom-menu: " + binding.Comment.Trim();
else else
@@ -229,7 +234,10 @@ public static class InputHelp
if (comment != "") if (comment != "")
{ {
if (comment.StartsWith("menu: ") || comment.StartsWith("custom-menu: ")) if (comment.StartsWith("menu: ") ||
comment.StartsWith("custom-menu: ") ||
comment.StartsWith("! "))
comment = " #" + comment; comment = " #" + comment;
else else
comment = " # " + comment; comment = " # " + comment;
@@ -297,12 +305,13 @@ public static class InputHelp
binding.IsMenu = true; binding.IsMenu = true;
line = line[..line.IndexOf("#menu:")]; line = line[..line.IndexOf("#menu:")];
} }
//else if (line.Contains("#!")) else if (line.Contains("#!"))
//{ {
// binding.Comment = line[(line.IndexOf("#!") + 2)..].Trim(); binding.Comment = line[(line.IndexOf("#!") + 2)..].Trim();
// binding.IsMenu = true; binding.IsMenu = true;
// line = line[..line.IndexOf("#!")]; binding.IsShortMenuSyntax = true;
//} line = line[..line.IndexOf("#!")];
}
else if (line.Contains("#custom-menu:")) else if (line.Contains("#custom-menu:"))
{ {
binding.Comment = line[(line.IndexOf("#custom-menu:") + 13)..].Trim(); binding.Comment = line[(line.IndexOf("#custom-menu:") + 13)..].Trim();