Skip to content

Commit

Permalink
在任务栏中显示进度
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbbaixue committed Dec 30, 2023
1 parent d73afb9 commit 71ce9e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Ra3.BattleNet.Downloader/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<Window.DataContext>
<local:ViewModel />
</Window.DataContext>
<Window.TaskbarItemInfo>
<TaskbarItemInfo ProgressState="Normal" ProgressValue="{Binding ProgressTaskbarValue, Mode=OneWay}" />
</Window.TaskbarItemInfo>
<StackPanel Margin="24,12,24,24">
<TextBlock Text="{Binding DownloadText}" TextWrapping="Wrap" />
<Grid Margin="0,2,0,10">
Expand Down
2 changes: 2 additions & 0 deletions Ra3.BattleNet.Downloader/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ public void SetDownloadedSize(long downloadedSize, long totalSize)

public string Progress => string.Format(Get(nameof(Progress)), _progress);
public double ProgressBarValue => _progress * 100;
public double ProgressTaskbarValue => _progress;

private double _progress;
public void SetProgress(double progress)
{
_progress = progress;
OnSet(nameof(Progress));
OnSet(nameof(ProgressBarValue));
OnSet(nameof(ProgressTaskbarValue));
}

public string DownloadSpeed => string.Format(Get(nameof(DownloadSpeed)), FormatBytes(_bytePerSecond));
Expand Down

0 comments on commit 71ce9e3

Please sign in to comment.