Refactor some names to (hopefully) make more sense

This commit is contained in:
trawzified 2024-05-19 18:14:47 +02:00
parent 7d206315af
commit 2c2ce89698
17 changed files with 60 additions and 60 deletions

View File

@ -168,8 +168,8 @@ namespace Wabbajack
services.AddTransient<HomeVM>();
services.AddTransient<ModListGalleryVM>();
services.AddTransient<CompilerVM>();
services.AddTransient<CreateModListVM>();
services.AddTransient<CompilerDetailsVM>();
services.AddTransient<CompilerHomeVM>();
services.AddTransient<InstallerVM>();
services.AddTransient<SettingsVM>();
services.AddTransient<WebBrowserVM>();

View File

@ -8,8 +8,8 @@ public enum ScreenType
ModListGallery,
Installer,
Settings,
Compiler,
CreateModList,
CompilerDetails,
CompilerHome,
ModListContents,
WebBrowser
}

View File

@ -8,7 +8,7 @@ using Wabbajack.Models;
namespace Wabbajack
{
public class CreatedModlistVM
public class CompiledModListTileVM
{
private ILogger _logger;
public LoadingLock LoadingImageLock { get; } = new();
@ -16,7 +16,7 @@ namespace Wabbajack
[Reactive]
public CompilerSettings CompilerSettings { get; set; }
public CreatedModlistVM(ILogger logger, CompilerSettings compilerSettings)
public CompiledModListTileVM(ILogger logger, CompilerSettings compilerSettings)
{
_logger = logger;
CompilerSettings = compilerSettings;
@ -26,7 +26,7 @@ namespace Wabbajack
private void CompileModList()
{
_logger.LogInformation($"Selected modlist {CompilerSettings.ModListName} for compilation, located in '{CompilerSettings.Source}'");
NavigateToGlobal.Send(ScreenType.Compiler);
NavigateToGlobal.Send(ScreenType.CompilerDetails);
LoadModlistForCompiling.Send(CompilerSettings);
}
}

View File

@ -38,12 +38,12 @@ namespace Wabbajack
Completed,
Errored
}
public class CompilerVM : BackNavigatingVM, ICpuStatusVM
public class CompilerDetailsVM : BackNavigatingVM, ICpuStatusVM
{
private readonly DTOSerializer _dtos;
private readonly SettingsManager _settingsManager;
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<CompilerVM> _logger;
private readonly ILogger<CompilerDetailsVM> _logger;
private readonly ResourceMonitor _resourceMonitor;
private readonly CompilerSettingsInferencer _inferencer;
private readonly Client _wjClient;
@ -75,7 +75,7 @@ namespace Wabbajack
[Reactive]
public ErrorResponse ErrorState { get; private set; }
public CompilerVM(ILogger<CompilerVM> logger, DTOSerializer dtos, SettingsManager settingsManager,
public CompilerDetailsVM(ILogger<CompilerDetailsVM> logger, DTOSerializer dtos, SettingsManager settingsManager,
IServiceProvider serviceProvider, LogStream loggerProvider, ResourceMonitor resourceMonitor,
CompilerSettingsInferencer inferencer, Client wjClient) : base(logger)
{

View File

@ -29,11 +29,11 @@ using Wabbajack.Services.OSIntegrated.Services;
namespace Wabbajack
{
public class CreateModListVM : ViewModel
public class CompilerHomeVM : ViewModel
{
private readonly SettingsManager _settingsManager;
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<CreateModListVM> _logger;
private readonly ILogger<CompilerHomeVM> _logger;
private readonly CancellationToken _cancellationToken;
private readonly DTOSerializer _dtos;
@ -41,11 +41,11 @@ namespace Wabbajack
public ICommand LoadSettingsCommand { get; set; }
[Reactive]
public ObservableCollection<CreatedModlistVM> CreatedModlists { get; set; }
public ObservableCollection<CompiledModListTileVM> CompiledModLists { get; set; }
public FilePickerVM CompilerSettingsPicker { get; private set; }
public CreateModListVM(ILogger<CreateModListVM> logger, SettingsManager settingsManager,
public CompilerHomeVM(ILogger<CompilerHomeVM> logger, SettingsManager settingsManager,
IServiceProvider serviceProvider, DTOSerializer dtos)
{
_logger = logger;
@ -64,7 +64,7 @@ namespace Wabbajack
]);
NewModListCommand = ReactiveCommand.Create(() => {
NavigateToGlobal.Send(ScreenType.Compiler);
NavigateToGlobal.Send(ScreenType.CompilerDetails);
LoadModlistForCompiling.Send(new());
});
@ -73,7 +73,7 @@ namespace Wabbajack
CompilerSettingsPicker.SetTargetPathCommand.Execute(null);
if(CompilerSettingsPicker.TargetPath != default)
{
NavigateToGlobal.Send(ScreenType.Compiler);
NavigateToGlobal.Send(ScreenType.CompilerDetails);
var compilerSettings = _dtos.Deserialize<CompilerSettings>(File.ReadAllText(CompilerSettingsPicker.TargetPath.ToString()));
LoadModlistForCompiling.Send(compilerSettings);
}
@ -87,13 +87,13 @@ namespace Wabbajack
private async Task LoadAllCompilerSettings()
{
CreatedModlists = new();
CompiledModLists = new();
var savedCompilerSettingsPaths = await _settingsManager.Load<List<AbsolutePath>>(Consts.AllSavedCompilerSettingsPaths);
foreach(var settingsPath in savedCompilerSettingsPaths)
{
await using var fs = settingsPath.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
var settings = (await _dtos.DeserializeAsync<CompilerSettings>(fs))!;
CreatedModlists.Add(new CreatedModlistVM(_logger, settings));
CompiledModLists.Add(new CompiledModListTileVM(_logger, settings));
}
}
}

View File

@ -18,7 +18,7 @@ namespace Wabbajack
{
public class MO2CompilerVM : ViewModel
{
public CompilerVM Parent { get; }
public CompilerDetailsVM Parent { get; }
public FilePickerVM DownloadLocation { get; }
@ -41,7 +41,7 @@ namespace Wabbajack
throw new NotImplementedException();
}
public MO2CompilerVM(CompilerVM parent)
public MO2CompilerVM(CompilerDetailsVM parent)
{
}
}

View File

@ -44,8 +44,8 @@ namespace Wabbajack
public ObservableCollectionExtended<IStatusMessage> Log { get; } = new ObservableCollectionExtended<IStatusMessage>();
public readonly CompilerVM CompilerVM;
public readonly CreateModListVM CreateModListVM;
public readonly CompilerDetailsVM CompilerDetailsVM;
public readonly CompilerHomeVM CompilerHomeVM;
public readonly InstallerVM InstallerVM;
public readonly SettingsVM SettingsPaneVM;
public readonly ModListGalleryVM GalleryVM;
@ -79,7 +79,7 @@ namespace Wabbajack
public MainWindowVM(ILogger<MainWindowVM> logger, Client wjClient,
IServiceProvider serviceProvider, HomeVM homeVM, ModListGalleryVM modListGalleryVM, ResourceMonitor resourceMonitor,
InstallerVM installerVM, CompilerVM compilerVM, CreateModListVM createModListVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM, NavigationVM navigationVM)
InstallerVM installerVM, CompilerDetailsVM compilerVM, CompilerHomeVM compilerHomeVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM, NavigationVM navigationVM)
{
_logger = logger;
_wjClient = wjClient;
@ -87,8 +87,8 @@ namespace Wabbajack
_serviceProvider = serviceProvider;
ConverterRegistration.Register();
InstallerVM = installerVM;
CompilerVM = compilerVM;
CreateModListVM = createModListVM;
CompilerDetailsVM = compilerVM;
CompilerHomeVM = compilerHomeVM;
SettingsPaneVM = settingsVM;
GalleryVM = modListGalleryVM;
HomeVM = homeVM;
@ -235,8 +235,8 @@ namespace Wabbajack
ScreenType.Home => HomeVM,
ScreenType.ModListGallery => GalleryVM,
ScreenType.Installer => InstallerVM,
ScreenType.Compiler => CompilerVM,
ScreenType.CreateModList => CreateModListVM,
ScreenType.CompilerDetails => CompilerDetailsVM,
ScreenType.CompilerHome => CompilerHomeVM,
ScreenType.Settings => SettingsPaneVM,
_ => ActivePane
};

View File

@ -37,7 +37,7 @@ namespace Wabbajack
LoadLastLoadedModlist.Send();
NavigateToGlobal.Send(ScreenType.Installer);
});
CreateModListCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(ScreenType.CreateModList));
CompileModListCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(ScreenType.CompilerHome));
SettingsCommand = ReactiveCommand.Create(
/*
canExecute: this.WhenAny(x => x.ActivePane)
@ -58,7 +58,7 @@ namespace Wabbajack
public ICommand HomeCommand { get; }
public ICommand BrowseCommand { get; }
public ICommand InstallCommand { get; }
public ICommand CreateModListCommand { get; }
public ICommand CompileModListCommand { get; }
public ICommand SettingsCommand { get; }
public string Version { get; }
}

View File

@ -9,7 +9,7 @@
xmlns:rxui="http://reactiveui.net"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:CompilerVM"
x:TypeArguments="local:CompilerDetailsVM"
mc:Ignorable="d">
<local:AttentionBorder x:Name="AttentionBorder" ClipToBounds="True">
<Grid Margin="5">

View File

@ -1,5 +1,5 @@
<rxui:ReactiveUserControl
x:Class="Wabbajack.CreatedModListTileView"
x:Class="Wabbajack.CompiledModListTileView"
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"
@ -10,7 +10,7 @@
xmlns:rxui="http://reactiveui.net"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:CreatedModlistVM"
x:TypeArguments="local:CompiledModListTileVM"
mc:Ignorable="d">
<Grid Margin="10, 0, 10, 16" x:Name="CompiledModListTile">
<Border Name="BorderMask2" CornerRadius="10" BorderThickness="0" Background="White" Margin="1" />

View File

@ -10,9 +10,9 @@ namespace Wabbajack
/// <summary>
/// Interaction logic for CreateModListTileView.xaml
/// </summary>
public partial class CreatedModListTileView : ReactiveUserControl<CreatedModlistVM>
public partial class CompiledModListTileView : ReactiveUserControl<CompiledModListTileVM>
{
public CreatedModListTileView()
public CompiledModListTileView()
{
InitializeComponent();
this.WhenActivated(dispose =>

View File

@ -1,5 +1,5 @@
<rxui:ReactiveUserControl
x:Class="Wabbajack.CompilerView"
x:Class="Wabbajack.CompilerDetailsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib="clr-namespace:Wabbajack;assembly=Wabbajack"
@ -11,10 +11,10 @@
xmlns:rxui="http://reactiveui.net"
xmlns:wabbacommon="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
xmlns:controls1="clr-namespace:Wabbajack.ViewModels.Controls"
d:DataContext="{d:DesignInstance local:CompilerVM}"
d:DataContext="{d:DesignInstance local:CompilerDetailsVM}"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:CompilerVM"
x:TypeArguments="local:CompilerDetailsVM"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>

View File

@ -19,11 +19,11 @@ using Wabbajack.Services.OSIntegrated;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for CompilerView.xaml
/// Interaction logic for CompilerDetailsView.xaml
/// </summary>
public partial class CompilerView : ReactiveUserControl<CompilerVM>
public partial class CompilerDetailsView : ReactiveUserControl<CompilerDetailsVM>
{
public CompilerView()
public CompilerDetailsView()
{
InitializeComponent();

View File

@ -1,5 +1,5 @@
<rxui:ReactiveUserControl
x:Class="Wabbajack.CreateModListView"
x:Class="Wabbajack.CompilerHomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib="clr-namespace:Wabbajack;assembly=Wabbajack"
@ -12,10 +12,10 @@
xmlns:wabbacommon="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
xmlns:controls1="clr-namespace:Wabbajack.ViewModels.Controls"
xmlns:ic="clr-namespace:FluentIcons.WPF;assembly=FluentIcons.WPF"
d:DataContext="{d:DesignInstance local:CreateModListVM}"
d:DataContext="{d:DesignInstance local:CompilerHomeVM}"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:CreateModListVM"
x:TypeArguments="local:CompilerHomeVM"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
@ -111,7 +111,7 @@
<ScrollViewer Grid.Row="1" Background="Transparent" VerticalScrollBarVisibility="Auto">
<ItemsControl
x:Name="CreatedModListsControl"
x:Name="CompiledModListsControl"
HorizontalAlignment="Center"
ScrollViewer.VerticalScrollBarVisibility="Visible">
<ItemsControl.ItemsPanel>
@ -121,7 +121,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:CreatedModListTileView ViewModel="{Binding}" />
<local:CompiledModListTileView ViewModel="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

View File

@ -22,16 +22,16 @@ namespace Wabbajack
/// <summary>
/// Interaction logic for CreateModList.xaml
/// </summary>
public partial class CreateModListView : ReactiveUserControl<CreateModListVM>
public partial class CompilerHomeView : ReactiveUserControl<CompilerHomeVM>
{
public CreateModListView()
public CompilerHomeView()
{
InitializeComponent();
this.WhenActivated(dispose =>
{
this.WhenAny(x => x.ViewModel.CreatedModlists)
.BindToStrict(this, x => x.CreatedModListsControl.ItemsSource)
this.WhenAny(x => x.ViewModel.CompiledModLists)
.BindToStrict(this, x => x.CompiledModListsControl.ItemsSource)
.DisposeWith(dispose);
NewModListBorder

View File

@ -67,21 +67,21 @@
<Border Grid.Column="1" Margin="0" Background="{StaticResource ComplementaryBackgroundBrush}" x:Name="MainContent" Padding="18" CornerRadius="8">
<ContentPresenter Content="{Binding ActivePane}" VerticalAlignment="Stretch">
<ContentPresenter.Resources>
<DataTemplate DataType="{x:Type local:CompilerVM}">
<local:CompilerView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:CreateModListVM}">
<local:CreateModListView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:InstallerVM}">
<local:InstallationView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:HomeVM}">
<local:HomeView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:ModListGalleryVM}">
<local:ModListGalleryView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:CompilerHomeVM}">
<local:CompilerHomeView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:CompilerDetailsVM}">
<local:CompilerDetailsView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:InstallerVM}">
<local:InstallationView ViewModel="{Binding}" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:WebBrowserVM}">
<local:WebBrowserView />
</DataTemplate>

View File

@ -23,7 +23,7 @@ namespace Wabbajack
ScreenButtonDictionary = new() {
{ ScreenType.Home, HomeButton },
{ ScreenType.ModListGallery, BrowseButton },
{ ScreenType.CreateModList, CompileButton },
{ ScreenType.CompilerHome, CompileButton },
{ ScreenType.Settings, SettingsButton },
};
this.WhenActivated(dispose =>
@ -32,7 +32,7 @@ namespace Wabbajack
.DisposeWith(dispose);
this.BindCommand(ViewModel, vm => vm.HomeCommand, v => v.HomeButton)
.DisposeWith(dispose);
this.BindCommand(ViewModel, vm => vm.CreateModListCommand, v => v.CompileButton)
this.BindCommand(ViewModel, vm => vm.CompileModListCommand, v => v.CompileButton)
.DisposeWith(dispose);
this.BindCommand(ViewModel, vm => vm.SettingsCommand, v => v.SettingsButton)
.DisposeWith(dispose);