mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reactive.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
using ReactiveUI;
|
|
using Wabbajack.Lib;
|
|
using Wabbajack.Lib.Downloaders;
|
|
|
|
namespace Wabbajack
|
|
{
|
|
public class LoginManagerVM : BackNavigatingVM
|
|
{
|
|
public List<LoginTargetVM> Downloaders { get; }
|
|
|
|
public LoginManagerVM(SettingsVM settingsVM)
|
|
: base(settingsVM.MWVM)
|
|
{
|
|
Downloaders = DownloadDispatcher.Downloaders
|
|
.OfType<INeedsLogin>()
|
|
.Select(x => new LoginTargetVM(x))
|
|
.ToList();
|
|
}
|
|
}
|
|
|
|
public class LoginTargetVM : ViewModel
|
|
{
|
|
private readonly ObservableAsPropertyHelper<string> _MetaInfo;
|
|
public string MetaInfo => _MetaInfo.Value;
|
|
|
|
public INeedsLogin Login { get; }
|
|
|
|
public LoginTargetVM(INeedsLogin login)
|
|
{
|
|
Login = login;
|
|
_MetaInfo = (login.MetaInfo ?? Observable.Return(""))
|
|
.ObserveOnGuiThread()
|
|
.ToProperty(this, nameof(MetaInfo));
|
|
}
|
|
}
|
|
}
|