AX Agent 설정창 오픈 안정화: ToggleSwitch 전역 리소스화 및 테마 주입 경로 분리
Some checks failed
Release Gate / gate (push) Has been cancelled

- App.xaml: ToggleSwitch 스타일을 전역 리소스로 추가해 ChatWindow 초기화 시 StaticResource 누락 예외를 방지\n- ChatWindow.xaml.cs: Agent 설정창 오픈 시 창 전체 Resources 병합을 제거하고 AX Agent 테마 사전만 안전 주입하도록 변경\n- ChatWindow.xaml.cs: ApplyAgentThemeResources와 설정창 주입 경로에서 공통 URI 생성 로직(BuildAgentThemeDictionaryUri)으로 중복 제거\n- README.md / docs/DEVELOPMENT.md: 2026-04-04 17:12(KST) 기준 변경 이력 및 검증 결과 동기화\n- 검증: dotnet build(경고0/오류0), dotnet test 필터 59 passed
This commit is contained in:
2026-04-04 16:32:42 +09:00
parent 2e945e36d5
commit effadf7185
4 changed files with 77 additions and 10 deletions

View File

@@ -803,13 +803,7 @@ public partial class ChatWindow : Window
private void ApplyAgentThemeResources()
{
var selected = (_settings.Settings.Llm.AgentTheme ?? "system").Trim().ToLowerInvariant();
var effective = selected switch
{
"light" => "AgentLight",
"dark" => "AgentDark",
_ => IsSystemDarkTheme() ? "AgentDark" : "AgentLight",
};
var themeUri = BuildAgentThemeDictionaryUri();
try
{
@@ -818,7 +812,7 @@ public partial class ChatWindow : Window
_agentThemeDictionary = new ResourceDictionary
{
Source = new Uri($"pack://application:,,,/Themes/{effective}.xaml"),
Source = themeUri,
};
Resources.MergedDictionaries.Insert(0, _agentThemeDictionary);
}
@@ -828,6 +822,18 @@ public partial class ChatWindow : Window
}
}
private Uri BuildAgentThemeDictionaryUri()
{
var selected = (_settings.Settings.Llm.AgentTheme ?? "system").Trim().ToLowerInvariant();
var effective = selected switch
{
"light" => "AgentLight",
"dark" => "AgentDark",
_ => IsSystemDarkTheme() ? "AgentDark" : "AgentLight",
};
return new Uri($"pack://application:,,,/Themes/{effective}.xaml");
}
private static bool IsSystemDarkTheme()
{
try
@@ -12974,11 +12980,14 @@ public partial class ChatWindow : Window
win.Closed += (_, _) => _agentSettingsWindow = null;
try
{
win.Resources.MergedDictionaries.Add(Resources);
win.Resources.MergedDictionaries.Insert(0, new ResourceDictionary
{
Source = BuildAgentThemeDictionaryUri(),
});
}
catch
{
// 리소스 병합 실패 시에도 설정창 자체는 열리도록 유지
// 테마 사전 로드 실패 시에도 설정창 자체는 열리도록 유지
}
bool changed;