AX Agent 설정창 오픈 안정화: ToggleSwitch 전역 리소스화 및 테마 주입 경로 분리
Some checks failed
Release Gate / gate (push) Has been cancelled
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:
@@ -19,6 +19,42 @@
|
||||
<converters:WarningSubtitleColorConverter x:Key="WarningSubtitleColorConverter"/>
|
||||
<converters:ClipboardThumbnailConverter x:Key="ClipboardThumbnailConverter"/>
|
||||
<converters:ClipboardHasImageConverter x:Key="ClipboardHasImageConverter"/>
|
||||
|
||||
<!-- 전역 토글 스위치: 창별 리소스 누락 시에도 동일 스타일 보장 -->
|
||||
<Style x:Key="ToggleSwitch" TargetType="CheckBox">
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="CheckBox">
|
||||
<Grid Width="46" Height="26" VerticalAlignment="Center">
|
||||
<Border x:Name="Track"
|
||||
Width="46"
|
||||
Height="26"
|
||||
CornerRadius="13"
|
||||
Background="#D0D0E0"/>
|
||||
<Ellipse x:Name="Thumb"
|
||||
Width="20"
|
||||
Height="20"
|
||||
Margin="3,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Fill="White">
|
||||
<Ellipse.Effect>
|
||||
<DropShadowEffect BlurRadius="5" ShadowDepth="1" Opacity="0.25" Direction="270"/>
|
||||
</Ellipse.Effect>
|
||||
</Ellipse>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="Track" Property="Background" Value="{DynamicResource AccentColor}"/>
|
||||
<Setter TargetName="Thumb" Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter TargetName="Thumb" Property="Margin" Value="0,0,3,0"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user