refactor(P5b-3): 옵션 패널 품질·출력폴더를 OptionsViewModel에 선언적 TwoWay 바인딩
뷰 바인딩 마이그레이션 첫 슬라이스 — 명령형 컨트롤 읽기를 선언적 XAML 바인딩으로 전환. - MainWindow.Options(OptionsViewModel) 노출. XAML: QualitySlider.Value ↔ Options.Quality, OutputPathTextBox.Text ↔ Options.CustomOutputDirectory (TwoWay, Window-relative). - BuildOptions: Quality/CustomOutputDirectory 수동 동기 제거(바인딩이 담당). 충돌/AI/GPU만 코드비하인드. - 검증: 빌드 0/0, 83 테스트 그린, publish 후 메인 창 크래시 없이 로드(언핸들드 로그 없음 = XAML 파싱/구성 정상). 비치명적 실패 모드(바인딩 오류 시 기본값 degrade, 크래시 없음) — 슬라이더/출력폴더 실동작은 GUI 스모크 권장.
This commit is contained in:
parent
e95ec967e6
commit
6a4ac2d60c
2 changed files with 8 additions and 4 deletions
|
|
@ -134,7 +134,8 @@
|
|||
</Grid>
|
||||
<Slider x:Name="QualitySlider" Margin="0,12,0,0"
|
||||
Style="{StaticResource FsSliderStyle}"
|
||||
Minimum="1" Maximum="100" Value="85"
|
||||
Minimum="1" Maximum="100"
|
||||
Value="{Binding Options.Quality, RelativeSource={RelativeSource AncestorType=Window}, Mode=TwoWay}"
|
||||
ValueChanged="OnQualityChanged"/>
|
||||
<Grid Margin="0,4,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -156,6 +157,7 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="OutputPathTextBox"
|
||||
Style="{StaticResource FsPathInputStyle}"
|
||||
Text="{Binding Options.CustomOutputDirectory, RelativeSource={RelativeSource AncestorType=Window}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="비워두면 원본 폴더 옆 서브폴더에 저장"/>
|
||||
<Button Grid.Column="1" Margin="8,0,0,0" Width="36"
|
||||
Content="…" Style="{StaticResource FsSecondaryButtonStyle}"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow
|
|||
|
||||
public string? SelectedOutputExtension { get; set; } = ".jpg";
|
||||
|
||||
/// <summary>옵션 패널 XAML이 TwoWay 바인딩하는 옵션 뷰모델(품질·출력폴더).</summary>
|
||||
public OptionsViewModel Options => _options;
|
||||
|
||||
public ICommand AddFilesCommand { get; }
|
||||
public ICommand ProcessQueueCommand { get; }
|
||||
public ICommand CloseCommand { get; }
|
||||
|
|
@ -280,9 +283,8 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow
|
|||
|
||||
private ConvertOptions BuildOptions()
|
||||
{
|
||||
// 뷰의 컨트롤 값을 OptionsViewModel에 반영한 뒤, 불변 ConvertOptions 구성은 VM의 순수 메서드에 위임한다.
|
||||
_options.Quality = (int)QualitySlider.Value;
|
||||
_options.CustomOutputDirectory = OutputPathTextBox.Text?.Trim();
|
||||
// Quality/CustomOutputDirectory는 옵션 패널 XAML이 _options에 TwoWay 바인딩(선언적).
|
||||
// 충돌 규칙(세그먼트 토글)·AI(콤보 상호작용)·GPU(설정)는 상호작용 로직이 있어 코드비하인드에서 반영.
|
||||
_options.ConflictRule = _conflictRule;
|
||||
_options.AiTaskIndex = AiTaskCombo?.SelectedIndex ?? 0;
|
||||
_options.TargetLanguage = AiTargetLangBox?.Text?.Trim();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue