런처 창이 앱 테마 설정을 따르도록 - 다크 모드에서 흰 창이 뜨던 문제
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
a5411d13b0
commit
00b3754063
2
dist/README.txt
vendored
2
dist/README.txt
vendored
@ -1,5 +1,5 @@
|
|||||||
UbisamBase 플랫폼 배포 폴더 (빌드할 때 자동 생성 - 직접 고치지 마세요)
|
UbisamBase 플랫폼 배포 폴더 (빌드할 때 자동 생성 - 직접 고치지 마세요)
|
||||||
갱신 시각 : 2026-09-21 22:36:26
|
갱신 시각 : 2026-09-21 22:42:14
|
||||||
빌드 구성 : Release
|
빌드 구성 : Release
|
||||||
원본 소스 : D:\업무\03_개발\Source\용접기\08_UbisamPlatform\
|
원본 소스 : D:\업무\03_개발\Source\용접기\08_UbisamPlatform\
|
||||||
----
|
----
|
||||||
|
|||||||
BIN
dist/UbisamBase.Core.dll
vendored
BIN
dist/UbisamBase.Core.dll
vendored
Binary file not shown.
BIN
dist/UbisamBase.Launcher.exe
vendored
BIN
dist/UbisamBase.Launcher.exe
vendored
Binary file not shown.
BIN
dist/UbisamBase.Shell.exe
vendored
BIN
dist/UbisamBase.Shell.exe
vendored
Binary file not shown.
2
dist/platform-version.json
vendored
2
dist/platform-version.json
vendored
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"version": "2026-09-21 22:36:26",
|
"version": "2026-09-21 22:42:14",
|
||||||
"configuration": "Release"
|
"configuration": "Release"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,3 +18,4 @@
|
|||||||
| 2026-09-21 | 차트 종류별 디자인 정리 — 면적·계단선·누적/가로 막대·원형·도넛·산점 추가, 계열 팔레트(Chart.Series1~6)와 툴팁·범례 테마 적용 |
|
| 2026-09-21 | 차트 종류별 디자인 정리 — 면적·계단선·누적/가로 막대·원형·도넛·산점 추가, 계열 팔레트(Chart.Series1~6)와 툴팁·범례 테마 적용 |
|
||||||
| 2026-09-21 | 업데이트 진행 창 추가 — 런처를 누르자마자 확인/받기 상태와 진행률을 보여주고, 다 받은 뒤 설치 여부를 묻는다 |
|
| 2026-09-21 | 업데이트 진행 창 추가 — 런처를 누르자마자 확인/받기 상태와 진행률을 보여주고, 다 받은 뒤 설치 여부를 묻는다 |
|
||||||
| 2026-09-21 | Shell.exe를 직접 실행하면 런처로 넘기도록 — 진입점을 런처 하나로 통일(업데이트 확인 누락 방지) |
|
| 2026-09-21 | Shell.exe를 직접 실행하면 런처로 넘기도록 — 진입점을 런처 하나로 통일(업데이트 확인 누락 방지) |
|
||||||
|
| 2026-09-21 | 런처 창(진행·업데이트 안내)이 앱의 테마 설정(다크/라이트)을 따르도록 — 윈도우 설정만 보던 것을 수정 |
|
||||||
|
|||||||
91
src/UbisamBase.Launcher/LauncherTheme.cs
Normal file
91
src/UbisamBase.Launcher/LauncherTheme.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
|
namespace UbisamBase.Launcher;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 런처가 띄우는 창(진행 창·업데이트 안내창)의 밝기를 정한다.
|
||||||
|
///
|
||||||
|
/// 런처는 Core를 참조할 수 없어서(갱신 대상인 Core.dll을 물게 된다) UiSettingsService를 쓸 수 없지만,
|
||||||
|
/// 그 서비스가 저장해 둔 파일은 그대로 읽을 수 있다. 사용자가 앱에서 다크로 해뒀는데 런처 창만
|
||||||
|
/// 윈도우 설정(밝게)을 따라가면 혼자 하얗게 떠서 튄다 — 그래서 앱 설정을 먼저 보고,
|
||||||
|
/// "시스템 설정 따르기"이거나 파일이 없을 때만 윈도우 설정을 본다.
|
||||||
|
/// </summary>
|
||||||
|
internal static class LauncherTheme
|
||||||
|
{
|
||||||
|
// 설정 폴더는 Core의 UbisamAppBuilder.ConfigRoot와 같은 고정 경로다(앱이 달라도 같은 폴더를 쓴다).
|
||||||
|
private const string UiSettingsPath = @"D:\UbisamConfig\Settings\UiSettingsService.json";
|
||||||
|
|
||||||
|
/// <summary>지금 밝은 테마로 그려야 하는가.</summary>
|
||||||
|
public static bool IsLight()
|
||||||
|
{
|
||||||
|
var mode = ReadThemeMode();
|
||||||
|
|
||||||
|
return mode switch
|
||||||
|
{
|
||||||
|
ThemeMode.Light => true,
|
||||||
|
ThemeMode.Dark => false,
|
||||||
|
_ => IsSystemLightTheme()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Core의 UbisamBase.Core.Settings.ThemeMode와 값·순서가 같아야 한다(파일에 숫자로 저장된다).</summary>
|
||||||
|
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<ThemeMode>(name.Groups[1].Value, ignoreCase: true, out var parsed))
|
||||||
|
{
|
||||||
|
return parsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// 읽지 못하면 시스템 설정을 따른다.
|
||||||
|
}
|
||||||
|
|
||||||
|
return ThemeMode.System;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>윈도우가 밝은 테마인지. Core의 UiSettingsService.IsSystemLightTheme과 같은 판정이다.</summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,7 +3,6 @@ using System.Windows;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace UbisamBase.Launcher;
|
namespace UbisamBase.Launcher;
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ public partial class ProgressWindow : Window
|
|||||||
public ProgressWindow()
|
public ProgressWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ApplyTheme(IsSystemLightTheme());
|
ApplyTheme(LauncherTheme.IsLight());
|
||||||
SizeChanged += (_, _) => UpdateFillWidth(animate: false);
|
SizeChanged += (_, _) => UpdateFillWidth(animate: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,20 +92,5 @@ public partial class ProgressWindow : Window
|
|||||||
private static SolidColorBrush Brush(string hex)
|
private static SolidColorBrush Brush(string hex)
|
||||||
=> new SolidColorBrush((Color)ColorConverter.ConvertFromString(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();
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => DragMove();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Microsoft.Win32;
|
|
||||||
|
|
||||||
namespace UbisamBase.Launcher;
|
namespace UbisamBase.Launcher;
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ public partial class UpdateDialog : Window
|
|||||||
CurrentValue.Text = string.IsNullOrEmpty(currentVersion) ? "(알 수 없음)" : currentVersion;
|
CurrentValue.Text = string.IsNullOrEmpty(currentVersion) ? "(알 수 없음)" : currentVersion;
|
||||||
NewValue.Text = newVersion;
|
NewValue.Text = newVersion;
|
||||||
|
|
||||||
ApplyTheme(IsSystemLightTheme());
|
ApplyTheme(LauncherTheme.IsLight());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>보조 버튼에 마우스를 올렸을 때 깔리는 색. 템플릿에서 바인딩해 쓴다.</summary>
|
/// <summary>보조 버튼에 마우스를 올렸을 때 깔리는 색. 템플릿에서 바인딩해 쓴다.</summary>
|
||||||
@ -73,22 +72,6 @@ public partial class UpdateDialog : Window
|
|||||||
private static SolidColorBrush Brush(string hex)
|
private static SolidColorBrush Brush(string hex)
|
||||||
=> new SolidColorBrush((Color)ColorConverter.ConvertFromString(hex));
|
=> new SolidColorBrush((Color)ColorConverter.ConvertFromString(hex));
|
||||||
|
|
||||||
/// <summary>윈도우가 밝은 테마인지. Core의 UiSettingsService.IsSystemLightTheme과 같은 판정이다.</summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>제목줄이 없으므로 창 아무 데나 끌어서 옮길 수 있게 한다.</summary>
|
/// <summary>제목줄이 없으므로 창 아무 데나 끌어서 옮길 수 있게 한다.</summary>
|
||||||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => DragMove();
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => DragMove();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user