feat: 진행 표시 보강 — 취소 버튼 + 큐 row inline progress bar
사이드바 진행 패널 - '취소' 버튼 추가 (FsSecondaryButtonStyle, ProcessingPercentLabel 우측) - 클릭 시 _cts.Cancel() + 라벨/버튼 '취소 중…'으로 전환 - finally에서 버튼 상태 복원 큐 row inline progress - QueueItem에 ProgressValue (0~100), ProgressVisibility 속성 추가 - SetState() 안에서 텍스트 파싱: 'queued'/'done'/'NN%' → 자동 갱신 - ItemTemplate에 Height=3 ProgressBar 추가 (MetaLine 아래) - 변환 중인 row만 시각적 bar 표시
This commit is contained in:
parent
ae897ea043
commit
81d0a04eb0
2 changed files with 67 additions and 7 deletions
|
|
@ -255,12 +255,21 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
<ProgressBar x:Name="ProcessingProgressBar"
|
<ProgressBar x:Name="ProcessingProgressBar"
|
||||||
Height="6" Minimum="0" Maximum="100" Value="0"/>
|
Height="6" Minimum="0" Maximum="100" Value="0"/>
|
||||||
|
<Grid Margin="0,4,0,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock x:Name="ProcessingPercentLabel"
|
<TextBlock x:Name="ProcessingPercentLabel"
|
||||||
Margin="0,4,0,0"
|
|
||||||
FontFamily="{StaticResource FsFontMono}" FontSize="10"
|
FontFamily="{StaticResource FsFontMono}" FontSize="10"
|
||||||
Foreground="{StaticResource FsTextSecondary}"
|
Foreground="{StaticResource FsTextSecondary}"
|
||||||
HorizontalAlignment="Right"
|
VerticalAlignment="Center"
|
||||||
Text="0%"/>
|
Text="0%"/>
|
||||||
|
<Button x:Name="CancelProcessingButton" Grid.Column="1"
|
||||||
|
Content="취소" Padding="10,2"
|
||||||
|
Style="{StaticResource FsSecondaryButtonStyle}"
|
||||||
|
Click="OnCancelProcessingClick"/>
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Button x:Name="ProcessQueueButton"
|
<Button x:Name="ProcessQueueButton"
|
||||||
|
|
@ -407,6 +416,10 @@
|
||||||
<TextBlock Text="{Binding MetaLine}"
|
<TextBlock Text="{Binding MetaLine}"
|
||||||
Style="{StaticResource FsCaptionStyle}"
|
Style="{StaticResource FsCaptionStyle}"
|
||||||
Margin="0,2,0,0"/>
|
Margin="0,2,0,0"/>
|
||||||
|
<ProgressBar Height="3" Margin="0,4,0,0"
|
||||||
|
Minimum="0" Maximum="100"
|
||||||
|
Value="{Binding ProgressValue, Mode=OneWay}"
|
||||||
|
Visibility="{Binding ProgressVisibility, Mode=OneWay}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock Grid.Column="2" Text="{Binding SizeText}"
|
<TextBlock Grid.Column="2" Text="{Binding SizeText}"
|
||||||
Style="{StaticResource FsMonoStyle}"
|
Style="{StaticResource FsMonoStyle}"
|
||||||
|
|
|
||||||
|
|
@ -608,6 +608,24 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow
|
||||||
{
|
{
|
||||||
if (ProcessingProgressPanel is null) return;
|
if (ProcessingProgressPanel is null) return;
|
||||||
ProcessingProgressPanel.Visibility = Visibility.Collapsed;
|
ProcessingProgressPanel.Visibility = Visibility.Collapsed;
|
||||||
|
if (CancelProcessingButton is not null)
|
||||||
|
{
|
||||||
|
CancelProcessingButton.IsEnabled = true;
|
||||||
|
CancelProcessingButton.Content = "취소";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCancelProcessingClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_cts is null) return;
|
||||||
|
try { _cts.Cancel(); } catch { }
|
||||||
|
if (CancelProcessingButton is not null)
|
||||||
|
{
|
||||||
|
CancelProcessingButton.IsEnabled = false;
|
||||||
|
CancelProcessingButton.Content = "취소 중…";
|
||||||
|
}
|
||||||
|
if (ProcessingFileLabel is not null)
|
||||||
|
ProcessingFileLabel.Text = "취소 중…";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============== History ==============
|
// ============== History ==============
|
||||||
|
|
@ -971,6 +989,8 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow
|
||||||
public sealed class QueueItem : INotifyPropertyChanged
|
public sealed class QueueItem : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private string _state = "queued";
|
private string _state = "queued";
|
||||||
|
private double _progressValue;
|
||||||
|
private Visibility _progressVisibility = Visibility.Collapsed;
|
||||||
|
|
||||||
public required string SourcePath { get; init; }
|
public required string SourcePath { get; init; }
|
||||||
public required string FileName { get; init; }
|
public required string FileName { get; init; }
|
||||||
|
|
@ -993,11 +1013,38 @@ public sealed class QueueItem : INotifyPropertyChanged
|
||||||
_ => (Brush)Application.Current.FindResource("FsAccentBlue"),
|
_ => (Brush)Application.Current.FindResource("FsAccentBlue"),
|
||||||
};
|
};
|
||||||
|
|
||||||
public void SetPending() => StateText = "queued";
|
public double ProgressValue
|
||||||
|
{
|
||||||
|
get => _progressValue;
|
||||||
|
private set { _progressValue = value; Raise(nameof(ProgressValue)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Visibility ProgressVisibility
|
||||||
|
{
|
||||||
|
get => _progressVisibility;
|
||||||
|
private set { _progressVisibility = value; Raise(nameof(ProgressVisibility)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPending()
|
||||||
|
{
|
||||||
|
StateText = "queued";
|
||||||
|
ProgressValue = 0;
|
||||||
|
ProgressVisibility = Visibility.Collapsed;
|
||||||
|
Raise(nameof(StateBrush));
|
||||||
|
}
|
||||||
|
|
||||||
public void SetState(string s)
|
public void SetState(string s)
|
||||||
{
|
{
|
||||||
StateText = s;
|
StateText = s;
|
||||||
Raise(nameof(StateBrush));
|
Raise(nameof(StateBrush));
|
||||||
|
|
||||||
|
if (s == "queued") { ProgressValue = 0; ProgressVisibility = Visibility.Collapsed; }
|
||||||
|
else if (s == "done") { ProgressValue = 100; ProgressVisibility = Visibility.Visible; }
|
||||||
|
else if (s.EndsWith('%') && double.TryParse(s.TrimEnd('%'), out var pct))
|
||||||
|
{
|
||||||
|
ProgressValue = pct;
|
||||||
|
ProgressVisibility = Visibility.Visible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QueueItem FromPath(string path)
|
public static QueueItem FromPath(string path)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue