Fix broken progress bar in gallery

This commit is contained in:
Timothy Baldridge 2020-02-28 17:00:23 -07:00
parent 1cb43f894a
commit 356adf7d0e
3 changed files with 8 additions and 6 deletions

View File

@ -143,7 +143,7 @@ TOP:
using (var webs = stream) using (var webs = stream)
{ {
var buffer = new byte[bufferSize]; var buffer = new byte[bufferSize];
int read_this_cycle = 0; int readThisCycle = 0;
while (true) while (true)
{ {
@ -154,7 +154,7 @@ TOP:
} }
catch (Exception ex) catch (Exception ex)
{ {
if (read_this_cycle == 0) if (readThisCycle == 0)
throw ex; throw ex;
if (totalRead < contentSize) if (totalRead < contentSize)
@ -176,7 +176,7 @@ TOP:
break; break;
} }
read_this_cycle += read; readThisCycle += read;
if (read == 0) break; if (read == 0) break;
Utils.Status($"Downloading {a.Name}", Percent.FactoryPutInRange(totalRead, contentSize)); Utils.Status($"Downloading {a.Name}", Percent.FactoryPutInRange(totalRead, contentSize));

View File

@ -197,8 +197,7 @@
Background="{StaticResource BackgroundBrush}" Background="{StaticResource BackgroundBrush}"
Foreground="{StaticResource SecondaryBrush}" Foreground="{StaticResource SecondaryBrush}"
Maximum="1" Maximum="1"
Visibility="{Binding IsEnabled, ElementName=ExecuteButton, Converter={StaticResource bool2VisibilityHiddenConverter}, ConverterParameter=False}" Visibility="{Binding IsEnabled, ElementName=ExecuteButton, Converter={StaticResource bool2VisibilityHiddenConverter}, ConverterParameter=False}" />
Value="{Binding ProgressPercent, Mode=OneWay}" />
<TextBlock <TextBlock
x:Name="MetadataDescription" x:Name="MetadataDescription"
Grid.Row="1" Grid.Row="1"

View File

@ -29,10 +29,13 @@ namespace Wabbajack
InitializeComponent(); InitializeComponent();
this.WhenActivated(dispose => this.WhenActivated(dispose =>
{ {
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, Percent>(this.ViewModel, x => x.ProgressPercent);
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.IsBroken); this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.IsBroken);
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.Exists); this.MarkAsNeeded<ModListTileView, ModListMetadataVM, bool>(this.ViewModel, x => x.Exists);
this.MarkAsNeeded<ModListTileView, ModListMetadataVM, string>(this.ViewModel, x => x.Metadata.Links.ImageUri); this.MarkAsNeeded<ModListTileView, ModListMetadataVM, string>(this.ViewModel, x => x.Metadata.Links.ImageUri);
this.WhenAny(x => x.ViewModel.ProgressPercent)
.Select(p => p.Value)
.BindToStrict(this, x => x.DownloadProgressBar.Value)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.Metadata.Title) this.WhenAny(x => x.ViewModel.Metadata.Title)
.BindToStrict(this, x => x.DescriptionTextShadow.Text) .BindToStrict(this, x => x.DescriptionTextShadow.Text)
.DisposeWith(dispose); .DisposeWith(dispose);