More styling

This commit is contained in:
Timothy Baldridge 2021-11-04 07:01:48 -06:00
parent fd304d5b52
commit 47e01dcc34
19 changed files with 96 additions and 47 deletions

View File

@ -37,7 +37,31 @@
<Style Selector="Border.Settings">
<Setter Property="BorderThickness" Value="2"></Setter>
<Setter Property="BorderBrush" Value="DarkGray"></Setter>
<Setter Property="CornerRadius" Value="4"></Setter>
</Style>
<Style Selector="Border.Settings Grid">
<Setter Property="Margin" Value="4"></Setter>
</Style>
<Style Selector="Grid.LogView ItemsControl">
<Setter Property="Margin" Value="4"></Setter>
</Style>
<Style Selector="Grid.LogView > TextBlock.Title">
<Setter Property="FontWeight" Value="Bold"></Setter>
<Setter Property="FontSize" Value="18"></Setter>
<Setter Property="Margin" Value="4"/>
</Style>
<Style Selector="Grid.LogView > Border">
<Setter Property="Margin" Value="4"/>
<Setter Property="BorderThickness" Value="2"></Setter>
<Setter Property="BorderBrush" Value="DarkGray"></Setter>
<Setter Property="CornerRadius" Value="4"></Setter>
</Style>
</Styles>

View File

@ -6,23 +6,25 @@
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Wabbajack.App.Controls.LogView">
<Grid RowDefinitions="Auto, *, Auto">
<TextBlock Grid.Row="0">Current Log Contents</TextBlock>
<ScrollViewer Grid.Row="1" ScrollChanged="ScrollViewer_OnScrollChanged" x:Name="ScrollViewer"
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<ItemsControl x:Name="Messages">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:LogViewItem />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid RowDefinitions="Auto, *, Auto" Classes="LogView">
<TextBlock Grid.Row="0" Classes="Title">Current Log Contents</TextBlock>
<Border Grid.Row="1">
<ScrollViewer ScrollChanged="ScrollViewer_OnScrollChanged" x:Name="ScrollViewer"
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible">
<ItemsControl x:Name="Messages">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:LogViewItem />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button x:Name="CopyLog">
<avalonia:MaterialIcon Kind="ContentCopy" />
@ -32,4 +34,5 @@
</Button>
</StackPanel>
</Grid>
</UserControl>

View File

@ -5,4 +5,5 @@ namespace Wabbajack.App.Interfaces;
public interface IScreenView
{
public Type ViewModelType { get; }
public string HumanName { get; }
}

View File

