From d6df2d215a47111bf0eb8ce357f284c646a23e49 Mon Sep 17 00:00:00 2001 From: gniang Date: Mon, 18 Sep 2023 18:10:40 +0900 Subject: [PATCH 1/4] Added secondary closk config. fixed widget rect combine. --- RoundedTB/Background.cs | 1 - RoundedTB/EnumerableExtensions.cs | 19 +++ RoundedTB/Interaction.cs | 11 ++ RoundedTB/MainWindow.xaml | 23 ++-- RoundedTB/MainWindow.xaml.cs | 189 ++++++++++++++++++++---------- RoundedTB/Taskbar.cs | 54 ++++++--- RoundedTB/Types.cs | 5 + 7 files changed, 212 insertions(+), 90 deletions(-) create mode 100644 RoundedTB/EnumerableExtensions.cs diff --git a/RoundedTB/Background.cs b/RoundedTB/Background.cs index e27c2dc..793fcfd 100644 --- a/RoundedTB/Background.cs +++ b/RoundedTB/Background.cs @@ -159,7 +159,6 @@ public void DoWork(object sender, DoWorkEventArgs e) taskbars[current].Ignored = true; settings.ShowWidgets = false; } - } } diff --git a/RoundedTB/EnumerableExtensions.cs b/RoundedTB/EnumerableExtensions.cs new file mode 100644 index 0000000..68be43b --- /dev/null +++ b/RoundedTB/EnumerableExtensions.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RoundedTB +{ + public static class EnumerableExtensions + { + public static void ForEach(this IEnumerable src, Action action) + { + foreach (var item in src) + { + action(item); + } + } + } +} diff --git a/RoundedTB/Interaction.cs b/RoundedTB/Interaction.cs index ab89572..7126bb6 100644 --- a/RoundedTB/Interaction.cs +++ b/RoundedTB/Interaction.cs @@ -31,6 +31,11 @@ public Types.Settings ReadJSON() { string jsonSettings = File.ReadAllText(mw.configPath); Types.Settings settings = JsonConvert.DeserializeObject(jsonSettings); + // compatible old settings + if (settings.DynamicSecondaryClockLayout == null) + { + settings.DynamicSecondaryClockLayout = new Types.SegmentSettings { CornerRadius = 7, MarginLeft = 3, MarginTop = 3, MarginRight = 3, MarginBottom = 3 }; + } return settings; } @@ -63,6 +68,9 @@ public void FileSystem() DynamicAppListLayout = new Types.SegmentSettings { CornerRadius = 7, MarginLeft = 3, MarginTop = 3, MarginRight = 3, MarginBottom = 3 }, DynamicTrayLayout = new Types.SegmentSettings { CornerRadius = 7, MarginLeft = 3, MarginTop = 3, MarginRight = 3, MarginBottom = 3 }, DynamicWidgetsLayout = new Types.SegmentSettings { CornerRadius = 7, MarginLeft = 3, MarginTop = 3, MarginRight = 3, MarginBottom = 3 }, + DynamicSecondaryClockLayout = new Types.SegmentSettings { CornerRadius = 7, MarginLeft = 3, MarginTop = 3, MarginRight = 3, MarginBottom = 3 }, + WidgetsWidth = 168, + ClockWidth = 110, IsDynamic = false, IsCentred = false, IsWindows11 = true, @@ -83,6 +91,9 @@ public void FileSystem() DynamicAppListLayout = new Types.SegmentSettings { CornerRadius = 16, MarginLeft = 2, MarginTop = 2, MarginRight = 2, MarginBottom = 2 }, DynamicTrayLayout = new Types.SegmentSettings { CornerRadius = 16, MarginLeft = 2, MarginTop = 2, MarginRight = 2, MarginBottom = 2 }, DynamicWidgetsLayout = new Types.SegmentSettings { CornerRadius = 16, MarginLeft = 2, MarginTop = 2, MarginRight = 2, MarginBottom = 2 }, + DynamicSecondaryClockLayout = new Types.SegmentSettings { CornerRadius = 16, MarginLeft = 2, MarginTop = 2, MarginRight = 2, MarginBottom = 2 }, + WidgetsWidth = 168, + ClockWidth = 110, IsDynamic = false, IsCentred = false, IsWindows11 = false, diff --git a/RoundedTB/MainWindow.xaml b/RoundedTB/MainWindow.xaml index 79049af..c7e4a20 100644 --- a/RoundedTB/MainWindow.xaml +++ b/RoundedTB/MainWindow.xaml @@ -48,9 +48,17 @@ - - - + +