mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
More settings page styling work
This commit is contained in:
@ -2,16 +2,18 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reactive;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
namespace Wabbajack.Lib.Downloaders
|
namespace Wabbajack.Lib.Downloaders
|
||||||
{
|
{
|
||||||
public interface INeedsLogin
|
public interface INeedsLogin
|
||||||
{
|
{
|
||||||
ICommand TriggerLogin { get; }
|
ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
||||||
ICommand ClearLogin { get; }
|
ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||||
IObservable<bool> IsLoggedIn { get; }
|
IObservable<bool> IsLoggedIn { get; }
|
||||||
string SiteName { get; }
|
string SiteName { get; }
|
||||||
IObservable<string> MetaInfo { get; }
|
IObservable<string> MetaInfo { get; }
|
||||||
|
@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Reactive;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -27,8 +28,8 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
|
|
||||||
#region INeedsDownload
|
#region INeedsDownload
|
||||||
|
|
||||||
public ICommand TriggerLogin { get; }
|
public ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
||||||
public ICommand ClearLogin { get; }
|
public ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||||
public IObservable<bool> IsLoggedIn => Utils.HaveEncryptedJsonObservable("loverslabcookies");
|
public IObservable<bool> IsLoggedIn => Utils.HaveEncryptedJsonObservable("loverslabcookies");
|
||||||
public string SiteName => "Lovers Lab";
|
public string SiteName => "Lovers Lab";
|
||||||
public IObservable<string> MetaInfo => Observable.Return("");
|
public IObservable<string> MetaInfo => Observable.Return("");
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reactive;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -30,8 +31,8 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
|
|
||||||
public Uri IconUri => new Uri("https://www.nexusmods.com/favicon.ico");
|
public Uri IconUri => new Uri("https://www.nexusmods.com/favicon.ico");
|
||||||
|
|
||||||
public ICommand TriggerLogin { get; }
|
public ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
||||||
public ICommand ClearLogin { get; }
|
public ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||||
|
|
||||||
public NexusDownloader()
|
public NexusDownloader()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reactive;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -15,14 +16,14 @@ namespace Wabbajack
|
|||||||
public interface IBackNavigatingVM : IReactiveObject
|
public interface IBackNavigatingVM : IReactiveObject
|
||||||
{
|
{
|
||||||
ViewModel NavigateBackTarget { get; set; }
|
ViewModel NavigateBackTarget { get; set; }
|
||||||
IReactiveCommand BackCommand { get; }
|
ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BackNavigatingVM : ViewModel, IBackNavigatingVM
|
public class BackNavigatingVM : ViewModel, IBackNavigatingVM
|
||||||
{
|
{
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ViewModel NavigateBackTarget { get; set; }
|
public ViewModel NavigateBackTarget { get; set; }
|
||||||
public IReactiveCommand BackCommand { get; protected set; }
|
public ReactiveCommand<Unit, Unit> BackCommand { get; protected set; }
|
||||||
|
|
||||||
public BackNavigatingVM(MainWindowVM mainWindowVM)
|
public BackNavigatingVM(MainWindowVM mainWindowVM)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
public ObservableCollectionExtended<IStatusMessage> Log => MWVM.Log;
|
public ObservableCollectionExtended<IStatusMessage> Log => MWVM.Log;
|
||||||
|
|
||||||
public IReactiveCommand BackCommand { get; }
|
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||||
public IReactiveCommand GoToModlistCommand { get; }
|
public IReactiveCommand GoToModlistCommand { get; }
|
||||||
public IReactiveCommand CloseWhenCompleteCommand { get; }
|
public IReactiveCommand CloseWhenCompleteCommand { get; }
|
||||||
public IReactiveCommand BeginCommand { get; }
|
public IReactiveCommand BeginCommand { get; }
|
||||||
|
@ -90,7 +90,7 @@ namespace Wabbajack
|
|||||||
public IReactiveCommand ShowReportCommand { get; }
|
public IReactiveCommand ShowReportCommand { get; }
|
||||||
public IReactiveCommand OpenReadmeCommand { get; }
|
public IReactiveCommand OpenReadmeCommand { get; }
|
||||||
public IReactiveCommand VisitWebsiteCommand { get; }
|
public IReactiveCommand VisitWebsiteCommand { get; }
|
||||||
public IReactiveCommand BackCommand { get; }
|
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||||
public IReactiveCommand CloseWhenCompleteCommand { get; }
|
public IReactiveCommand CloseWhenCompleteCommand { get; }
|
||||||
public IReactiveCommand GoToInstallCommand { get; }
|
public IReactiveCommand GoToInstallCommand { get; }
|
||||||
public IReactiveCommand BeginCommand { get; }
|
public IReactiveCommand BeginCommand { get; }
|
||||||
|
@ -22,6 +22,7 @@ namespace Wabbajack
|
|||||||
.Select(x => new LoginTargetVM(x))
|
.Select(x => new LoginTargetVM(x))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class LoginTargetVM : ViewModel
|
public class LoginTargetVM : ViewModel
|
||||||
{
|
{
|
||||||
@ -34,8 +35,8 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
Login = login;
|
Login = login;
|
||||||
_MetaInfo = login.MetaInfo
|
_MetaInfo = login.MetaInfo
|
||||||
|
.ObserveOnGuiThread()
|
||||||
.ToProperty(this, nameof(MetaInfo));
|
.ToProperty(this, nameof(MetaInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reactive;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
@ -25,7 +26,7 @@ namespace Wabbajack
|
|||||||
public ViewModel NavigateBackTarget { get; set; }
|
public ViewModel NavigateBackTarget { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public IReactiveCommand BackCommand { get; set; }
|
public ReactiveCommand<Unit, Unit> BackCommand { get; set; }
|
||||||
|
|
||||||
private WebBrowserVM(string url = "http://www.wabbajack.org")
|
private WebBrowserVM(string url = "http://www.wabbajack.org")
|
||||||
{
|
{
|
||||||
|
39
Wabbajack/Views/Settings/LoginItemView.xaml
Normal file
39
Wabbajack/Views/Settings/LoginItemView.xaml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<rxui:ReactiveUserControl
|
||||||
|
x:Class="Wabbajack.LoginItemView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:Wabbajack"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:rxui="http://reactiveui.net"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
x:TypeArguments="local:LoginTargetVM"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid Height="30" Margin="5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" MinWidth="150" />
|
||||||
|
<ColumnDefinition Width="100" />
|
||||||
|
<ColumnDefinition Width="100" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock
|
||||||
|
x:Name="SiteNameText"
|
||||||
|
Grid.Column="0"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<Button
|
||||||
|
x:Name="LoginButton"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="5"
|
||||||
|
Content="Login" />
|
||||||
|
<Button
|
||||||
|
x:Name="LogoutButton"
|
||||||
|
Grid.Column="2"
|
||||||
|
Margin="5"
|
||||||
|
Content="Logout" />
|
||||||
|
<TextBlock
|
||||||
|
x:Name="MetaText"
|
||||||
|
Grid.Column="3"
|
||||||
|
FontSize="14" />
|
||||||
|
</Grid>
|
||||||
|
</rxui:ReactiveUserControl>
|
56
Wabbajack/Views/Settings/LoginItemView.xaml.cs
Normal file
56
Wabbajack/Views/Settings/LoginItemView.xaml.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reactive.Disposables;
|
||||||
|
using System.Reactive.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;
|
||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
|
namespace Wabbajack
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for LoginItemView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class LoginItemView : ReactiveUserControl<LoginTargetVM>
|
||||||
|
{
|
||||||
|
public LoginItemView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.WhenActivated(disposable =>
|
||||||
|
{
|
||||||
|
this.OneWayBindStrict(this.ViewModel, x => x.Login.SiteName, x => x.SiteNameText.Text)
|
||||||
|
.DisposeWith(disposable);
|
||||||
|
this.OneWayBindStrict(this.ViewModel, x => x.Login.TriggerLogin, x => x.LoginButton.Command)
|
||||||
|
.DisposeWith(disposable);
|
||||||
|
this.OneWayBindStrict(this.ViewModel, x => x.Login.ClearLogin, x => x.LogoutButton.Command)
|
||||||
|
.DisposeWith(disposable);
|
||||||
|
this.OneWayBindStrict(this.ViewModel, x => x.MetaInfo, x => x.MetaText.Text)
|
||||||
|
.DisposeWith(disposable);
|
||||||
|
|
||||||
|
// Modify label state
|
||||||
|
this.WhenAny(x => x.ViewModel.Login.TriggerLogin.CanExecute)
|
||||||
|
.Switch()
|
||||||
|
.Subscribe(x =>
|
||||||
|
{
|
||||||
|
this.LoginButton.Content = x ? "Login" : "Logged In";
|
||||||
|
});
|
||||||
|
this.WhenAny(x => x.ViewModel.Login.ClearLogin.CanExecute)
|
||||||
|
.Switch()
|
||||||
|
.Subscribe(x =>
|
||||||
|
{
|
||||||
|
this.LogoutButton.Content = x ? "Logout" : "Logged Out";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,17 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.Resources>
|
||||||
|
<Style BasedOn="{StaticResource MainButtonStyle}" TargetType="Button">
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
|
||||||
|
<Setter Property="Background" Value="{StaticResource SecondaryBackgroundBrush}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource DarkSecondaryBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Grid.Resources>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="5,0"
|
Margin="5,0"
|
||||||
FontFamily="Lucida Sans"
|
FontFamily="Lucida Sans"
|
||||||
@ -34,33 +45,7 @@
|
|||||||
Background="{StaticResource BackgroundBrush}">
|
Background="{StaticResource BackgroundBrush}">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Grid Height="30" Margin="5">
|
<local:LoginItemView ViewModel="{Binding}" />
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto" MinWidth="150" />
|
|
||||||
<ColumnDefinition Width="100" />
|
|
||||||
<ColumnDefinition Width="100" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<!--<Image Grid.Column="0" Source="{Binding Login.IconUrl, Mode=OneTime}" />-->
|
|
||||||
<TextBlock
|
|
||||||
Grid.Column="0"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Text="{Binding Login.SiteName, Mode=OneWay}" />
|
|
||||||
<Button
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="5"
|
|
||||||
Command="{Binding Login.TriggerLogin}"
|
|
||||||
Content="Login" />
|
|
||||||
<Button
|
|
||||||
Grid.Column="2"
|
|
||||||
Margin="5"
|
|
||||||
Command="{Binding Login.ClearLogin}"
|
|
||||||
Content="Logout" />
|
|
||||||
<Label
|
|
||||||
Grid.Column="3"
|
|
||||||
Content="{Binding MetaInfo, Mode=OneWay}"
|
|
||||||
FontSize="14" />
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
@ -27,7 +27,7 @@ namespace Wabbajack
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.WhenActivated(disposable =>
|
this.WhenActivated(disposable =>
|
||||||
{
|
{
|
||||||
this.OneWayBind(this.ViewModel, x => x.Downloaders, x => x.DownloadersList.ItemsSource)
|
this.OneWayBindStrict(this.ViewModel, x => x.Downloaders, x => x.DownloadersList.ItemsSource)
|
||||||
.DisposeWith(disposable);
|
.DisposeWith(disposable);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
|
using System.Reactive.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@ -27,11 +28,11 @@ namespace Wabbajack
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.WhenActivated(disposable =>
|
this.WhenActivated(disposable =>
|
||||||
{
|
{
|
||||||
this.OneWayBind(this.ViewModel, x => x.BackCommand, x => x.BackButton.Command)
|
this.OneWayBindStrict(this.ViewModel, x => x.BackCommand, x => x.BackButton.Command)
|
||||||
.DisposeWith(disposable);
|
.DisposeWith(disposable);
|
||||||
this.OneWayBind(this.ViewModel, x => x.Login, x => x.LoginView.ViewModel)
|
this.OneWayBindStrict(this.ViewModel, x => x.Login, x => x.LoginView.ViewModel)
|
||||||
.DisposeWith(disposable);
|
.DisposeWith(disposable);
|
||||||
this.OneWayBind(this.ViewModel, x => x.Performance, x => x.PerformanceView.ViewModel)
|
this.OneWayBindStrict(this.ViewModel, x => x.Performance, x => x.PerformanceView.ViewModel)
|
||||||
.DisposeWith(disposable);
|
.DisposeWith(disposable);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,9 @@
|
|||||||
<Compile Include="Converters\CommandConverter.cs" />
|
<Compile Include="Converters\CommandConverter.cs" />
|
||||||
<Compile Include="Converters\ConverterRegistration.cs" />
|
<Compile Include="Converters\ConverterRegistration.cs" />
|
||||||
<Compile Include="Extensions\IViewForExt.cs" />
|
<Compile Include="Extensions\IViewForExt.cs" />
|
||||||
|
<Compile Include="Views\Settings\LoginItemView.xaml.cs">
|
||||||
|
<DependentUpon>LoginItemView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\Settings\LoginSettingsView.xaml.cs">
|
<Compile Include="Views\Settings\LoginSettingsView.xaml.cs">
|
||||||
<DependentUpon>LoginSettingsView.xaml</DependentUpon>
|
<DependentUpon>LoginSettingsView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -293,6 +296,10 @@
|
|||||||
<Compile Include="Views\WebBrowserView.xaml.cs">
|
<Compile Include="Views\WebBrowserView.xaml.cs">
|
||||||
<DependentUpon>WebBrowserView.xaml</DependentUpon>
|
<DependentUpon>WebBrowserView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Page Include="Views\Settings\LoginItemView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\Settings\LoginSettingsView.xaml">
|
<Page Include="Views\Settings\LoginSettingsView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
Reference in New Issue
Block a user