@ -6,7 +6,7 @@ namespace Wabbajack.App.Screens;
public partial class BrowseView : ScreenBase<BrowseViewModel>
{
public BrowseView()
public BrowseView() : base("Web Browser")
{
InitializeComponent();
this.WhenActivated(disposables =>

View File

@ -6,7 +6,7 @@ namespace Wabbajack.App.Screens;
public partial class CompilationView : ScreenBase<CompilationViewModel>
{
public CompilationView()
public CompilationView() : base("Compiling")
{
InitializeComponent();

View File

@ -15,7 +15,7 @@ namespace Wabbajack.App.Screens;
public partial class CompilerConfigurationView : ScreenBase<CompilerConfigurationViewModel>
{
public CompilerConfigurationView()
public CompilerConfigurationView() : base("Compiler Configuration")
{
InitializeComponent();
AddAlwaysEnabled.Command = ReactiveCommand.Create(() => AddAlwaysEnabled_Command().FireAndForget());

View File

@ -6,7 +6,7 @@ namespace Wabbajack.App.Screens;
public partial class ErrorPageView : ScreenBase<ErrorPageViewModel>
{
public ErrorPageView()
public ErrorPageView() : base("Error")
{
InitializeComponent();
this.WhenActivated(disposables =>

View File

@ -6,7 +6,7 @@ namespace Wabbajack.App.Screens;
public partial class LauncherView : ScreenBase<LauncherViewModel>
{
public LauncherView()
public LauncherView() : base("Launch Modlist")
{
InitializeComponent();
this.WhenActivated(disposables =>

View File

@ -4,7 +4,7 @@ namespace Wabbajack.App.Screens;
public partial class LogScreenView : ScreenBase<LogScreenViewModel>
{
public LogScreenView()
public LogScreenView() : base("Application Log")
{
InitializeComponent();
}

View File

@ -6,7 +6,7 @@ namespace Wabbajack.App.Screens;
public partial class PlaySelectView : ScreenBase<PlaySelectViewModel>
{
public PlaySelectView()
public PlaySelectView() : base("Modlist Selection")
{
InitializeComponent();
this.WhenActivated(disposables =>

View File

@ -6,7 +6,7 @@ namespace Wabbajack.App.Screens;
public partial class SettingsView : ScreenBase<SettingsViewModel>
{
public SettingsView()
public SettingsView() : base("Settings")
{
InitializeComponent();
this.WhenActivated(disposables =>

View File

@ -10,7 +10,7 @@ namespace Wabbajack.App.Views;
public partial class StandardInstallationView : ScreenBase<StandardInstallationViewModel>
{
public StandardInstallationView()
public StandardInstallationView() : base("Installing")
{
InitializeComponent();

View File

@ -68,6 +68,13 @@ public class MainWindowViewModel : ReactiveValidationObject, IActivatableViewMod
LogViewButton = ReactiveCommand.Create(() => { Receive(new NavigateTo(typeof(LogScreenViewModel))); })
.DisposeWith(disposables);
this.WhenAnyValue(vm => vm.CurrentScreen)
.Where(view => view != default)
.Select(view => ((IScreenView) view).HumanName)
.Select(txt => txt == "" ? "Wabbajack" : $"Wabbajack - {txt}")
.BindTo(this, vm => vm.TitleText)
.DisposeWith(disposables);
});
CurrentScreen = (Control) _screens.First(s => s.ViewModelType == typeof(ModeSelectionViewModel));
@ -85,6 +92,8 @@ public class MainWindowViewModel : ReactiveValidationObject, IActivatableViewMod
[Reactive] public ReactiveCommand<Unit, Unit> LogViewButton { get; set; }
[Reactive] public string ResourceStatus { get; set; }
[Reactive] public string TitleText { get; set; }
public ViewModelActivator Activator { get; }

View File

@ -8,7 +8,7 @@ namespace Wabbajack.App.Views;
public partial class GuidedWebView : ScreenBase<GuidedWebViewModel>
{
public GuidedWebView() : base(false)
public GuidedWebView() : base("Web View", false)
{
InitializeComponent();

View File

@ -9,9 +9,9 @@ using Wabbajack.App.ViewModels;
namespace Wabbajack.App.Views;
public partial class InstallConfigurationView : ReactiveUserControl<InstallConfigurationViewModel>, IScreenView
public partial class InstallConfigurationView : ScreenBase<InstallConfigurationViewModel>, IScreenView
{
public InstallConfigurationView()
public InstallConfigurationView() : base("Install Configuration")
{
InitializeComponent();
DataContext = App.Services.GetService<InstallConfigurationViewModel>()!;
@ -45,6 +45,9 @@ public partial class InstallConfigurationView : ReactiveUserControl<InstallConfi
this.WhenAnyValue(view => view.InstallPath.SelectedPath)
.BindTo(ViewModel, vm => vm.Install)
.DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.BeginCommand, view => view.BeginInstall.Button)
.DisposeWith(disposables);
});
}

View File

@ -32,25 +32,26 @@
</Design.DataContext>
<Grid RowDefinitions="40, *">
<Grid ColumnDefinitions="40, *, 40, 40, 40, 40">
<Grid ColumnDefinitions="40, Auto, *, 40, 40, 40, 40">
<Button Grid.Column="0" x:Name="BackButton" x:FieldModifier="public">
<i:MaterialIcon Kind="ArrowBack" />
</Button>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="TitleText"></TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" x:Name="ResourceStatus" />
<TextBlock Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" x:Name="ResourceStatus" />
<Button Grid.Column="2" x:Name="LogButton">
<Button Grid.Column="3" x:Name="LogButton">
<i:MaterialIcon Kind="ViewList" />
</Button>
<Button Grid.Column="3" x:Name="SettingsButton">
<Button Grid.Column="4" x:Name="SettingsButton">
<i:MaterialIcon Kind="Gear" />
</Button>
<Button Grid.Column="4" x:Name="MinimizeButton">
<Button Grid.Column="5" x:Name="MinimizeButton">
<i:MaterialIcon Kind="WindowMinimize" />
</Button>
<Button Grid.Column="5" x:Name="CloseButton" x:FieldModifier="public">
<Button Grid.Column="6" x:Name="CloseButton" x:FieldModifier="public">
<i:MaterialIcon Kind="Close" />
</Button>

View File

@ -16,27 +16,30 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
InitializeComponent();
DataContext = App.Services.GetService<MainWindowViewModel>()!;
this.WhenActivated(dispose =>
this.WhenActivated(disposables =>
{
CloseButton.Command = ReactiveCommand.Create(() => Environment.Exit(0))
.DisposeWith(dispose);
.DisposeWith(disposables);
MinimizeButton.Command = ReactiveCommand.Create(() => WindowState = WindowState.Minimized)
.DisposeWith(dispose);
.DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.BackButton, view => view.BackButton)
.DisposeWith(dispose);
.DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SettingsButton, view => view.SettingsButton)
.DisposeWith(dispose);
.DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.LogViewButton, view => view.LogButton)
.DisposeWith(dispose);
.DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CurrentScreen, view => view.Contents.Content)
.DisposeWith(dispose);
this.OneWayBind(ViewModel, vm => vm.CurrentScreen, view => view.Contents.Content)
.DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.ResourceStatus, view => view.ResourceStatus.Text)
.DisposeWith(dispose);
this.OneWayBind(ViewModel, vm => vm.ResourceStatus, view => view.ResourceStatus.Text)
.DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.TitleText, view => view.TitleText.Text)
.DisposeWith(disposables);
});

View File

@ -9,7 +9,7 @@ namespace Wabbajack.App.Views;
public partial class ModeSelectionView : ScreenBase<ModeSelectionViewModel>
{
public ModeSelectionView(IServiceProvider provider)
public ModeSelectionView(IServiceProvider provider) : base("")
{
InitializeComponent();
this.WhenActivated(disposables =>

View File

@ -1,4 +1,5 @@
using System;
using ReactiveUI.Fody.Helpers;
using Wabbajack.App.Interfaces;
using Wabbajack.App.ViewModels;
@ -7,9 +8,13 @@ namespace Wabbajack.App.Views;
public abstract class ScreenBase<T> : ViewBase<T>, IScreenView
where T : ViewModelBase
{
protected ScreenBase(bool createViewModel = true) : base(createViewModel)
protected ScreenBase(string humanName, bool createViewModel = true) : base(createViewModel)
{
HumanName = humanName;
}
public Type ViewModelType => typeof(T);
[Reactive]
public string HumanName { get; set; }
}