Skip to content

Commit

Permalink
Tiny nits for winget (#378)
Browse files Browse the repository at this point in the history
I guess I only subconsciously knew that the progress value in WinUI was in percent, not [0,1].
Also actually do the description fallback I wanted.
  • Loading branch information
zadjii-msft authored Jan 29, 2025
1 parent 4ce5515 commit c39141b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public partial class ProgressViewModel : ExtensionObjectViewModel

public uint ProgressPercent { get; private set; }

public double ProgressValue => ProgressPercent / 100.0;

public ProgressViewModel(IProgressState progress, IPageContext context)
: base(context)
{
Expand Down Expand Up @@ -64,7 +62,6 @@ protected virtual void FetchProperty(string propertyName)
break;
case nameof(ProgressPercent):
this.ProgressPercent = model.ProgressPercent;
UpdateProperty(nameof(ProgressValue));
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
Margin="0,-20,0,0"
IsIndeterminate="{x:Bind ViewModel.CurrentPage.MostRecentStatusMessage.Progress.IsIndeterminate, Mode=OneWay}"
Visibility="{x:Bind ViewModel.CurrentPage.MostRecentStatusMessage.HasProgress, Mode=OneWay}"
Value="{x:Bind ViewModel.CurrentPage.MostRecentStatusMessage.Progress.ProgressValue, Mode=OneWay}" />
Value="{x:Bind ViewModel.CurrentPage.MostRecentStatusMessage.Progress.ProgressPercent, Mode=OneWay}" />
<!-- Margin="0,0,0,6" MaxWidth="200"/> -->
</InfoBar.Content>
</InfoBar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ private void OnInstallProgress(
{
downloadText += $"{FormatBytes(progress.BytesDownloaded)} of {FormatBytes(progress.BytesRequired)}";
_installBanner.Progress ??= new ProgressState() { IsIndeterminate = false };
((ProgressState)_installBanner.Progress).ProgressPercent = (uint)(progress.BytesDownloaded / progress.BytesRequired * 100);
var downloaded = (float)progress.BytesDownloaded / (float)progress.BytesRequired;
var percent = downloaded * 100.0f;
((ProgressState)_installBanner.Progress).ProgressPercent = (uint)percent;
_installBanner.Message = downloadText;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ public InstallPackageListItem(CatalogPackage package)
{
var description = string.IsNullOrEmpty(metadata.Description) ? metadata.ShortDescription : metadata.Description;
var detailsBody = $"""
## {metadata.Publisher}
{metadata.Description}
{description}
""";
IconInfo heroIcon = new(string.Empty);
var icons = metadata.Icons;
Expand All @@ -64,7 +63,7 @@ public InstallPackageListItem(CatalogPackage package)

private List<IDetailsElement> GetDetailsMetadata(CatalogPackageMetadata metadata)
{
List<IDetailsElement> detailsElements = new();
List<IDetailsElement> detailsElements = [];

// key -> {text, url}
Dictionary<string, (string, string)> simpleData = new()
Expand Down

0 comments on commit c39141b

Please sign in to comment.