mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
WIP
This commit is contained in:
parent
2ee23e8ced
commit
f5eb4d1d84
@ -5,6 +5,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
@ -39,6 +40,14 @@ namespace Wabbajack.Common
|
||||
}
|
||||
|
||||
public static string LogFile { get; private set; }
|
||||
|
||||
public enum FileEventType
|
||||
{
|
||||
Created,
|
||||
Changed,
|
||||
Deleted
|
||||
}
|
||||
|
||||
static Utils()
|
||||
{
|
||||
var programName = Assembly.GetEntryAssembly()?.Location ?? "Wabbajack";
|
||||
@ -47,6 +56,13 @@ namespace Wabbajack.Common
|
||||
|
||||
if (LogFile.FileExists())
|
||||
File.Delete(LogFile);
|
||||
|
||||
var watcher = new FileSystemWatcher(Consts.LocalAppDataPath);
|
||||
AppLocalEvents = Observable.Merge(Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h => watcher.Changed += h, h => watcher.Changed -= h).Select(e => (FileEventType.Changed, e.EventArgs)),
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h => watcher.Created += h, h => watcher.Created -= h).Select(e => (FileEventType.Created, e.EventArgs)),
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h => watcher.Deleted += h, h => watcher.Deleted -= h).Select(e => (FileEventType.Deleted, e.EventArgs)))
|
||||
.ObserveOn(RxApp.TaskpoolScheduler);
|
||||
watcher.EnableRaisingEvents = true;
|
||||
}
|
||||
|
||||
private static readonly Subject<IStatusMessage> LoggerSubj = new Subject<IStatusMessage>();
|
||||
@ -961,12 +977,37 @@ namespace Wabbajack.Common
|
||||
|
||||
public static T FromEncryptedJson<T>(string key)
|
||||
{
|
||||
var path = Path.Combine(KnownFolders.LocalAppData.Path, "Wabbajack", key);
|
||||
var path = Path.Combine(Consts.LocalAppDataPath, key);
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
var decoded = ProtectedData.Unprotect(bytes, Encoding.UTF8.GetBytes(key), DataProtectionScope.LocalMachine);
|
||||
return Encoding.UTF8.GetString(decoded).FromJSONString<T>();
|
||||
}
|
||||
|
||||
public static bool HaveEncryptedJson(string key)
|
||||
{
|
||||
var path = Path.Combine(Consts.LocalAppDataPath, key);
|
||||
return File.Exists(path);
|
||||
}
|
||||
|
||||
public static IObservable<(FileEventType, FileSystemEventArgs)> AppLocalEvents { get; }
|
||||
|
||||
public static IObservable<bool> HaveEncryptedJsonObservable(string key)
|
||||
{
|
||||
var path = Path.Combine(Consts.LocalAppDataPath, key).ToLower();
|
||||
return AppLocalEvents.Where(t => t.Item2.FullPath.ToLower() == path)
|
||||
.Select(_ => File.Exists(path))
|
||||
.StartWith(File.Exists(path))
|
||||
.DistinctUntilChanged();
|
||||
}
|
||||
|
||||
public static void DeleteEncryptedJson(string key)
|
||||
{
|
||||
var path = Path.Combine(Consts.LocalAppDataPath, key);
|
||||
if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
}
|
||||
|
||||
|
||||
public static bool IsInPath(this string path, string parent)
|
||||
{
|
||||
return path.ToLower().TrimEnd('\\').StartsWith(parent.ToLower().TrimEnd('\\') + "\\");
|
||||
|
22
Wabbajack.Lib/Downloaders/INeedsLogin.cs
Normal file
22
Wabbajack.Lib/Downloaders/INeedsLogin.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public interface INeedsLogin : INotifyPropertyChanged
|
||||
{
|
||||
ICommand TriggerLogin { get; }
|
||||
ICommand ClearLogin { get; }
|
||||
IObservable<bool> IsLoggedIn { get; }
|
||||
string SiteName { get; }
|
||||
string MetaInfo { get; }
|
||||
Uri SiteURL { get; }
|
||||
Uri IconUri { get; }
|
||||
|
||||
}
|
||||
}
|
@ -4,22 +4,47 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib.LibCefHelpers;
|
||||
using Wabbajack.Lib.NexusApi;
|
||||
using Wabbajack.Lib.Validation;
|
||||
using Xilium.CefGlue.Common;
|
||||
using File = Alphaleonis.Win32.Filesystem.File;
|
||||
|
||||
namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public class LoversLabDownloader : IDownloader
|
||||
public class LoversLabDownloader : ViewModel, IDownloader, INeedsLogin
|
||||
{
|
||||
internal HttpClient _authedClient;
|
||||
|
||||
|
||||
#region INeedsDownload
|
||||
|
||||
public ICommand TriggerLogin { get; }
|
||||
public ICommand ClearLogin { get; }
|
||||
public IObservable<bool> IsLoggedIn => Utils.HaveEncryptedJsonObservable("loverslabcookies");
|
||||
public string SiteName => "Lovers Lab";
|
||||
public string MetaInfo => "";
|
||||
public Uri SiteURL => new Uri("https://loverslab.com");
|
||||
public Uri IconUri => new Uri("https://www.loverslab.com/favicon.ico");
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
public LoversLabDownloader()
|
||||
{
|
||||
TriggerLogin = ReactiveCommand.Create(async () => await Utils.Log(new RequestLoversLabLogin()).Task, IsLoggedIn.Select(b => !b).ObserveOn(RxApp.MainThreadScheduler));
|
||||
ClearLogin = ReactiveCommand.Create(() => Utils.DeleteEncryptedJson("loverslabcookies"), IsLoggedIn.ObserveOn(RxApp.MainThreadScheduler));
|
||||
}
|
||||
|
||||
|
||||
public async Task<AbstractDownloadState> GetDownloaderState(dynamic archive_ini)
|
||||
{
|
||||
Uri url = DownloaderUtils.GetDirectURL(archive_ini);
|
||||
@ -84,7 +109,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
}
|
||||
catch (FileNotFoundException) { }
|
||||
|
||||
cookies = Utils.Log(new RequestLoversLabLogin()).Task.Result;
|
||||
cookies = await Utils.Log(new RequestLoversLabLogin()).Task;
|
||||
return Helpers.GetClient(cookies, "https://www.loverslab.com");
|
||||
}
|
||||
|
||||
@ -176,6 +201,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
return $"* Lovers Lab - [{a.Name}](https://www.loverslab.com/files/file/{FileName}/?do=download&r={FileID})";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RequestLoversLabLogin : AUserIntervention
|
||||
|
@ -1,7 +1,11 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.StatusFeed.Errors;
|
||||
using Wabbajack.Lib.NexusApi;
|
||||
@ -9,13 +13,39 @@ using Wabbajack.Lib.Validation;
|
||||
|
||||
namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public class NexusDownloader : IDownloader
|
||||
public class NexusDownloader : ViewModel, IDownloader, INeedsLogin
|
||||
{
|
||||
private bool _prepared;
|
||||
private SemaphoreSlim _lock = new SemaphoreSlim(1);
|
||||
private UserStatus _status;
|
||||
private NexusApiClient _client;
|
||||
|
||||
public NexusDownloader()
|
||||
{
|
||||
TriggerLogin = ReactiveCommand.Create(async () => await NexusApiClient.RequestAndCacheAPIKey(), IsLoggedIn.Select(b => !b).ObserveOn(RxApp.MainThreadScheduler));
|
||||
ClearLogin = ReactiveCommand.Create(() => Utils.DeleteEncryptedJson("nexusapikey"), IsLoggedIn.ObserveOn(RxApp.MainThreadScheduler));
|
||||
}
|
||||
|
||||
public IObservable<bool> IsLoggedIn => Utils.HaveEncryptedJsonObservable("nexusapikey");
|
||||
|
||||
public string SiteName => "Nexus Mods";
|
||||
|
||||
public string MetaInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Uri SiteURL => new Uri("https://www.nexusmods.com");
|
||||
|
||||
public Uri IconUri => new Uri("https://www.nexusmods.com/favicon.ico");
|
||||
|
||||
public ICommand TriggerLogin { get; }
|
||||
public ICommand ClearLogin { get; }
|
||||
|
||||
public async Task<AbstractDownloadState> GetDownloaderState(dynamic archiveINI)
|
||||
{
|
||||
var general = archiveINI?.General;
|
||||
|
@ -89,9 +89,7 @@ namespace Wabbajack.Lib.NexusApi
|
||||
return env_key;
|
||||
}
|
||||
|
||||
var result = await Utils.Log(new RequestNexusAuthorization()).Task;
|
||||
result.ToEcryptedJson("nexusapikey");
|
||||
return result;
|
||||
return await RequestAndCacheAPIKey();
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -99,6 +97,13 @@ namespace Wabbajack.Lib.NexusApi
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<string> RequestAndCacheAPIKey()
|
||||
{
|
||||
var result = await Utils.Log(new RequestNexusAuthorization()).Task;
|
||||
result.ToEcryptedJson("nexusapikey");
|
||||
return result;
|
||||
}
|
||||
|
||||
class RefererHandler : RequestHandler
|
||||
{
|
||||
private string _referer;
|
||||
|
@ -116,6 +116,7 @@
|
||||
<Compile Include="CompilationSteps\PatchStockESMs.cs" />
|
||||
<Compile Include="CompilationSteps\Serialization.cs" />
|
||||
<Compile Include="Downloaders\GameFileSourceDownloader.cs" />
|
||||
<Compile Include="Downloaders\INeedsLogin.cs" />
|
||||
<Compile Include="Downloaders\LoversLabDownloader.cs" />
|
||||
<Compile Include="Downloaders\SteamWorkshopDownloader.cs" />
|
||||
<Compile Include="Extensions\ReactiveUIExt.cs" />
|
||||
|
21
Wabbajack/UserInterventions/ShowLoginManager.cs
Normal file
21
Wabbajack/UserInterventions/ShowLoginManager.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.UserInterventions
|
||||
{
|
||||
public class ShowLoginManager : AUserIntervention
|
||||
{
|
||||
public override string ShortDescription => "User requested to show the login manager";
|
||||
|
||||
public override string ExtendedDescription => "User requested to show the UI for managing all the logins supported by Wabbajack";
|
||||
|
||||
public override void Cancel()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
25
Wabbajack/View Models/LoginManagerVM.cs
Normal file
25
Wabbajack/View Models/LoginManagerVM.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.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 : ViewModel
|
||||
{
|
||||
private MainWindowVM mainWindowVM;
|
||||
public ICommand BackCommand { get; }
|
||||
public List<INeedsLogin> Downloaders { get; }
|
||||
|
||||
public LoginManagerVM(MainWindowVM mainWindowVM)
|
||||
{
|
||||
BackCommand = ReactiveCommand.Create(() => mainWindowVM.NavigateBack());
|
||||
Downloaders = DownloadDispatcher.Downloaders.OfType<INeedsLogin>().ToList();
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
@ -38,9 +39,17 @@ namespace Wabbajack
|
||||
public readonly ModeSelectionVM ModeSelectionVM;
|
||||
public readonly WebBrowserVM WebBrowserVM;
|
||||
public readonly UserInterventionHandlers UserInterventionHandlers;
|
||||
public readonly LoginManagerVM LoginManagerVM;
|
||||
|
||||
|
||||
public readonly List<ViewModel> NavigationTrail = new List<ViewModel>();
|
||||
|
||||
public Dispatcher ViewDispatcher { get; set; }
|
||||
|
||||
public ICommand CopyVersionCommand { get; }
|
||||
|
||||
public ICommand ShowLoginManagerVM { get; }
|
||||
public ICommand GoBackCommand { get; }
|
||||
public string VersionDisplay { get; }
|
||||
|
||||
public MainWindowVM(MainWindow mainWindow, MainSettings settings)
|
||||
@ -54,6 +63,7 @@ namespace Wabbajack
|
||||
ModeSelectionVM = new ModeSelectionVM(this);
|
||||
WebBrowserVM = new WebBrowserVM();
|
||||
UserInterventionHandlers = new UserInterventionHandlers(this);
|
||||
LoginManagerVM = new LoginManagerVM(this);
|
||||
|
||||
// Set up logging
|
||||
Utils.LogMessages
|
||||
@ -101,7 +111,6 @@ namespace Wabbajack
|
||||
Clipboard.SetText($"Wabbajack {VersionDisplay}\n{ThisAssembly.Git.Sha}");
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsStartingFromModlist(out string modlistPath)
|
||||
{
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
@ -115,6 +124,7 @@ namespace Wabbajack
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void OpenInstaller(string path)
|
||||
{
|
||||
if (path == null) return;
|
||||
@ -124,6 +134,19 @@ namespace Wabbajack
|
||||
installer.ModListLocation.TargetPath = path;
|
||||
}
|
||||
|
||||
public void NavigateBack()
|
||||
{
|
||||
var prev = NavigationTrail.Last();
|
||||
NavigationTrail.RemoveAt(NavigationTrail.Count - 1);
|
||||
ActivePane = prev;
|
||||
}
|
||||
|
||||
public void NavigateTo(ViewModel vm)
|
||||
{
|
||||
NavigationTrail.Add(ActivePane);
|
||||
ActivePane = vm;
|
||||
}
|
||||
|
||||
public void ShutdownApplication()
|
||||
{
|
||||
Dispose();
|
||||
|
@ -10,6 +10,7 @@ using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib.Downloaders;
|
||||
using Wabbajack.Lib.NexusApi;
|
||||
using Wabbajack.UserInterventions;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
@ -72,9 +73,14 @@ namespace Wabbajack
|
||||
break;
|
||||
case ConfirmationIntervention c:
|
||||
break;
|
||||
case ShowLoginManager c:
|
||||
MainWindow.NavigateTo(MainWindow.LoginManagerVM);
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException($"No handler for {msg}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,23 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Grid.Column="0"
|
||||
Width="35"
|
||||
Height="35"
|
||||
Click="ConfigureLogins_Click"
|
||||
Style="{StaticResource IconBareButtonStyle}">
|
||||
<icon:PackIconMaterial
|
||||
Width="25"
|
||||
Height="25"
|
||||
Kind="Cogs" />
|
||||
</Button>
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Width="35"
|
||||
Height="35"
|
||||
Click="GitHub_Click"
|
||||
Style="{StaticResource IconBareButtonStyle}">
|
||||
<icon:PackIconMaterial
|
||||
@ -25,7 +37,7 @@
|
||||
Kind="GithubCircle" />
|
||||
</Button>
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Grid.Column="2"
|
||||
Width="35"
|
||||
Height="35"
|
||||
Margin="4,0,0,0"
|
||||
@ -37,7 +49,7 @@
|
||||
Kind="Patreon" />
|
||||
</Button>
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Grid.Column="3"
|
||||
Width="35"
|
||||
Height="35"
|
||||
Click="Discord_Click"
|
||||
|
@ -1,18 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.UserInterventions;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
@ -40,5 +30,10 @@ namespace Wabbajack
|
||||
{
|
||||
Process.Start("https://www.patreon.com/user?u=11907933");
|
||||
}
|
||||
|
||||
private void ConfigureLogins_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Utils.Log(new ShowLoginManager());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
89
Wabbajack/Views/LoginManagerView.xaml
Normal file
89
Wabbajack/Views/LoginManagerView.xaml
Normal file
@ -0,0 +1,89 @@
|
||||
<UserControl x:Class="Wabbajack.LoginManagerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
xmlns:wabbajack="clr-namespace:Wabbajack"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<Color x:Key="TextBackgroundFill">#92000000</Color>
|
||||
<SolidColorBrush x:Key="TextBackgroundFillBrush" Color="{StaticResource TextBackgroundFill}" />
|
||||
<Color x:Key="TextBackgroundHoverFill">#DF000000</Color>
|
||||
<Style x:Key="BackgroundBlurStyle" TargetType="TextBlock">
|
||||
<Setter Property="Background" Value="{StaticResource TextBackgroundFillBrush}" />
|
||||
<Setter Property="Foreground" Value="Transparent" />
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(TextBlock.Background).(SolidColorBrush.Color)"
|
||||
To="{StaticResource TextBackgroundHoverFill}"
|
||||
Duration="0:0:0.06" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(TextBlock.Background).(SolidColorBrush.Color)"
|
||||
To="{StaticResource TextBackgroundFill}"
|
||||
Duration="0:0:0.06" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="47" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<wabbajack:TopProgressView
|
||||
Title="Login Manager"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
ShadowMargin="False" />
|
||||
<Button
|
||||
x:Name="BackButton"
|
||||
Grid.Row="0"
|
||||
Width="30"
|
||||
Height="30"
|
||||
Margin="7,5,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Command="{Binding BackCommand}"
|
||||
Style="{StaticResource IconCircleButtonStyle}"
|
||||
ToolTip="Back to main menu">
|
||||
<iconPacks:PackIconMaterial Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" Kind="ArrowLeft" />
|
||||
</Button>
|
||||
<!-- Do it this way so we can access the browser directly from the VM -->
|
||||
<ListView Grid.Row="1" ItemsSource="{Binding Downloaders}">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Height="30">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="48"></ColumnDefinition>
|
||||
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="100"></ColumnDefinition>
|
||||
<ColumnDefinition Width="100"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Source="{Binding IconUrl, Mode=OneTime}"></Image>
|
||||
<Label Grid.Column="1" Width="400" Content="{Binding SiteName, Mode=OneTime}" FontSize="14"></Label>
|
||||
<Label Grid.Column="2" Width="400" Content="{Binding MetaInfo, Mode=OneWay}" FontSize="14"></Label>
|
||||
<Button Grid.Column="3" Content="Login" Command="{Binding TriggerLogin}"></Button>
|
||||
<Button Grid.Column="4" Content="Logout" Command="{Binding ClearLogin}"></Button>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</UserControl>
|
28
Wabbajack/Views/LoginManagerView.xaml.cs
Normal file
28
Wabbajack/Views/LoginManagerView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for LoginManager.xaml
|
||||
/// </summary>
|
||||
public partial class LoginManagerView : UserControl
|
||||
{
|
||||
public LoginManagerView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -27,6 +27,9 @@
|
||||
<DataTemplate DataType="{x:Type local:InstallerVM}">
|
||||
<local:InstallationView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:LoginManagerVM}">
|
||||
<local:LoginManagerView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:ModeSelectionVM}">
|
||||
<local:ModeSelectionView />
|
||||
</DataTemplate>
|
||||
|
@ -176,7 +176,9 @@
|
||||
<Compile Include="UnderMaintenanceOverlay.xaml.cs">
|
||||
<DependentUpon>UnderMaintenanceOverlay.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserInterventions\ShowLoginManager.cs" />
|
||||
<Compile Include="View Models\CPUDisplayVM.cs" />
|
||||
<Compile Include="View Models\LoginManagerVM.cs" />
|
||||
<Compile Include="Views\Compilers\CompilationCompleteView.xaml.cs">
|
||||
<DependentUpon>CompilationCompleteView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -212,6 +214,9 @@
|
||||
<Compile Include="Views\LinksView.xaml.cs">
|
||||
<DependentUpon>LinksView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LoginManagerView.xaml.cs">
|
||||
<DependentUpon>LoginManagerView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ModeSelectionView.xaml.cs">
|
||||
<DependentUpon>ModeSelectionView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -313,6 +318,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LoginManagerView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ModeSelectionView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
Loading…
Reference in New Issue
Block a user