mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
1ce640ba2b
* Created AbstractMetaState * Added IAbstractMetaState to NexusDownloader.State Slideshow is fully working with this setup and nothing changed functionally. * Renamed IAbstractMetaState to IMetaState * Changed modVMs in SlideShow from type NexusDownloader.State to IMetaState * Simplified IMetaState and ModVM * Removed Setter from IMetaState and added to LoversLabDownloader * Throw exception when the modlist could not be loaded * Created AbstractMetaState AbstractMetaState implements AbstractDownloadState and indicates that a State from a specific Download contains meta information. This is used for the Slideshow and can also be used for the Manifest. * Created GatherMetaData function * Implemented new AbstractMetaState for LoversLab * Implemented new AbstractMetaState for NexusMods * Replaced Utils.Log with Utils.Error * Slideshow fixes * Replaced AbstractMetaState with IMetaState * Updated CHANGELOG Co-authored-by: Timothy Baldridge <tbaldridge@gmail.com>
32 lines
1019 B
C#
32 lines
1019 B
C#
using ReactiveUI;
|
|
using System;
|
|
using System.Reactive.Linq;
|
|
using System.Windows.Media.Imaging;
|
|
using Wabbajack.Common;
|
|
using Wabbajack.Lib;
|
|
using Wabbajack.Lib.Downloaders;
|
|
|
|
namespace Wabbajack
|
|
{
|
|
public class ModVM : ViewModel
|
|
{
|
|
public IMetaState State { get; }
|
|
|
|
// Image isn't exposed as a direct property, but as an observable.
|
|
// This acts as a caching mechanism, as interested parties will trigger it to be created,
|
|
// and the cached image will automatically be released when the last interested party is gone.
|
|
public IObservable<BitmapImage> ImageObservable { get; }
|
|
|
|
public ModVM(IMetaState state)
|
|
{
|
|
State = state;
|
|
|
|
ImageObservable = Observable.Return(State.ImageURL)
|
|
.ObserveOn(RxApp.TaskpoolScheduler)
|
|
.DownloadBitmapImage((ex) => Utils.Log($"Skipping slide for mod {State.Name}"))
|
|
.Replay(1)
|
|
.RefCount(TimeSpan.FromMilliseconds(5000));
|
|
}
|
|
}
|
|
}
|