mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Remove unused settings and related classes
This commit is contained in:
parent
039e3603ce
commit
bdb60f26a7
@ -3,7 +3,6 @@ using System.Reactive.Concurrency;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -166,7 +165,6 @@ namespace Wabbajack
|
||||
services.AddSingleton<LauncherUpdater>();
|
||||
services.AddSingleton<ResourceMonitor>();
|
||||
|
||||
services.AddSingleton<MainSettings>();
|
||||
services.AddTransient<CompilerVM>();
|
||||
services.AddTransient<InstallerVM>();
|
||||
services.AddTransient<ModeSelectionVM>();
|
||||
@ -182,7 +180,7 @@ namespace Wabbajack
|
||||
services.AddTransient<LoversLabLoginHandler>();
|
||||
|
||||
// Login Managers
|
||||
|
||||
|
||||
//Disabled LL because it is currently not used and broken due to the way LL butchers their API
|
||||
//services.AddAllSingleton<INeedsLogin, LoversLabLoginManager>();
|
||||
services.AddAllSingleton<INeedsLogin, NexusLoginManager>();
|
||||
|
@ -1,108 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Compiler;
|
||||
using Wabbajack.Downloaders;
|
||||
using Wabbajack.DTOs.JsonConverters;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.Downloaders;
|
||||
using Wabbajack.RateLimiter;
|
||||
using Wabbajack.Util;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
[JsonName("MainSettings")]
|
||||
[JsonObject(MemberSerialization.OptOut)]
|
||||
public class MainSettings
|
||||
{
|
||||
public byte Version { get; set; } = Consts.SettingsVersion;
|
||||
public double PosX { get; set; }
|
||||
public double PosY { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Width { get; set; }
|
||||
public InstallerSettings Installer { get; set; } = new();
|
||||
public FiltersSettings Filters { get; set; } = new();
|
||||
public CompilerSettings Compiler { get; set; } = new();
|
||||
|
||||
private Subject<Unit> _saveSignal = new();
|
||||
[JsonIgnore]
|
||||
public IObservable<Unit> SaveSignal => _saveSignal;
|
||||
|
||||
public static async ValueTask<(MainSettings settings, bool loaded)> TryLoadTypicalSettings()
|
||||
{
|
||||
/*
|
||||
if (!Consts.SettingsFile.Exists)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
// Version check
|
||||
try
|
||||
{
|
||||
var settings = Consts.SettingsFile.FromJson<MainSettings>();
|
||||
if (settings.Version == Consts.SettingsVersion)
|
||||
return (settings, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Error(ex, "Error loading settings");
|
||||
}
|
||||
|
||||
var backup = Consts.SettingsFile.AppendToName("-backup");
|
||||
await backup.DeleteAsync();
|
||||
|
||||
await Consts.SettingsFile.CopyToAsync(backup);
|
||||
await Consts.SettingsFile.DeleteAsync();
|
||||
*/
|
||||
return default;
|
||||
}
|
||||
|
||||
public static async ValueTask SaveSettings(MainSettings settings)
|
||||
{
|
||||
settings._saveSignal.OnNext(Unit.Default);
|
||||
|
||||
// Might add this if people are putting save work on other threads or other
|
||||
// things that delay the operation.
|
||||
//settings._saveSignal.OnCompleted();
|
||||
//await settings._saveSignal;
|
||||
|
||||
//await settings.ToJsonAsync(Consts.SettingsFile);
|
||||
}
|
||||
}
|
||||
|
||||
[JsonName("InstallerSettings")]
|
||||
public class InstallerSettings
|
||||
{
|
||||
public AbsolutePath LastInstalledListLocation { get; set; }
|
||||
public Dictionary<AbsolutePath, Mo2ModlistInstallationSettings> Mo2ModlistSettings { get; } = new Dictionary<AbsolutePath, Mo2ModlistInstallationSettings>();
|
||||
}
|
||||
|
||||
[JsonName("Mo2ModListInstallerSettings")]
|
||||
public class Mo2ModlistInstallationSettings
|
||||
{
|
||||
public AbsolutePath InstallationLocation { get; set; }
|
||||
public AbsolutePath DownloadLocation { get; set; }
|
||||
public bool AutomaticallyOverrideExistingInstall { get; set; }
|
||||
}
|
||||
|
||||
[JsonName("FiltersSettings")]
|
||||
[JsonObject(MemberSerialization.OptOut)]
|
||||
public class FiltersSettings : ViewModel
|
||||
{
|
||||
public bool ShowNSFW { get; set; }
|
||||
public bool OnlyInstalled { get; set; }
|
||||
public string Game { get; set; }
|
||||
public string Search { get; set; }
|
||||
private bool _isPersistent = true;
|
||||
public bool IsPersistent { get => _isPersistent; set => RaiseAndSetIfChanged(ref _isPersistent, value); }
|
||||
|
||||
private bool _useCompression = false;
|
||||
public bool UseCompression { get => _useCompression; set => RaiseAndSetIfChanged(ref _useCompression, value); }
|
||||
public bool ShowUtilityLists { get; set; }
|
||||
}
|
||||
|
||||
public class PerformanceSettings : ViewModel
|
||||
{
|
||||
private readonly Configuration.MainSettings _settings;
|
||||
@ -140,29 +41,4 @@ namespace Wabbajack
|
||||
MaximumMemoryPerDownloadThreadMb = _defaultMaximumMemoryPerDownloadThreadMb;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonName("CompilationModlistSettings")]
|
||||
public class CompilationModlistSettings
|
||||
{
|
||||
public string ModListName { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Author { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Website { get; set; }
|
||||
public string Readme { get; set; }
|
||||
public bool IsNSFW { get; set; }
|
||||
|
||||
public string MachineUrl { get; set; }
|
||||
public AbsolutePath SplashScreen { get; set; }
|
||||
public bool Publish { get; set; }
|
||||
}
|
||||
|
||||
[JsonName("MO2CompilationSettings")]
|
||||
public class MO2CompilationSettings
|
||||
{
|
||||
public AbsolutePath DownloadLocation { get; set; }
|
||||
public AbsolutePath LastCompiledProfileLocation { get; set; }
|
||||
public Dictionary<AbsolutePath, CompilationModlistSettings> ModlistSettings { get; } = new Dictionary<AbsolutePath, CompilationModlistSettings>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,109 +0,0 @@
|
||||
using System;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows.Input;
|
||||
using DynamicData;
|
||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
public class ModlistSettingsEditorVM : ViewModel
|
||||
{
|
||||
private readonly CompilationModlistSettings _settings;
|
||||
|
||||
[Reactive]
|
||||
public string ModListName { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string VersionText { get; set; }
|
||||
|
||||
private readonly ObservableAsPropertyHelper<Version> _version;
|
||||
public Version Version => _version.Value;
|
||||
|
||||
[Reactive]
|
||||
public string AuthorText { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string Description { get; set; }
|
||||
|
||||
public FilePickerVM ImagePath { get; }
|
||||
|
||||
[Reactive]
|
||||
public string Readme { get; set; }
|
||||
|
||||
[Reactive] public string MachineUrl { get; set; } = "";
|
||||
[Reactive] public bool Publish { get; set; } = false;
|
||||
|
||||
[Reactive]
|
||||
public string Website { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool IsNSFW { get; set; }
|
||||
|
||||
public IObservable<bool> InError { get; }
|
||||
|
||||
public ModlistSettingsEditorVM(CompilationModlistSettings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
ImagePath = new FilePickerVM
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.CheckOptions.IfPathNotEmpty,
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
};
|
||||
ImagePath.Filters.Add(new CommonFileDialogFilter("Banner image", "*.png"));
|
||||
|
||||
_version = this.WhenAny(x => x.VersionText)
|
||||
.Select(x =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(x))
|
||||
return new Version(0, 0);
|
||||
|
||||
return !Version.TryParse(x, out var version) ? new Version(0, 0) : version;
|
||||
}).ObserveOnGuiThread()
|
||||
.ToProperty(this, x => x.Version);
|
||||
|
||||
InError = this.WhenAny(x => x.ImagePath.ErrorState)
|
||||
.Select(err => err.Failed)
|
||||
.CombineLatest(
|
||||
this.WhenAny(x => x.VersionText)
|
||||
.Select(x => Version.TryParse(x, out _)),
|
||||
(image, version) => !image && !version)
|
||||
.Publish()
|
||||
.RefCount();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
AuthorText = _settings.Author;
|
||||
if (!string.IsNullOrWhiteSpace(_settings.ModListName))
|
||||
{
|
||||
ModListName = _settings.ModListName;
|
||||
}
|
||||
Description = _settings.Description;
|
||||
Readme = _settings.Readme;
|
||||
ImagePath.TargetPath = _settings.SplashScreen;
|
||||
Website = _settings.Website;
|
||||
VersionText = _settings.Version;
|
||||
IsNSFW = _settings.IsNSFW;
|
||||
MachineUrl = _settings.MachineUrl;
|
||||
Publish = _settings.Publish;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_settings.Version = VersionText;
|
||||
_settings.Author = AuthorText;
|
||||
_settings.ModListName = ModListName;
|
||||
_settings.Description = Description;
|
||||
_settings.Readme = Readme;
|
||||
_settings.SplashScreen = ImagePath.TargetPath;
|
||||
_settings.Website = Website;
|
||||
_settings.IsNSFW = IsNSFW;
|
||||
_settings.MachineUrl = MachineUrl;
|
||||
_settings.Publish = Publish;
|
||||
}
|
||||
}
|
||||
}
|
@ -80,7 +80,6 @@ namespace Wabbajack
|
||||
private readonly SettingsManager _settingsManager;
|
||||
private readonly CancellationToken _cancellationToken;
|
||||
|
||||
private FiltersSettings settings { get; set; } = new();
|
||||
public ICommand ClearFiltersCommand { get; set; }
|
||||
|
||||
public ModListGalleryVM(ILogger<ModListGalleryVM> logger, Client wjClient, GameLocator locator,
|
||||
|
@ -1,38 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Installer;
|
||||
using Wabbajack;
|
||||
using Wabbajack.DTOs;
|
||||
using Wabbajack.DTOs.Interventions;
|
||||
using Wabbajack.Interventions;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.Util;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
public class MO2InstallerVM : ViewModel, ISubInstallerVM
|
||||
{
|
||||
public InstallerVM Parent { get; }
|
||||
|
||||
|
||||
[Reactive]
|
||||
public ErrorResponse CanInstall { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public IInstaller ActiveInstallation { get; private set; }
|
||||
|
||||
|
||||
[Reactive] public Mo2ModlistInstallationSettings CurrentSettings { get; set; }
|
||||
|
||||
public FilePickerVM Location { get; }
|
||||
|
||||
public FilePickerVM DownloadLocation { get; }
|
||||
@ -62,111 +49,17 @@ namespace Wabbajack
|
||||
DownloadLocation.TargetPath = newPath.Combine("downloads");
|
||||
}
|
||||
}).DisposeWith(CompositeDisposable);
|
||||
|
||||
|
||||
DownloadLocation = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.CheckOptions.Off,
|
||||
PathType = FilePickerVM.PathTypeOptions.Folder,
|
||||
PromptTitle = "Select a location for MO2 downloads",
|
||||
};
|
||||
/* TODO
|
||||
DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath)
|
||||
.Select(x => Utils.IsDirectoryPathValid(x));
|
||||
Location.AdditionalError = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Location.TargetPath),
|
||||
this.WhenAny(x => x.DownloadLocation.TargetPath),
|
||||
resultSelector: (target, download) => (target, download))
|
||||
.ObserveOn(RxApp.TaskpoolScheduler)
|
||||
.Select(i => MO2Installer.CheckValidInstallPath(i.target, i.download, Parent.ModList?.SourceModList?.GameType.MetaData()))
|
||||
.ObserveOnGuiThread();
|
||||
|
||||
_CanInstall = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Location.ErrorState),
|
||||
this.WhenAny(x => x.DownloadLocation.ErrorState),
|
||||
installerVM.WhenAny(x => x.ModListLocation.ErrorState),
|
||||
resultSelector: (loc, modlist, download) =>
|
||||
{
|
||||
return ErrorResponse.FirstFail(loc, modlist, download);
|
||||
})
|
||||
.ToProperty(this, nameof(CanInstall));
|
||||
|
||||
// Have Installation location updates modify the downloads location if empty or the same path
|
||||
this.WhenAny(x => x.Location.TargetPath)
|
||||
.Skip(1) // Don't do it initially
|
||||
.Subscribe(installPath =>
|
||||
{
|
||||
if (DownloadLocation.TargetPath == default || DownloadLocation.TargetPath == installPath)
|
||||
{
|
||||
if (installPath.Exists) DownloadLocation.TargetPath = installPath.Combine("downloads");
|
||||
}
|
||||
})
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Have Download location updates change if the same as the install path
|
||||
this.WhenAny(x => x.DownloadLocation.TargetPath)
|
||||
.Skip(1) // Don't do it initially
|
||||
.Subscribe(downloadPath =>
|
||||
{
|
||||
if (downloadPath != default && downloadPath == Location.TargetPath)
|
||||
{
|
||||
DownloadLocation.TargetPath = Location.TargetPath.Combine("downloads");
|
||||
}
|
||||
})
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Load settings
|
||||
_CurrentSettings = installerVM.WhenAny(x => x.ModListLocation.TargetPath)
|
||||
.Select(path => path == default ? null : installerVM.MWVM.Settings.Installer.Mo2ModlistSettings.TryCreate(path))
|
||||
.ToGuiProperty(this, nameof(CurrentSettings));
|
||||
this.WhenAny(x => x.CurrentSettings)
|
||||
.Pairwise()
|
||||
.Subscribe(settingsPair =>
|
||||
{
|
||||
SaveSettings(settingsPair.Previous);
|
||||
if (settingsPair.Current == null) return;
|
||||
Location.TargetPath = settingsPair.Current.InstallationLocation;
|
||||
DownloadLocation.TargetPath = settingsPair.Current.DownloadLocation;
|
||||
AutomaticallyOverwrite = settingsPair.Current.AutomaticallyOverrideExistingInstall;
|
||||
})
|
||||
.DisposeWith(CompositeDisposable);
|
||||
installerVM.MWVM.Settings.SaveSignal
|
||||
.Subscribe(_ => SaveSettings(CurrentSettings))
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Hook onto user interventions, and intercept MO2 specific ones for customization
|
||||
this.WhenAny(x => x.ActiveInstallation)
|
||||
.Select(x => x?.LogMessages ?? Observable.Empty<IStatusMessage>())
|
||||
.Switch()
|
||||
.Subscribe(x =>
|
||||
{
|
||||
switch (x)
|
||||
{
|
||||
case ConfirmUpdateOfExistingInstall c:
|
||||
if (AutomaticallyOverwrite)
|
||||
{
|
||||
c.Confirm();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
})
|
||||
.DisposeWith(CompositeDisposable);
|
||||
*/
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
SaveSettings(this.CurrentSettings);
|
||||
}
|
||||
|
||||
private void SaveSettings(Mo2ModlistInstallationSettings settings)
|
||||
{
|
||||
//Parent.MWVM.Settings.Installer.LastInstalledListLocation = Parent.ModListLocation.TargetPath;
|
||||
if (settings == null) return;
|
||||
settings.InstallationLocation = Location.TargetPath;
|
||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||
settings.AutomaticallyOverrideExistingInstall = AutomaticallyOverwrite;
|
||||
}
|
||||
|
||||
public void AfterInstallNavigation()
|
||||
@ -205,7 +98,7 @@ namespace Wabbajack
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public IUserIntervention InterventionConverter(IUserIntervention intervention)
|
||||
{
|
||||
switch (intervention)
|
||||
|
@ -16,11 +16,8 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Orc.FileAssociation;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Downloaders.GameFile;
|
||||
using Wabbajack;
|
||||
using Wabbajack.DTOs.Interventions;
|
||||
using Wabbajack.Interventions;
|
||||
using Wabbajack.LoginManagers;
|
||||
using Wabbajack.Messages;
|
||||
using Wabbajack.Models;
|
||||
using Wabbajack.Networking.WabbajackClientApi;
|
||||
@ -39,8 +36,6 @@ namespace Wabbajack
|
||||
{
|
||||
public MainWindow MainWindow { get; }
|
||||
|
||||
public MainSettings Settings { get; }
|
||||
|
||||
[Reactive]
|
||||
public ViewModel ActivePane { get; private set; }
|
||||
|
||||
@ -76,7 +71,7 @@ namespace Wabbajack
|
||||
[Reactive]
|
||||
public bool UpdateAvailable { get; private set; }
|
||||
|
||||
public MainWindowVM(ILogger<MainWindowVM> logger, MainSettings settings, Client wjClient,
|
||||
public MainWindowVM(ILogger<MainWindowVM> logger, Client wjClient,
|
||||
IServiceProvider serviceProvider, ModeSelectionVM modeSelectionVM, ModListGalleryVM modListGalleryVM, ResourceMonitor resourceMonitor,
|
||||
InstallerVM installer, CompilerVM compilerVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM)
|
||||
{
|
||||
@ -85,7 +80,6 @@ namespace Wabbajack
|
||||
_resourceMonitor = resourceMonitor;
|
||||
_serviceProvider = serviceProvider;
|
||||
ConverterRegistration.Register();
|
||||
Settings = settings;
|
||||
Installer = installer;
|
||||
Compiler = compilerVM;
|
||||
SettingsPane = settingsVM;
|
||||
|
@ -28,7 +28,6 @@ namespace Wabbajack
|
||||
|
||||
public LoginManagerVM Login { get; }
|
||||
public PerformanceSettings Performance { get; }
|
||||
public FiltersSettings Filters { get; }
|
||||
public AuthorFilesVM AuthorFile { get; }
|
||||
|
||||
public ICommand OpenTerminalCommand { get; }
|
||||
|
@ -1,24 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reactive.Disposables;
|
||||
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;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Wabbajack;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Reactive.Linq;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.RateLimiter;
|
||||
|
||||
namespace Wabbajack
|
||||
@ -36,23 +19,12 @@ namespace Wabbajack
|
||||
public static readonly DependencyProperty ProgressPercentProperty = DependencyProperty.Register(nameof(ProgressPercent), typeof(Percent), typeof(CpuView),
|
||||
new FrameworkPropertyMetadata(default(Percent), WireNotifyPropertyChanged));
|
||||
|
||||
public MainSettings SettingsHook
|
||||
{
|
||||
get => (MainSettings)GetValue(SettingsHookProperty);
|
||||
set => SetValue(SettingsHookProperty, value);
|
||||
}
|
||||
public static readonly DependencyProperty SettingsHookProperty = DependencyProperty.Register(nameof(SettingsHook), typeof(MainSettings), typeof(CpuView),
|
||||
new FrameworkPropertyMetadata(default(SettingsVM), WireNotifyPropertyChanged));
|
||||
|
||||
private bool _ShowingSettings;
|
||||
public bool ShowingSettings { get => _ShowingSettings; set => this.RaiseAndSetIfChanged(ref _ShowingSettings, value); }
|
||||
|
||||
public CpuView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.WhenActivated(disposable =>
|
||||
{
|
||||
|
||||
|
||||
this.WhenAny(x => x.ViewModel.StatusList)
|
||||
.BindToStrict(this, x => x.CpuListControl.ItemsSource)
|
||||
.DisposeWith(disposable);
|
||||
|
@ -324,20 +324,6 @@
|
||||
<local:CpuView Grid.Column="2"
|
||||
x:Name="CpuView"
|
||||
ViewModel="{Binding}" />
|
||||
<!--
|
||||
<local:AttentionBorder Grid.Column="2"
|
||||
x:Name="UserInterventionsControl"
|
||||
Content="{Binding ActiveGlobalUserIntervention}">
|
||||
<local:AttentionBorder.Resources>
|
||||
<DataTemplate DataType="{x:Type lib1:ConfirmationIntervention}">
|
||||
<local:ConfirmationInterventionView ViewModel="{Binding}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:ConfirmUpdateOfExistingInstallVM}">
|
||||
<local:ConfirmUpdateOfExistingInstallView ViewModel="{Binding}" />
|
||||
</DataTemplate>
|
||||
</local:AttentionBorder.Resources>
|
||||
</local:AttentionBorder>
|
||||
-->
|
||||
<local:InstallationCompleteView Grid.Column="2"
|
||||
x:Name="InstallComplete"
|
||||
ViewModel="{Binding}" />
|
||||
|
@ -1,50 +0,0 @@
|
||||
<rxui:ReactiveUserControl
|
||||
x:Class="Wabbajack.ConfirmUpdateOfExistingInstallView"
|
||||
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:lib="clr-namespace:Wabbajack;assembly=Wabbajack"
|
||||
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:ConfirmUpdateOfExistingInstallVM"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="10" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="5*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="2*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
x:Name="ShortDescription"
|
||||
Margin="0,0,0,5"
|
||||
FontFamily="Lucida Sans"
|
||||
FontSize="14"
|
||||
FontWeight="Bold"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
x:Name="ExtendedDescription"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<CheckBox Grid.Row="2" Grid.Column="2"
|
||||
x:Name="AutoOverwriteCheckbox"
|
||||
Margin="4"
|
||||
HorizontalAlignment="Right"
|
||||
Content="Remember"
|
||||
IsChecked="{Binding Installer.AutomaticallyOverwrite}"
|
||||
ToolTip="If installing over an existing installation next time, automatically replace it without asking permission." />
|
||||
<Button Grid.Row="3" Grid.Column="0"
|
||||
x:Name="CancelButton"
|
||||
Content="Cancel" />
|
||||
<Button Grid.Row="3" Grid.Column="2"
|
||||
x:Name="ConfirmButton"
|
||||
Content="Confirm" />
|
||||
</Grid>
|
||||
</rxui:ReactiveUserControl>
|
@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
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;
|
||||
using Wabbajack;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ConfirmUpdateOfExistingInstallView.xaml
|
||||
/// </summary>
|
||||
public partial class ConfirmUpdateOfExistingInstallView : ReactiveUserControl<ConfirmUpdateOfExistingInstallVM>
|
||||
{
|
||||
public ConfirmUpdateOfExistingInstallView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.WhenActivated(dispose =>
|
||||
{
|
||||
this.WhenAny(x => x.ViewModel.ShortDescription)
|
||||
.BindToStrict(this, x => x.ShortDescription.Text)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.ExtendedDescription)
|
||||
.BindToStrict(this, x => x.ExtendedDescription.Text)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Source.ConfirmCommand)
|
||||
.BindToStrict(this, x => x.ConfirmButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Source.CancelCommand)
|
||||
.BindToStrict(this, x => x.CancelButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
this.BindStrict(this.ViewModel, x => x.Installer.AutomaticallyOverwrite, x => x.AutoOverwriteCheckbox.IsChecked,
|
||||
vmToViewConverter: x => x,
|
||||
viewToVmConverter: x => x ?? false)
|
||||
.DisposeWith(dispose);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using MahApps.Metro.Controls;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.DTOs;
|
||||
using Wabbajack.DTOs.DownloadStates;
|
||||
using Wabbajack.DTOs.Interventions;
|
||||
using Wabbajack.Messages;
|
||||
using Wabbajack.Paths.IO;
|
||||
using Wabbajack.UserIntervention;
|
||||
using Wabbajack.Util;
|
||||
using Wabbajack.Views;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
@ -30,7 +21,6 @@ namespace Wabbajack
|
||||
public partial class MainWindow : MetroWindow
|
||||
{
|
||||
private MainWindowVM _mwvm;
|
||||
private MainSettings _settings;
|
||||
private readonly ILogger<MainWindow> _logger;
|
||||
private readonly SystemParametersConstructor _systemParams;
|
||||
|
||||
@ -75,7 +65,7 @@ namespace Wabbajack
|
||||
var p = _systemParams.Create();
|
||||
|
||||
_logger.LogInformation("Detected Windows Version: {Version}", Environment.OSVersion.VersionString);
|
||||
|
||||
|
||||
_logger.LogInformation(
|
||||
"System settings - ({MemorySize} RAM) ({PageSize} Page), Display: {ScreenWidth} x {ScreenHeight} ({Vram} VRAM - VideoMemorySizeMb={ENBVRam})",
|
||||
p.SystemMemorySize.ToFileSizeString(), p.SystemPageSize.ToFileSizeString(), p.ScreenWidth, p.ScreenHeight, p.VideoMemorySize.ToFileSizeString(), p.EnbLEVRAMSize);
|
||||
@ -85,25 +75,8 @@ namespace Wabbajack
|
||||
else if (p.SystemPageSize < 2e+10)
|
||||
_logger.LogInformation("Pagefile below recommended! Consider increasing to 20000MB. A suboptimal pagefile can cause crashes and poor in-game performance");
|
||||
|
||||
//Warmup();
|
||||
|
||||
var _ = updater.Run();
|
||||
|
||||
var (settings, loadedSettings) = MainSettings.TryLoadTypicalSettings().AsTask().Result;
|
||||
// Load settings
|
||||
/*
|
||||
if (CLIArguments.NoSettings || !loadedSettings)
|
||||
{
|
||||
_settings = new MainSettings {Version = Consts.SettingsVersion};
|
||||
RunWhenLoaded(DefaultSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
_settings = settings;
|
||||
RunWhenLoaded(LoadSettings);
|
||||
}*/
|
||||
|
||||
|
||||
// Bring window to the front if it isn't already
|
||||
this.Initialized += (s, e) =>
|
||||
{
|
||||
@ -135,45 +108,7 @@ namespace Wabbajack
|
||||
.BindToStrict(this, view => view.ResourceUsage.Text);
|
||||
vm.WhenAnyValue(vm => vm.AppName)
|
||||
.BindToStrict(this, view => view.AppName.Text);
|
||||
|
||||
}
|
||||
|
||||
public void Init(MainWindowVM vm, MainSettings settings)
|
||||
{
|
||||
DataContext = vm;
|
||||
_mwvm = vm;
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
private void RunWhenLoaded(Action a)
|
||||
{
|
||||
if (IsLoaded)
|
||||
{
|
||||
a();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Loaded += (sender, e) =>
|
||||
{
|
||||
a();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
Width = _settings.Width;
|
||||
Height = _settings.Height;
|
||||
Left = _settings.PosX;
|
||||
Top = _settings.PosY;
|
||||
}
|
||||
|
||||
private void DefaultSettings()
|
||||
{
|
||||
Width = 1300;
|
||||
Height = 960;
|
||||
Left = 15;
|
||||
Top = 15;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
|
@ -6,7 +6,6 @@
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:rxui="http://reactiveui.net"
|
||||
xmlns:xwpf="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:TypeArguments="local:SettingsVM"
|
||||
@ -32,17 +31,19 @@
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Grid.ColumnSpan="2"
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
FontFamily="Lucida Sans"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
Text="Misc Settings" />
|
||||
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.Resources>
|
||||
<Style BasedOn="{StaticResource MainButtonStyle}" TargetType="Button">
|
||||
@ -55,32 +56,9 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<CheckBox Grid.Row="0"
|
||||
Name="FilterPersistCheckBox"
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Content="Gallery filters are saved on exit">
|
||||
<CheckBox.LayoutTransform>
|
||||
<ScaleTransform ScaleX="1.2" ScaleY="1.2" />
|
||||
</CheckBox.LayoutTransform>
|
||||
</CheckBox>
|
||||
<CheckBox Grid.Row="1"
|
||||
Name="UseCompressionCheckBox"
|
||||
Margin="0,5,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Content="Use NTFS LZS compression during install">
|
||||
<CheckBox.LayoutTransform>
|
||||
<ScaleTransform ScaleX="1.2" ScaleY="1.2" />
|
||||
</CheckBox.LayoutTransform>
|
||||
</CheckBox>
|
||||
<Button Grid.Row="2"
|
||||
Name="ClearCefCache"
|
||||
Margin="0,5,0,0"
|
||||
Content="Clear In-App Browser Cache" />
|
||||
<Button Grid.Row="3"
|
||||
<Button
|
||||
Name="OpenTerminal"
|
||||
Grid.Row="0"
|
||||
Margin="0,5,0,0"
|
||||
Content="Launch Wabbajack CLI" />
|
||||
</Grid>
|
||||
|
@ -15,10 +15,6 @@ namespace Wabbajack
|
||||
this.WhenActivated(disposable =>
|
||||
{
|
||||
// Bind Values
|
||||
this.BindStrict(this.ViewModel, x => x.Filters.IsPersistent, x => x.FilterPersistCheckBox.IsChecked)
|
||||
.DisposeWith(disposable);
|
||||
this.BindStrict(this.ViewModel, x => x.Filters.UseCompression, x => x.UseCompressionCheckBox.IsChecked)
|
||||
.DisposeWith(disposable);
|
||||
this.WhenAnyValue(x => x.ViewModel.OpenTerminalCommand)
|
||||
.BindToStrict(this, x => x.OpenTerminal.Command)
|
||||
.DisposeWith(disposable);
|
||||
|
Loading…
Reference in New Issue
Block a user