mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
First attempts at creating navigation bar, buttons not binding properly yet
This commit is contained in:
parent
85ed8cd74d
commit
c7364d6358
@ -160,6 +160,7 @@ namespace Wabbajack
|
||||
|
||||
services.AddTransient<MainWindow>();
|
||||
services.AddTransient<MainWindowVM>();
|
||||
services.AddTransient<NavigationVM>();
|
||||
services.AddTransient<BrowserWindow>();
|
||||
services.AddSingleton<SystemParametersConstructor>();
|
||||
services.AddSingleton<LauncherUpdater>();
|
||||
|
@ -1202,9 +1202,9 @@
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Padding" Value="1" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Padding" Value="2" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
|
@ -47,6 +47,7 @@ namespace Wabbajack
|
||||
public readonly ModListGalleryVM Gallery;
|
||||
public readonly ModeSelectionVM ModeSelectionVM;
|
||||
public readonly WebBrowserVM WebBrowserVM;
|
||||
public readonly NavigationVM NavigationVM;
|
||||
public readonly Lazy<ModListContentsVM> ModListContentsVM;
|
||||
public readonly UserInterventionHandlers UserInterventionHandlers;
|
||||
private readonly Client _wjClient;
|
||||
@ -76,7 +77,7 @@ namespace Wabbajack
|
||||
|
||||
public MainWindowVM(ILogger<MainWindowVM> logger, Client wjClient,
|
||||
IServiceProvider serviceProvider, ModeSelectionVM modeSelectionVM, ModListGalleryVM modListGalleryVM, ResourceMonitor resourceMonitor,
|
||||
InstallerVM installer, CompilerVM compilerVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM)
|
||||
InstallerVM installer, CompilerVM compilerVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM, NavigationVM navigationVM)
|
||||
{
|
||||
_logger = logger;
|
||||
_wjClient = wjClient;
|
||||
@ -89,6 +90,7 @@ namespace Wabbajack
|
||||
Gallery = modListGalleryVM;
|
||||
ModeSelectionVM = modeSelectionVM;
|
||||
WebBrowserVM = webBrowserVM;
|
||||
NavigationVM = navigationVM;
|
||||
ModListContentsVM = new Lazy<ModListContentsVM>(() => new ModListContentsVM(serviceProvider.GetRequiredService<ILogger<ModListContentsVM>>(), this));
|
||||
UserInterventionHandlers = new UserInterventionHandlers(serviceProvider.GetRequiredService<ILogger<UserInterventionHandlers>>(), this);
|
||||
|
||||
|
42
Wabbajack.App.Wpf/View Models/NavigationVM.cs
Normal file
42
Wabbajack.App.Wpf/View Models/NavigationVM.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows.Input;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack;
|
||||
using Wabbajack.Messages;
|
||||
using Wabbajack.Paths.IO;
|
||||
using Wabbajack.Networking.WabbajackClientApi;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.DTOs;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
public class NavigationVM : ViewModel
|
||||
{
|
||||
private readonly ILogger<NavigationVM> _logger;
|
||||
|
||||
public NavigationVM(ILogger<NavigationVM> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
InstallCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
LoadLastLoadedModlist.Send();
|
||||
NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Installer);
|
||||
});
|
||||
CompileCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Compiler));
|
||||
BrowseCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModListGallery));
|
||||
}
|
||||
public ICommand BrowseCommand { get; set; }
|
||||
public ICommand InstallCommand { get; set; }
|
||||
public ICommand CompileCommand { get; set; }
|
||||
public ReactiveCommand<Unit, Unit> UpdateCommand { get; }
|
||||
}
|
||||
}
|
@ -63,7 +63,8 @@
|
||||
<ColumnDefinition Width="128" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Column="1" Margin="0" Background="{StaticResource ComplementaryBackgroundBrush}" x:Name="MainContent" Padding="28" CornerRadius="8">
|
||||
<local:NavigationView Grid.Column="0" />
|
||||
<Border Grid.Column="1" Margin="0" Background="{StaticResource ComplementaryBackgroundBrush}" x:Name="MainContent" Padding="28" CornerRadius="8">
|
||||
<ContentPresenter Content="{Binding ActivePane}" VerticalAlignment="Stretch">
|
||||
<ContentPresenter.Resources>
|
||||
<DataTemplate DataType="{x:Type local:CompilerVM}">
|
||||
|
@ -29,17 +29,6 @@ namespace Wabbajack
|
||||
InitializeComponent();
|
||||
this.WhenActivated(dispose =>
|
||||
{
|
||||
/*
|
||||
this.WhenAny(x => x.ViewModel.BrowseCommand)
|
||||
.BindToStrict(this, x => x.BrowseButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.InstallCommand)
|
||||
.BindToStrict(this, x => x.InstallButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.CompileCommand)
|
||||
.BindToStrict(this, x => x.CompileButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
*/
|
||||
this.WhenAnyValue(x => x.ViewModel.Modlists)
|
||||
.Select(x => x?.Length.ToString() ?? "0")
|
||||
.BindToStrict(this, x => x.ModlistAmountTextBlock.Text)
|
||||
|
50
Wabbajack.App.Wpf/Views/NavigationView.xaml
Normal file
50
Wabbajack.App.Wpf/Views/NavigationView.xaml
Normal file
@ -0,0 +1,50 @@
|
||||
<rxui:ReactiveUserControl
|
||||
x:Class="Wabbajack.NavigationView"
|
||||
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:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
xmlns:rxui="http://reactiveui.net"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ic="clr-namespace:FluentIcons.WPF;assembly=FluentIcons.WPF"
|
||||
x:TypeArguments="local:NavigationVM"
|
||||
mc:Ignorable="d">
|
||||
<Border BorderThickness="0" Padding="10, 0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="108"/>
|
||||
<RowDefinition Height="10"/>
|
||||
<RowDefinition Height="108"/>
|
||||
<RowDefinition Height="10"/>
|
||||
<RowDefinition Height="108"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="108"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button x:Name="HomeButton">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ic:SymbolIcon VerticalAlignment="Center" HorizontalAlignment="Center" Symbol="Home" FontSize="48" />
|
||||
<TextBlock Grid.Row="1" FontWeight="DemiBold" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0, 10, 0, 0">
|
||||
Home
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
<Button x:Name="BrowseButton" Grid.Row="2">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ic:SymbolIcon VerticalAlignment="Center" HorizontalAlignment="Center" Symbol="CloudArrowDown" FontSize="48" />
|
||||
<TextBlock Grid.Row="1" FontWeight="DemiBold" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center" Padding="4">
|
||||
Browse lists
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</rxui:ReactiveUserControl>
|
36
Wabbajack.App.Wpf/Views/NavigationView.xaml.cs
Normal file
36
Wabbajack.App.Wpf/Views/NavigationView.xaml.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using ReactiveUI;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for NavigationView.xaml
|
||||
/// </summary>
|
||||
public partial class NavigationView : ReactiveUserControl<NavigationVM>
|
||||
{
|
||||
public NavigationView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.WhenActivated(dispose =>
|
||||
{
|
||||
this.WhenAny(x => x.ViewModel.BrowseCommand)
|
||||
.BindTo(this, x => x.BrowseButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
/*
|
||||
this.WhenAny(x => x.ViewModel.InstallCommand)
|
||||
.BindToStrict(this, x => x.InstallButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.CompileCommand)
|
||||
.BindToStrict(this, x => x.CompileButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
*/
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user