diff --git a/dist/README.txt b/dist/README.txt index 86810a6..111293e 100644 --- a/dist/README.txt +++ b/dist/README.txt @@ -1,5 +1,5 @@ UbisamBase 플랫폼 배포 폴더 (빌드할 때 자동 생성 - 직접 고치지 마세요) -갱신 시각 : 2026-09-21 22:36:26 +갱신 시각 : 2026-09-21 22:42:14 빌드 구성 : Release 원본 소스 : D:\업무\03_개발\Source\용접기\08_UbisamPlatform\ ---- diff --git a/dist/UbisamBase.Core.dll b/dist/UbisamBase.Core.dll index d2c32e7..a307f8f 100644 Binary files a/dist/UbisamBase.Core.dll and b/dist/UbisamBase.Core.dll differ diff --git a/dist/UbisamBase.Launcher.exe b/dist/UbisamBase.Launcher.exe index 27d8f67..f28831c 100644 Binary files a/dist/UbisamBase.Launcher.exe and b/dist/UbisamBase.Launcher.exe differ diff --git a/dist/UbisamBase.Shell.exe b/dist/UbisamBase.Shell.exe index a4be496..0566d3f 100644 Binary files a/dist/UbisamBase.Shell.exe and b/dist/UbisamBase.Shell.exe differ diff --git a/dist/platform-version.json b/dist/platform-version.json index d3ccb19..8e2fc96 100644 --- a/dist/platform-version.json +++ b/dist/platform-version.json @@ -1,4 +1,4 @@ { -"version": "2026-09-21 22:36:26", +"version": "2026-09-21 22:42:14", "configuration": "Release" } diff --git a/doc/history/changelog.md b/doc/history/changelog.md index d53fa56..55d5a10 100644 --- a/doc/history/changelog.md +++ b/doc/history/changelog.md @@ -18,3 +18,4 @@ | 2026-09-21 | 차트 종류별 디자인 정리 — 면적·계단선·누적/가로 막대·원형·도넛·산점 추가, 계열 팔레트(Chart.Series1~6)와 툴팁·범례 테마 적용 | | 2026-09-21 | 업데이트 진행 창 추가 — 런처를 누르자마자 확인/받기 상태와 진행률을 보여주고, 다 받은 뒤 설치 여부를 묻는다 | | 2026-09-21 | Shell.exe를 직접 실행하면 런처로 넘기도록 — 진입점을 런처 하나로 통일(업데이트 확인 누락 방지) | +| 2026-09-21 | 런처 창(진행·업데이트 안내)이 앱의 테마 설정(다크/라이트)을 따르도록 — 윈도우 설정만 보던 것을 수정 | diff --git a/src/UbisamBase.Launcher/LauncherTheme.cs b/src/UbisamBase.Launcher/LauncherTheme.cs new file mode 100644 index 0000000..bf4c6bd --- /dev/null +++ b/src/UbisamBase.Launcher/LauncherTheme.cs @@ -0,0 +1,91 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; +using Microsoft.Win32; + +namespace UbisamBase.Launcher; + +/// +/// 런처가 띄우는 창(진행 창·업데이트 안내창)의 밝기를 정한다. +/// +/// 런처는 Core를 참조할 수 없어서(갱신 대상인 Core.dll을 물게 된다) UiSettingsService를 쓸 수 없지만, +/// 그 서비스가 저장해 둔 파일은 그대로 읽을 수 있다. 사용자가 앱에서 다크로 해뒀는데 런처 창만 +/// 윈도우 설정(밝게)을 따라가면 혼자 하얗게 떠서 튄다 — 그래서 앱 설정을 먼저 보고, +/// "시스템 설정 따르기"이거나 파일이 없을 때만 윈도우 설정을 본다. +/// +internal static class LauncherTheme +{ + // 설정 폴더는 Core의 UbisamAppBuilder.ConfigRoot와 같은 고정 경로다(앱이 달라도 같은 폴더를 쓴다). + private const string UiSettingsPath = @"D:\UbisamConfig\Settings\UiSettingsService.json"; + + /// 지금 밝은 테마로 그려야 하는가. + public static bool IsLight() + { + var mode = ReadThemeMode(); + + return mode switch + { + ThemeMode.Light => true, + ThemeMode.Dark => false, + _ => IsSystemLightTheme() + }; + } + + /// Core의 UbisamBase.Core.Settings.ThemeMode와 값·순서가 같아야 한다(파일에 숫자로 저장된다). + private enum ThemeMode + { + System = 0, + Light = 1, + Dark = 2 + } + + private static ThemeMode ReadThemeMode() + { + try + { + if (!File.Exists(UiSettingsPath)) + { + return ThemeMode.System; + } + + var json = File.ReadAllText(UiSettingsPath); + + // 숫자로 저장된 경우(지금 방식) + var number = Regex.Match(json, "\"ThemeMode\"\\s*:\\s*(\\d+)"); + if (number.Success && int.TryParse(number.Groups[1].Value, out var value) && + Enum.IsDefined(typeof(ThemeMode), value)) + { + return (ThemeMode)value; + } + + // 이름으로 저장된 경우(나중에 문자열 변환기를 붙이더라도 깨지지 않게) + var name = Regex.Match(json, "\"ThemeMode\"\\s*:\\s*\"(\\w+)\""); + if (name.Success && Enum.TryParse(name.Groups[1].Value, ignoreCase: true, out var parsed)) + { + return parsed; + } + } + catch + { + // 읽지 못하면 시스템 설정을 따른다. + } + + return ThemeMode.System; + } + + /// 윈도우가 밝은 테마인지. Core의 UiSettingsService.IsSystemLightTheme과 같은 판정이다. + private static bool IsSystemLightTheme() + { + try + { + using var key = Registry.CurrentUser.OpenSubKey( + @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"); + + return key?.GetValue("AppsUseLightTheme") is not int value || value != 0; + } + catch + { + return true; + } + } +} diff --git a/src/UbisamBase.Launcher/ProgressWindow.xaml.cs b/src/UbisamBase.Launcher/ProgressWindow.xaml.cs index e99e5b3..a6fb028 100644 --- a/src/UbisamBase.Launcher/ProgressWindow.xaml.cs +++ b/src/UbisamBase.Launcher/ProgressWindow.xaml.cs @@ -3,7 +3,6 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; -using Microsoft.Win32; namespace UbisamBase.Launcher; @@ -21,7 +20,7 @@ public partial class ProgressWindow : Window public ProgressWindow() { InitializeComponent(); - ApplyTheme(IsSystemLightTheme()); + ApplyTheme(LauncherTheme.IsLight()); SizeChanged += (_, _) => UpdateFillWidth(animate: false); } @@ -93,20 +92,5 @@ public partial class ProgressWindow : Window private static SolidColorBrush Brush(string hex) => new SolidColorBrush((Color)ColorConverter.ConvertFromString(hex)); - private static bool IsSystemLightTheme() - { - try - { - using var key = Registry.CurrentUser.OpenSubKey( - @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"); - - return key?.GetValue("AppsUseLightTheme") is not int value || value != 0; - } - catch - { - return true; - } - } - private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => DragMove(); } diff --git a/src/UbisamBase.Launcher/UpdateDialog.xaml.cs b/src/UbisamBase.Launcher/UpdateDialog.xaml.cs index 04bf4d6..0fb4c5c 100644 --- a/src/UbisamBase.Launcher/UpdateDialog.xaml.cs +++ b/src/UbisamBase.Launcher/UpdateDialog.xaml.cs @@ -2,7 +2,6 @@ using System; using System.Windows; using System.Windows.Input; using System.Windows.Media; -using Microsoft.Win32; namespace UbisamBase.Launcher; @@ -22,7 +21,7 @@ public partial class UpdateDialog : Window CurrentValue.Text = string.IsNullOrEmpty(currentVersion) ? "(알 수 없음)" : currentVersion; NewValue.Text = newVersion; - ApplyTheme(IsSystemLightTheme()); + ApplyTheme(LauncherTheme.IsLight()); } /// 보조 버튼에 마우스를 올렸을 때 깔리는 색. 템플릿에서 바인딩해 쓴다. @@ -73,22 +72,6 @@ public partial class UpdateDialog : Window private static SolidColorBrush Brush(string hex) => new SolidColorBrush((Color)ColorConverter.ConvertFromString(hex)); - /// 윈도우가 밝은 테마인지. Core의 UiSettingsService.IsSystemLightTheme과 같은 판정이다. - private static bool IsSystemLightTheme() - { - try - { - using var key = Registry.CurrentUser.OpenSubKey( - @"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"); - - return key?.GetValue("AppsUseLightTheme") is not int value || value != 0; - } - catch - { - return true; - } - } - /// 제목줄이 없으므로 창 아무 데나 끌어서 옮길 수 있게 한다. private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => DragMove();