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:
@ -45,6 +45,9 @@ namespace Wabbajack
|
|||||||
private readonly ObservableAsPropertyHelper<BitmapImage> _Image;
|
private readonly ObservableAsPropertyHelper<BitmapImage> _Image;
|
||||||
public BitmapImage Image => _Image.Value;
|
public BitmapImage Image => _Image.Value;
|
||||||
|
|
||||||
|
private readonly ObservableAsPropertyHelper<bool> _LoadingImage;
|
||||||
|
public bool LoadingImage => _LoadingImage.Value;
|
||||||
|
|
||||||
public ModListMetadataVM(ModListGalleryVM parent, ModlistMetadata metadata)
|
public ModListMetadataVM(ModListGalleryVM parent, ModlistMetadata metadata)
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
@ -121,9 +124,16 @@ namespace Wabbajack
|
|||||||
})
|
})
|
||||||
.ToGuiProperty(this, nameof(Exists));
|
.ToGuiProperty(this, nameof(Exists));
|
||||||
|
|
||||||
_Image = Observable.Return(Metadata.Links.ImageUri)
|
var imageObs = Observable.Return(Metadata.Links.ImageUri)
|
||||||
.DownloadBitmapImage((ex) => Utils.Log($"Error downloading modlist image {Metadata.Title}"))
|
.DownloadBitmapImage((ex) => Utils.Log($"Error downloading modlist image {Metadata.Title}"));
|
||||||
|
|
||||||
|
_Image = imageObs
|
||||||
.ToGuiProperty(this, nameof(Image));
|
.ToGuiProperty(this, nameof(Image));
|
||||||
|
|
||||||
|
_LoadingImage = imageObs
|
||||||
|
.Select(x => false)
|
||||||
|
.StartWith(true)
|
||||||
|
.ToGuiProperty(this, nameof(LoadingImage));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task Download()
|
private Task Download()
|
||||||
|
@ -86,6 +86,7 @@
|
|||||||
BorderBrush="{StaticResource ButtonNormalBorder}"
|
BorderBrush="{StaticResource ButtonNormalBorder}"
|
||||||
BorderThickness="0,0,0,1">
|
BorderThickness="0,0,0,1">
|
||||||
<Grid ClipToBounds="True">
|
<Grid ClipToBounds="True">
|
||||||
|
<mahapps:ProgressRing x:Name="LoadingProgress" />
|
||||||
<Viewbox
|
<Viewbox
|
||||||
Height="340"
|
Height="340"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
@ -119,7 +120,7 @@
|
|||||||
<Ellipse.Style>
|
<Ellipse.Style>
|
||||||
<Style TargetType="Ellipse">
|
<Style TargetType="Ellipse">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Value="True">
|
<DataTrigger Binding="{Binding IsMouseOver, ElementName=ModListTile}" Value="True">
|
||||||
<DataTrigger.EnterActions>
|
<DataTrigger.EnterActions>
|
||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
|
@ -54,6 +54,10 @@ namespace Wabbajack
|
|||||||
this.WhenAny(x => x.ViewModel.Image)
|
this.WhenAny(x => x.ViewModel.Image)
|
||||||
.BindToStrict(this, x => x.ModListImage.Source)
|
.BindToStrict(this, x => x.ModListImage.Source)
|
||||||
.DisposeWith(dispose);
|
.DisposeWith(dispose);
|
||||||
|
this.WhenAny(x => x.ViewModel.LoadingImage)
|
||||||
|
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
|
||||||
|
.BindToStrict(this, x => x.LoadingProgress.Visibility)
|
||||||
|
.DisposeWith(dispose);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user