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:
parent
feb3e781fc
commit
98cb1ea28e
@ -2,16 +2,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
public interface INeedsLogin
|
||||
{
|
||||
ICommand TriggerLogin { get; }
|
||||
ICommand ClearLogin { get; }
|
||||
ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
||||
ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||
IObservable<bool> IsLoggedIn { get; }
|
||||
string SiteName { get; }
|
||||
IObservable<string> MetaInfo { get; }
|
||||
|
@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
@ -27,8 +28,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
#region INeedsDownload
|
||||
|
||||
public ICommand TriggerLogin { get; }
|
||||
public ICommand ClearLogin { get; }
|
||||
public ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
||||
public ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||
public IObservable<bool> IsLoggedIn => Utils.HaveEncryptedJsonObservable("loverslabcookies");
|
||||
public string SiteName => "Lovers Lab";
|
||||
public IObservable<string> MetaInfo => Observable.Return("");
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -30,8 +31,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
|
||||
public Uri IconUri => new Uri("https://www.nexusmods.com/favicon.ico");
|
||||
|
||||
public ICommand TriggerLogin { get; }
|
||||
public ICommand ClearLogin { get; }
|
||||
public ReactiveCommand<Unit, Unit> TriggerLogin { get; }
|
||||
public ReactiveCommand<Unit, Unit> ClearLogin { get; }
|
||||
|
||||
public NexusDownloader()
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -15,14 +16,14 @@ namespace Wabbajack
|
||||
public interface IBackNavigatingVM : IReactiveObject
|
||||
{
|
||||
ViewModel NavigateBackTarget { get; set; }
|
||||
IReactiveCommand BackCommand { get; }
|
||||
ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||
}
|
||||
|
||||
public class BackNavigatingVM : ViewModel, IBackNavigatingVM
|
||||
{
|
||||
[Reactive]
|
||||
public ViewModel NavigateBackTarget { get; set; }
|
||||
public IReactiveCommand BackCommand { get; protected set; }
|
||||
public ReactiveCommand<Unit, Unit> BackCommand { get; protected set; }
|
||||
|
||||
public BackNavigatingVM(MainWindowVM mainWindowVM)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ namespace Wabbajack
|
||||
|
||||
public ObservableCollectionExtended<IStatusMessage> Log => MWVM.Log;
|
||||
|
||||
public IReactiveCommand BackCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||
public IReactiveCommand GoToModlistCommand { get; }
|
||||
public IReactiveCommand CloseWhenCompleteCommand { get; }
|
||||
public IReactiveCommand BeginCommand { get; }
|
||||
|
@ -90,7 +90,7 @@ namespace Wabbajack
|
||||
public IReactiveCommand ShowReportCommand { get; }
|
||||
public IReactiveCommand OpenReadmeCommand { get; }
|
||||
public IReactiveCommand VisitWebsiteCommand { get; }
|
||||
public IReactiveCommand BackCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||
public IReactiveCommand CloseWhenCompleteCommand { get; }
|
||||
public IReactiveCommand GoToInstallCommand { get; }
|
||||
public IReactiveCommand BeginCommand { get; }
|
||||
|
@ -22,20 +22,21 @@ namespace Wabbajack
|
||||
.Select(x => new LoginTargetVM(x))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public class LoginTargetVM : ViewModel
|
||||
public class LoginTargetVM : ViewModel
|
||||
{
|
||||
private readonly ObservableAsPropertyHelper<string> _MetaInfo;
|
||||
public string MetaInfo => _MetaInfo.Value;
|
||||
|
||||
public INeedsLogin Login { get; }
|
||||
|
||||
public LoginTargetVM(INeedsLogin login)
|
||||
{
|
||||
private readonly ObservableAsPropertyHelper<string> _MetaInfo;
|
||||
public string MetaInfo => _MetaInfo.Value;
|
||||
|
||||
public INeedsLogin Login { get; }
|
||||
|
||||
public LoginTargetVM(INeedsLogin login)
|
||||
{
|
||||
Login = login;
|
||||
_MetaInfo = login.MetaInfo
|
||||
.ToProperty(this, nameof(MetaInfo));
|
||||
}
|
||||
Login = login;
|
||||
_MetaInfo = login.MetaInfo
|
||||
.ObserveOnGuiThread()
|
||||
.ToProperty(this, nameof(MetaInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CefSharp;
|
||||
@ -25,7 +26,7 @@ namespace Wabbajack
|
||||
public ViewModel NavigateBackTarget { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public IReactiveCommand BackCommand { get; set; }
|
||||
public ReactiveCommand<Unit, Unit> BackCommand { get; set; }
|
||||
|
||||
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="*" />
|
||||
</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
|
||||
Margin="5,0"
|
||||
FontFamily="Lucida Sans"
|
||||
@ -34,33 +45,7 @@
|
||||
Background="{StaticResource BackgroundBrush}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Height="30" Margin="5">
|
||||
<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>
|
||||
<local:LoginItemView ViewModel="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
@ -27,7 +27,7 @@ namespace Wabbajack
|
||||
InitializeComponent();
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
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;
|
||||
@ -27,11 +28,11 @@ namespace Wabbajack
|
||||
InitializeComponent();
|
||||
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);
|
||||
this.OneWayBind(this.ViewModel, x => x.Login, x => x.LoginView.ViewModel)
|
||||
this.OneWayBindStrict(this.ViewModel, x => x.Login, x => x.LoginView.ViewModel)
|
||||
.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);
|
||||
});
|
||||
}
|
||||
|
@ -176,6 +176,9 @@
|
||||
<Compile Include="Converters\CommandConverter.cs" />
|
||||
<Compile Include="Converters\ConverterRegistration.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">
|
||||
<DependentUpon>LoginSettingsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -293,6 +296,10 @@
|
||||
<Compile Include="Views\WebBrowserView.xaml.cs">
|
||||
<DependentUpon>WebBrowserView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Views\Settings\LoginItemView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Settings\LoginSettingsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
Loading…
Reference in New Issue
Block a user