mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Added loading progress display for modlist images in gallery
This commit is contained in:
parent
f8c640467f
commit
3ed80d1aba
@ -45,6 +45,9 @@ namespace Wabbajack
|
||||
private readonly ObservableAsPropertyHelper<BitmapImage> _Image;
|
||||
public BitmapImage Image => _Image.Value;
|
||||
|
||||
private readonly ObservableAsPropertyHelper<bool> _LoadingImage;
|
||||
public bool LoadingImage => _LoadingImage.Value;
|
||||
|
||||
public ModListMetadataVM(ModListGalleryVM parent, ModlistMetadata metadata)
|
||||
{
|
||||
_parent = parent;
|
||||
@ -121,9 +124,16 @@ namespace Wabbajack
|
||||
})
|
||||
.ToGuiProperty(this, nameof(Exists));
|
||||
|
||||
_Image = Observable.Return(Metadata.Links.ImageUri)
|
||||
.DownloadBitmapImage((ex) => Utils.Log($"Error downloading modlist image {Metadata.Title}"))
|
||||
var imageObs = Observable.Return(Metadata.Links.ImageUri)
|
||||
.DownloadBitmapImage((ex) => Utils.Log($"Error downloading modlist image {Metadata.Title}"));
|
||||
|
||||
_Image = imageObs
|
||||
.ToGuiProperty(this, nameof(Image));
|
||||
|
||||
_LoadingImage = imageObs
|
||||
.Select(x => false)
|
||||
.StartWith(true)
|
||||
.ToGuiProperty(this, nameof(LoadingImage));
|
||||
}
|
||||
|
||||
private Task Download()
|
||||
|
@ -86,6 +86,7 @@
|
||||
BorderBrush="{StaticResource ButtonNormalBorder}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid ClipToBounds="True">
|
||||
<mahapps:ProgressRing x:Name="LoadingProgress" />
|
||||
<Viewbox
|
||||
Height="340"
|
||||
HorizontalAlignment="Center"
|
||||
@ -119,7 +120,7 @@
|
||||
<Ellipse.Style>
|
||||
<Style TargetType="Ellipse">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Value="True">
|
||||
<DataTrigger Binding="{Binding IsMouseOver, ElementName=ModListTile}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
|
@ -54,6 +54,10 @@ namespace Wabbajack
|
||||
this.WhenAny(x => x.ViewModel.Image)
|
||||
.BindToStrict(this, x => x.ModListImage.Source)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.LoadingImage)
|
||||
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
|
||||
.BindToStrict(this, x => x.LoadingProgress.Visibility)
|
||||
.DisposeWith(dispose);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user