mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Simplified names in Wabbajack
This commit is contained in:
parent
00d4181b1b
commit
d8276fb2ea
@ -8,7 +8,7 @@ namespace Wabbajack
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return object.Equals(value, parameter);
|
||||
return Equals(value, parameter);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
@ -36,20 +36,20 @@ namespace Wabbajack
|
||||
|
||||
public CompilerVM(MainWindowVM mainWindowVM)
|
||||
{
|
||||
this.MWVM = mainWindowVM;
|
||||
MWVM = mainWindowVM;
|
||||
|
||||
// Load settings
|
||||
CompilerSettings settings = this.MWVM.Settings.Compiler;
|
||||
this.SelectedCompilerType = settings.LastCompiledModManager;
|
||||
this.MWVM.Settings.SaveSignal
|
||||
CompilerSettings settings = MWVM.Settings.Compiler;
|
||||
SelectedCompilerType = settings.LastCompiledModManager;
|
||||
MWVM.Settings.SaveSignal
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
settings.LastCompiledModManager = this.SelectedCompilerType;
|
||||
settings.LastCompiledModManager = SelectedCompilerType;
|
||||
})
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Swap to proper sub VM based on selected type
|
||||
this._Compiler = this.WhenAny(x => x.SelectedCompilerType)
|
||||
_Compiler = this.WhenAny(x => x.SelectedCompilerType)
|
||||
// Delay so the initial VM swap comes in immediately, subVM comes right after
|
||||
.DelayInitial(TimeSpan.FromMilliseconds(50), RxApp.MainThreadScheduler)
|
||||
.Select<ModManager, ISubCompilerVM>(type =>
|
||||
@ -71,17 +71,17 @@ namespace Wabbajack
|
||||
pair.Previous?.Unload();
|
||||
})
|
||||
.Select(p => p.Current)
|
||||
.ToProperty(this, nameof(this.Compiler));
|
||||
.ToProperty(this, nameof(Compiler));
|
||||
|
||||
// Let sub VM determine what settings we're displaying and when
|
||||
this._CurrentModlistSettings = this.WhenAny(x => x.Compiler.ModlistSettings)
|
||||
.ToProperty(this, nameof(this.CurrentModlistSettings));
|
||||
_CurrentModlistSettings = this.WhenAny(x => x.Compiler.ModlistSettings)
|
||||
.ToProperty(this, nameof(CurrentModlistSettings));
|
||||
|
||||
// Let sub VM determine what progress we're seeing
|
||||
this._CurrentStatusTracker = this.WhenAny(x => x.Compiler.StatusTracker)
|
||||
.ToProperty(this, nameof(this.CurrentStatusTracker));
|
||||
_CurrentStatusTracker = this.WhenAny(x => x.Compiler.StatusTracker)
|
||||
.ToProperty(this, nameof(CurrentStatusTracker));
|
||||
|
||||
this._Image = this.WhenAny(x => x.CurrentModlistSettings.ImagePath.TargetPath)
|
||||
_Image = this.WhenAny(x => x.CurrentModlistSettings.ImagePath.TargetPath)
|
||||
// Throttle so that it only loads image after any sets of swaps have completed
|
||||
.Throttle(TimeSpan.FromMilliseconds(50), RxApp.MainThreadScheduler)
|
||||
.DistinctUntilChanged()
|
||||
@ -94,12 +94,12 @@ namespace Wabbajack
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.ToProperty(this, nameof(this.Image));
|
||||
.ToProperty(this, nameof(Image));
|
||||
|
||||
this._Compiling = this.WhenAny(x => x.Compiler.ActiveCompilation)
|
||||
_Compiling = this.WhenAny(x => x.Compiler.ActiveCompilation)
|
||||
.Select(compilation => compilation != null)
|
||||
.ObserveOnGuiThread()
|
||||
.ToProperty(this, nameof(this.Compiling));
|
||||
.ToProperty(this, nameof(Compiling));
|
||||
|
||||
// Compile progress updates and populate ObservableCollection
|
||||
var subscription = this.WhenAny(x => x.Compiler.ActiveCompilation)
|
||||
@ -110,9 +110,9 @@ namespace Wabbajack
|
||||
.EnsureUniqueChanges()
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Sort(SortExpressionComparer<CPUStatus>.Ascending(s => s.ID), SortOptimisations.ComparesImmutableValuesOnly)
|
||||
.Bind(this.MWVM.StatusList)
|
||||
.Bind(MWVM.StatusList)
|
||||
.Subscribe()
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
.DisposeWith(CompositeDisposable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,20 +37,20 @@ namespace Wabbajack
|
||||
|
||||
public MO2CompilerVM(CompilerVM parent)
|
||||
{
|
||||
this.ModlistLocation = new FilePickerVM()
|
||||
ModlistLocation = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.On,
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
PromptTitle = "Select Modlist"
|
||||
};
|
||||
this.DownloadLocation = new FilePickerVM()
|
||||
DownloadLocation = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.On,
|
||||
PathType = FilePickerVM.PathTypeOptions.Folder,
|
||||
PromptTitle = "Select Download Location",
|
||||
};
|
||||
|
||||
this._Mo2Folder = this.WhenAny(x => x.ModlistLocation.TargetPath)
|
||||
_Mo2Folder = this.WhenAny(x => x.ModlistLocation.TargetPath)
|
||||
.Select(loc =>
|
||||
{
|
||||
try
|
||||
@ -63,8 +63,8 @@ namespace Wabbajack
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.ToProperty(this, nameof(this.Mo2Folder));
|
||||
this._MOProfile = this.WhenAny(x => x.ModlistLocation.TargetPath)
|
||||
.ToProperty(this, nameof(Mo2Folder));
|
||||
_MOProfile = this.WhenAny(x => x.ModlistLocation.TargetPath)
|
||||
.Select(loc =>
|
||||
{
|
||||
try
|
||||
@ -77,10 +77,10 @@ namespace Wabbajack
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.ToProperty(this, nameof(this.MOProfile));
|
||||
.ToProperty(this, nameof(MOProfile));
|
||||
|
||||
// Wire missing Mo2Folder to signal error state for Modlist Location
|
||||
this.ModlistLocation.AdditionalError = this.WhenAny(x => x.Mo2Folder)
|
||||
ModlistLocation.AdditionalError = this.WhenAny(x => x.Mo2Folder)
|
||||
.Select<string, IErrorResponse>(moFolder =>
|
||||
{
|
||||
if (Directory.Exists(moFolder)) return ErrorResponse.Success;
|
||||
@ -88,7 +88,7 @@ namespace Wabbajack
|
||||
});
|
||||
|
||||
// Wire start command
|
||||
this.BeginCommand = ReactiveCommand.CreateFromTask(
|
||||
BeginCommand = ReactiveCommand.CreateFromTask(
|
||||
canExecute: Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModlistLocation.InError),
|
||||
this.WhenAny(x => x.DownloadLocation.InError),
|
||||
@ -98,15 +98,15 @@ namespace Wabbajack
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ActiveCompilation = new MO2Compiler(this.Mo2Folder)
|
||||
ActiveCompilation = new MO2Compiler(Mo2Folder)
|
||||
{
|
||||
MO2Profile = this.MOProfile,
|
||||
ModListName = this.ModlistSettings.ModListName,
|
||||
ModListAuthor = this.ModlistSettings.AuthorText,
|
||||
ModListDescription = this.ModlistSettings.Description,
|
||||
ModListImage = this.ModlistSettings.ImagePath.TargetPath,
|
||||
ModListWebsite = this.ModlistSettings.Website,
|
||||
ModListReadme = this.ModlistSettings.ReadMeText.TargetPath,
|
||||
MO2Profile = MOProfile,
|
||||
ModListName = ModlistSettings.ModListName,
|
||||
ModListAuthor = ModlistSettings.AuthorText,
|
||||
ModListDescription = ModlistSettings.Description,
|
||||
ModListImage = ModlistSettings.ImagePath.TargetPath,
|
||||
ModListWebsite = ModlistSettings.Website,
|
||||
ModListReadme = ModlistSettings.ReadMeText.TargetPath,
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -118,7 +118,7 @@ namespace Wabbajack
|
||||
|
||||
try
|
||||
{
|
||||
await this.ActiveCompilation.Begin();
|
||||
await ActiveCompilation.Begin();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -127,26 +127,26 @@ namespace Wabbajack
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.StatusTracker = null;
|
||||
this.ActiveCompilation.Dispose();
|
||||
this.ActiveCompilation = null;
|
||||
StatusTracker = null;
|
||||
ActiveCompilation.Dispose();
|
||||
ActiveCompilation = null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Load settings
|
||||
this.settings = parent.MWVM.Settings.Compiler.MO2Compilation;
|
||||
this.ModlistLocation.TargetPath = settings.LastCompiledProfileLocation;
|
||||
settings = parent.MWVM.Settings.Compiler.MO2Compilation;
|
||||
ModlistLocation.TargetPath = settings.LastCompiledProfileLocation;
|
||||
if (!string.IsNullOrWhiteSpace(settings.DownloadLocation))
|
||||
{
|
||||
this.DownloadLocation.TargetPath = settings.DownloadLocation;
|
||||
DownloadLocation.TargetPath = settings.DownloadLocation;
|
||||
}
|
||||
parent.MWVM.Settings.SaveSignal
|
||||
.Subscribe(_ => Unload())
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Load custom modlist settings per MO2 profile
|
||||
this._ModlistSettings = Observable.CombineLatest(
|
||||
_ModlistSettings = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModlistLocation.ErrorState),
|
||||
this.WhenAny(x => x.ModlistLocation.TargetPath),
|
||||
resultSelector: (State, Path) => (State, Path))
|
||||
@ -158,7 +158,7 @@ namespace Wabbajack
|
||||
var modlistSettings = settings.ModlistSettings.TryCreate(u.Path);
|
||||
return new ModlistSettingsEditorVM(modlistSettings)
|
||||
{
|
||||
ModListName = this.MOProfile
|
||||
ModListName = MOProfile
|
||||
};
|
||||
})
|
||||
// Interject and save old while loading new
|
||||
@ -171,7 +171,7 @@ namespace Wabbajack
|
||||
.Select(x => x.Current)
|
||||
// Save to property
|
||||
.ObserveOnGuiThread()
|
||||
.ToProperty(this, nameof(this.ModlistSettings));
|
||||
.ToProperty(this, nameof(ModlistSettings));
|
||||
|
||||
// If Mo2 folder changes and download location is empty, set it for convenience
|
||||
this.WhenAny(x => x.Mo2Folder)
|
||||
@ -184,22 +184,22 @@ namespace Wabbajack
|
||||
{
|
||||
try
|
||||
{
|
||||
var tmp_compiler = new MO2Compiler(this.Mo2Folder);
|
||||
this.DownloadLocation.TargetPath = tmp_compiler.MO2DownloadsFolder;
|
||||
var tmp_compiler = new MO2Compiler(Mo2Folder);
|
||||
DownloadLocation.TargetPath = tmp_compiler.MO2DownloadsFolder;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Log($"Error setting default download location {ex}");
|
||||
}
|
||||
})
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
.DisposeWith(CompositeDisposable);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
settings.DownloadLocation = this.DownloadLocation.TargetPath;
|
||||
settings.LastCompiledProfileLocation = this.ModlistLocation.TargetPath;
|
||||
this.ModlistSettings?.Save();
|
||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||
settings.LastCompiledProfileLocation = ModlistLocation.TargetPath;
|
||||
ModlistSettings?.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace Wabbajack
|
||||
public ModlistSettingsEditorVM(CompilationModlistSettings settings)
|
||||
{
|
||||
this.settings = settings;
|
||||
this.ImagePath = new FilePickerVM()
|
||||
ImagePath = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.IfNotEmpty,
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
@ -36,7 +36,7 @@ namespace Wabbajack
|
||||
new CommonFileDialogFilter("Banner image", "*.png")
|
||||
}
|
||||
};
|
||||
this.ReadMeText = new FilePickerVM()
|
||||
ReadMeText = new FilePickerVM()
|
||||
{
|
||||
PathType = FilePickerVM.PathTypeOptions.File,
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.IfNotEmpty,
|
||||
@ -45,25 +45,25 @@ namespace Wabbajack
|
||||
|
||||
public void Init()
|
||||
{
|
||||
this.AuthorText = settings.Author;
|
||||
AuthorText = settings.Author;
|
||||
if (!string.IsNullOrWhiteSpace(settings.ModListName))
|
||||
{
|
||||
this.ModListName = settings.ModListName;
|
||||
ModListName = settings.ModListName;
|
||||
}
|
||||
this.Description = settings.Description;
|
||||
this.ReadMeText.TargetPath = settings.Readme;
|
||||
this.ImagePath.TargetPath = settings.SplashScreen;
|
||||
this.Website = settings.Website;
|
||||
Description = settings.Description;
|
||||
ReadMeText.TargetPath = settings.Readme;
|
||||
ImagePath.TargetPath = settings.SplashScreen;
|
||||
Website = settings.Website;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
settings.Author = this.AuthorText;
|
||||
settings.ModListName = this.ModListName;
|
||||
settings.Description = this.Description;
|
||||
settings.Readme = this.ReadMeText.TargetPath;
|
||||
settings.SplashScreen = this.ImagePath.TargetPath;
|
||||
settings.Website = this.Website;
|
||||
settings.Author = AuthorText;
|
||||
settings.ModListName = ModListName;
|
||||
settings.Description = Description;
|
||||
settings.Readme = ReadMeText.TargetPath;
|
||||
settings.SplashScreen = ImagePath.TargetPath;
|
||||
settings.Website = Website;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace Wabbajack
|
||||
{
|
||||
try
|
||||
{
|
||||
this.ActiveCompilation = new VortexCompiler(
|
||||
ActiveCompilation = new VortexCompiler(
|
||||
SelectedGame.Game,
|
||||
GameLocation.TargetPath,
|
||||
VortexCompiler.TypicalVortexFolder(),
|
||||
@ -109,7 +109,7 @@ namespace Wabbajack
|
||||
{
|
||||
try
|
||||
{
|
||||
await this.ActiveCompilation.Begin();
|
||||
await ActiveCompilation.Begin();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -118,9 +118,9 @@ namespace Wabbajack
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.StatusTracker = null;
|
||||
this.ActiveCompilation.Dispose();
|
||||
this.ActiveCompilation = null;
|
||||
StatusTracker = null;
|
||||
ActiveCompilation.Dispose();
|
||||
ActiveCompilation = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -169,7 +169,7 @@ namespace Wabbajack
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Load custom ModList settings when game type changes
|
||||
this._modListSettings = this.WhenAny(x => x.SelectedGame)
|
||||
_modListSettings = this.WhenAny(x => x.SelectedGame)
|
||||
.Select(game =>
|
||||
{
|
||||
var gameSettings = _settings.ModlistSettings.TryCreate(game.Game);
|
||||
|
@ -64,8 +64,8 @@ namespace Wabbajack
|
||||
|
||||
public FilePickerVM(object parentVM = null)
|
||||
{
|
||||
this.Parent = parentVM;
|
||||
this.SetTargetPathCommand = ConstructTypicalPickerCommand();
|
||||
Parent = parentVM;
|
||||
SetTargetPathCommand = ConstructTypicalPickerCommand();
|
||||
|
||||
// Check that file exists
|
||||
|
||||
@ -81,7 +81,7 @@ namespace Wabbajack
|
||||
.Publish()
|
||||
.RefCount();
|
||||
|
||||
this._Exists = Observable.Interval(TimeSpan.FromSeconds(3))
|
||||
_Exists = Observable.Interval(TimeSpan.FromSeconds(3))
|
||||
// Only check exists on timer if desired
|
||||
.FilterSwitch(existsCheckTuple
|
||||
.Select(t =>
|
||||
@ -137,9 +137,9 @@ namespace Wabbajack
|
||||
.StartWith(false)
|
||||
.DistinctUntilChanged()
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.ToProperty(this, nameof(this.Exists));
|
||||
.ToProperty(this, nameof(Exists));
|
||||
|
||||
this._ErrorState = Observable.CombineLatest(
|
||||
_ErrorState = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Exists)
|
||||
.Select(exists => ErrorResponse.Create(successful: exists, exists ? default(string) : "Path does not exist")),
|
||||
this.WhenAny(x => x.AdditionalError)
|
||||
@ -150,15 +150,15 @@ namespace Wabbajack
|
||||
if (exist.Failed) return exist;
|
||||
return ErrorResponse.Convert(err);
|
||||
})
|
||||
.ToProperty(this, nameof(this.ErrorState));
|
||||
.ToProperty(this, nameof(ErrorState));
|
||||
|
||||
this._InError = this.WhenAny(x => x.ErrorState)
|
||||
_InError = this.WhenAny(x => x.ErrorState)
|
||||
.Select(x => !x.Succeeded)
|
||||
.ToProperty(this, nameof(this.InError));
|
||||
.ToProperty(this, nameof(InError));
|
||||
|
||||
// Doesn't derive from ErrorState, as we want to bubble non-empty tooltips,
|
||||
// which is slightly different logic
|
||||
this._ErrorTooltip = Observable.CombineLatest(
|
||||
_ErrorTooltip = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Exists)
|
||||
.Select(exists => exists ? default(string) : "Path does not exist"),
|
||||
this.WhenAny(x => x.AdditionalError)
|
||||
@ -169,7 +169,7 @@ namespace Wabbajack
|
||||
if (!string.IsNullOrWhiteSpace(exists)) return exists;
|
||||
return err?.Reason;
|
||||
})
|
||||
.ToProperty(this, nameof(this.ErrorTooltip));
|
||||
.ToProperty(this, nameof(ErrorTooltip));
|
||||
}
|
||||
|
||||
public ICommand ConstructTypicalPickerCommand()
|
||||
@ -178,22 +178,22 @@ namespace Wabbajack
|
||||
execute: () =>
|
||||
{
|
||||
string dirPath;
|
||||
if (File.Exists(this.TargetPath))
|
||||
if (File.Exists(TargetPath))
|
||||
{
|
||||
dirPath = System.IO.Path.GetDirectoryName(this.TargetPath);
|
||||
dirPath = Path.GetDirectoryName(TargetPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
dirPath = this.TargetPath;
|
||||
dirPath = TargetPath;
|
||||
}
|
||||
var dlg = new CommonOpenFileDialog
|
||||
{
|
||||
Title = this.PromptTitle,
|
||||
IsFolderPicker = this.PathType == PathTypeOptions.Folder,
|
||||
InitialDirectory = this.TargetPath,
|
||||
Title = PromptTitle,
|
||||
IsFolderPicker = PathType == PathTypeOptions.Folder,
|
||||
InitialDirectory = TargetPath,
|
||||
AddToMostRecentlyUsedList = false,
|
||||
AllowNonFileSystemItems = false,
|
||||
DefaultDirectory = this.TargetPath,
|
||||
DefaultDirectory = TargetPath,
|
||||
EnsureFileExists = true,
|
||||
EnsurePathExists = true,
|
||||
EnsureReadOnly = false,
|
||||
@ -201,12 +201,12 @@ namespace Wabbajack
|
||||
Multiselect = false,
|
||||
ShowPlacesList = true,
|
||||
};
|
||||
foreach (var filter in this.Filters)
|
||||
foreach (var filter in Filters)
|
||||
{
|
||||
dlg.Filters.Add(filter);
|
||||
}
|
||||
if (dlg.ShowDialog() != CommonFileDialogResult.Ok) return;
|
||||
this.TargetPath = dlg.FileName;
|
||||
TargetPath = dlg.FileName;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ namespace Wabbajack
|
||||
|
||||
public GameVM(Game game)
|
||||
{
|
||||
this.Game = game;
|
||||
this.DisplayName = game.ToDescriptionString();
|
||||
Game = game;
|
||||
DisplayName = game.ToDescriptionString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,57 +96,57 @@ namespace Wabbajack
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
this.MWVM = mainWindowVM;
|
||||
this.ModListPath = source;
|
||||
MWVM = mainWindowVM;
|
||||
ModListPath = source;
|
||||
|
||||
this.Location = new FilePickerVM()
|
||||
Location = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.Off,
|
||||
PathType = FilePickerVM.PathTypeOptions.Folder,
|
||||
PromptTitle = "Select Installation Directory",
|
||||
};
|
||||
this.Location.AdditionalError = this.WhenAny(x => x.Location.TargetPath)
|
||||
Location.AdditionalError = this.WhenAny(x => x.Location.TargetPath)
|
||||
.Select(x => Utils.IsDirectoryPathValid(x));
|
||||
this.DownloadLocation = new FilePickerVM()
|
||||
DownloadLocation = new FilePickerVM()
|
||||
{
|
||||
ExistCheckOption = FilePickerVM.ExistCheckOptions.Off,
|
||||
PathType = FilePickerVM.PathTypeOptions.Folder,
|
||||
PromptTitle = "Select a location for MO2 downloads",
|
||||
};
|
||||
this.DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath)
|
||||
DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath)
|
||||
.Select(x => Utils.IsDirectoryPathValid(x));
|
||||
|
||||
// Load settings
|
||||
ModlistInstallationSettings settings = this.MWVM.Settings.Installer.ModlistSettings.TryCreate(source);
|
||||
this.Location.TargetPath = settings.InstallationLocation;
|
||||
this.DownloadLocation.TargetPath = settings.DownloadLocation;
|
||||
this.MWVM.Settings.SaveSignal
|
||||
ModlistInstallationSettings settings = MWVM.Settings.Installer.ModlistSettings.TryCreate(source);
|
||||
Location.TargetPath = settings.InstallationLocation;
|
||||
DownloadLocation.TargetPath = settings.DownloadLocation;
|
||||
MWVM.Settings.SaveSignal
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
settings.InstallationLocation = this.Location.TargetPath;
|
||||
settings.DownloadLocation = this.DownloadLocation.TargetPath;
|
||||
settings.InstallationLocation = Location.TargetPath;
|
||||
settings.DownloadLocation = DownloadLocation.TargetPath;
|
||||
})
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
this._ModList = this.WhenAny(x => x.ModListPath)
|
||||
_ModList = this.WhenAny(x => x.ModListPath)
|
||||
.ObserveOn(RxApp.TaskpoolScheduler)
|
||||
.Select(modListPath =>
|
||||
{
|
||||
if (modListPath == null) return default(ModListVM);
|
||||
var modList = MO2Installer.LoadFromFile(modListPath);
|
||||
var modList = AInstaller.LoadFromFile(modListPath);
|
||||
if (modList == null)
|
||||
{
|
||||
MessageBox.Show("Invalid Modlist, or file not found.", "Invalid Modlist", MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
this.MWVM.MainWindow.ExitWhenClosing = false;
|
||||
MWVM.MainWindow.ExitWhenClosing = false;
|
||||
var window = new ModeSelectionWindow
|
||||
{
|
||||
ShowActivated = true
|
||||
};
|
||||
window.Show();
|
||||
this.MWVM.MainWindow.Close();
|
||||
MWVM.MainWindow.Close();
|
||||
});
|
||||
return default(ModListVM);
|
||||
}
|
||||
@ -154,11 +154,11 @@ namespace Wabbajack
|
||||
})
|
||||
.ObserveOnGuiThread()
|
||||
.StartWith(default(ModListVM))
|
||||
.ToProperty(this, nameof(this.ModList));
|
||||
this._HTMLReport = this.WhenAny(x => x.ModList)
|
||||
.ToProperty(this, nameof(ModList));
|
||||
_HTMLReport = this.WhenAny(x => x.ModList)
|
||||
.Select(modList => modList?.ReportHTML)
|
||||
.ToProperty(this, nameof(this.HTMLReport));
|
||||
this._ProgressPercent = Observable.CombineLatest(
|
||||
.ToProperty(this, nameof(HTMLReport));
|
||||
_ProgressPercent = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Installing),
|
||||
this.WhenAny(x => x.InstallingMode),
|
||||
resultSelector: (installing, mode) => !installing && mode)
|
||||
@ -166,13 +166,13 @@ namespace Wabbajack
|
||||
// Disable for now, until more reliable
|
||||
//this.WhenAny(x => x.MWVM.QueueProgress)
|
||||
// .Select(i => i / 100f)
|
||||
.ToProperty(this, nameof(this.ProgressPercent));
|
||||
.ToProperty(this, nameof(ProgressPercent));
|
||||
|
||||
this.Slideshow = new SlideShow(this);
|
||||
Slideshow = new SlideShow(this);
|
||||
|
||||
// Set display items to modlist if configuring or complete,
|
||||
// or to the current slideshow data if installing
|
||||
this._Image = Observable.CombineLatest(
|
||||
_Image = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModList)
|
||||
.SelectMany(x => x?.ImageObservable ?? Observable.Empty<BitmapImage>())
|
||||
.NotNull()
|
||||
@ -182,41 +182,41 @@ namespace Wabbajack
|
||||
this.WhenAny(x => x.Installing),
|
||||
resultSelector: (modList, slideshow, installing) => installing ? slideshow : modList)
|
||||
.Select<BitmapImage, ImageSource>(x => x)
|
||||
.ToProperty(this, nameof(this.Image));
|
||||
this._TitleText = Observable.CombineLatest(
|
||||
.ToProperty(this, nameof(Image));
|
||||
_TitleText = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModList.Name),
|
||||
this.WhenAny(x => x.Slideshow.TargetMod.ModName)
|
||||
.StartWith(default(string)),
|
||||
this.WhenAny(x => x.Installing),
|
||||
resultSelector: (modList, mod, installing) => installing ? mod : modList)
|
||||
.ToProperty(this, nameof(this.TitleText));
|
||||
this._AuthorText = Observable.CombineLatest(
|
||||
.ToProperty(this, nameof(TitleText));
|
||||
_AuthorText = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModList.Author),
|
||||
this.WhenAny(x => x.Slideshow.TargetMod.ModAuthor)
|
||||
.StartWith(default(string)),
|
||||
this.WhenAny(x => x.Installing),
|
||||
resultSelector: (modList, mod, installing) => installing ? mod : modList)
|
||||
.ToProperty(this, nameof(this.AuthorText));
|
||||
this._Description = Observable.CombineLatest(
|
||||
.ToProperty(this, nameof(AuthorText));
|
||||
_Description = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.ModList.Description),
|
||||
this.WhenAny(x => x.Slideshow.TargetMod.ModDescription)
|
||||
.StartWith(default(string)),
|
||||
this.WhenAny(x => x.Installing),
|
||||
resultSelector: (modList, mod, installing) => installing ? mod : modList)
|
||||
.ToProperty(this, nameof(this.Description));
|
||||
this._ModListName = this.WhenAny(x => x.ModList)
|
||||
.ToProperty(this, nameof(Description));
|
||||
_ModListName = this.WhenAny(x => x.ModList)
|
||||
.Select(x => x?.Name)
|
||||
.ToProperty(this, nameof(this.ModListName));
|
||||
.ToProperty(this, nameof(ModListName));
|
||||
|
||||
// Define commands
|
||||
this.ShowReportCommand = ReactiveCommand.Create(ShowReport);
|
||||
this.OpenReadmeCommand = ReactiveCommand.Create(
|
||||
execute: this.OpenReadmeWindow,
|
||||
ShowReportCommand = ReactiveCommand.Create(ShowReport);
|
||||
OpenReadmeCommand = ReactiveCommand.Create(
|
||||
execute: OpenReadmeWindow,
|
||||
canExecute: this.WhenAny(x => x.ModList)
|
||||
.Select(modList => !string.IsNullOrEmpty(modList?.Readme))
|
||||
.ObserveOnGuiThread());
|
||||
this.BeginCommand = ReactiveCommand.Create(
|
||||
execute: this.ExecuteBegin,
|
||||
BeginCommand = ReactiveCommand.Create(
|
||||
execute: ExecuteBegin,
|
||||
canExecute: Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Installing),
|
||||
this.WhenAny(x => x.Location.InError),
|
||||
@ -227,8 +227,8 @@ namespace Wabbajack
|
||||
return !loc && !download;
|
||||
})
|
||||
.ObserveOnGuiThread());
|
||||
this.VisitWebsiteCommand = ReactiveCommand.Create(
|
||||
execute: () => Process.Start(this.ModList.Website),
|
||||
VisitWebsiteCommand = ReactiveCommand.Create(
|
||||
execute: () => Process.Start(ModList.Website),
|
||||
canExecute: this.WhenAny(x => x.ModList.Website)
|
||||
.Select(x => x?.StartsWith("https://") ?? false)
|
||||
.ObserveOnGuiThread());
|
||||
@ -238,14 +238,14 @@ namespace Wabbajack
|
||||
.Skip(1) // Don't do it initially
|
||||
.Subscribe(installPath =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.DownloadLocation.TargetPath))
|
||||
if (string.IsNullOrWhiteSpace(DownloadLocation.TargetPath))
|
||||
{
|
||||
this.DownloadLocation.TargetPath = Path.Combine(installPath, "downloads");
|
||||
DownloadLocation.TargetPath = Path.Combine(installPath, "downloads");
|
||||
}
|
||||
})
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
this._ProgressTitle = Observable.CombineLatest(
|
||||
_ProgressTitle = Observable.CombineLatest(
|
||||
this.WhenAny(x => x.Installing),
|
||||
this.WhenAny(x => x.InstallingMode),
|
||||
resultSelector: (installing, mode) =>
|
||||
@ -253,7 +253,7 @@ namespace Wabbajack
|
||||
if (!installing) return "Configuring";
|
||||
return mode ? "Installing" : "Installed";
|
||||
})
|
||||
.ToProperty(this, nameof(this.ProgressTitle));
|
||||
.ToProperty(this, nameof(ProgressTitle));
|
||||
}
|
||||
|
||||
private void ShowReport()
|
||||
@ -265,15 +265,15 @@ namespace Wabbajack
|
||||
|
||||
private void OpenReadmeWindow()
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ModList.Readme)) return;
|
||||
using (var fs = new FileStream(this.ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
if (string.IsNullOrEmpty(ModList.Readme)) return;
|
||||
using (var fs = new FileStream(ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var entry = ar.GetEntry(this.ModList.Readme);
|
||||
var entry = ar.GetEntry(ModList.Readme);
|
||||
if (entry == null)
|
||||
{
|
||||
Utils.Log($"Tried to open a non-existant readme: {this.ModList.Readme}");
|
||||
Utils.Log($"Tried to open a non-existant readme: {ModList.Readme}");
|
||||
return;
|
||||
}
|
||||
using (var e = entry.Open())
|
||||
@ -283,7 +283,7 @@ namespace Wabbajack
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
using (var reader = new StreamReader(ms))
|
||||
{
|
||||
var viewer = new TextViewer(reader.ReadToEnd(), this.ModList.Name);
|
||||
var viewer = new TextViewer(reader.ReadToEnd(), ModList.Name);
|
||||
viewer.Show();
|
||||
}
|
||||
}
|
||||
@ -291,9 +291,9 @@ namespace Wabbajack
|
||||
|
||||
private void ExecuteBegin()
|
||||
{
|
||||
this.Installing = true;
|
||||
this.InstallingMode = true;
|
||||
var installer = new MO2Installer(this.ModListPath, this.ModList.SourceModList, Location.TargetPath)
|
||||
Installing = true;
|
||||
InstallingMode = true;
|
||||
var installer = new MO2Installer(ModListPath, ModList.SourceModList, Location.TargetPath)
|
||||
{
|
||||
DownloadFolder = DownloadLocation.TargetPath
|
||||
};
|
||||
@ -306,7 +306,7 @@ namespace Wabbajack
|
||||
.EnsureUniqueChanges()
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Sort(SortExpressionComparer<CPUStatus>.Ascending(s => s.ID), SortOptimisations.ComparesImmutableValuesOnly)
|
||||
.Bind(this.MWVM.StatusList)
|
||||
.Bind(MWVM.StatusList)
|
||||
.Subscribe();
|
||||
|
||||
Task.Run(async () =>
|
||||
@ -326,9 +326,9 @@ namespace Wabbajack
|
||||
{
|
||||
// Dispose of CPU tracking systems
|
||||
subscription.Dispose();
|
||||
this.MWVM.StatusList.Clear();
|
||||
MWVM.StatusList.Clear();
|
||||
|
||||
this.Installing = false;
|
||||
Installing = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using DynamicData;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
@ -36,11 +36,11 @@ namespace Wabbajack
|
||||
|
||||
public MainWindowVM(RunMode mode, string source, MainWindow mainWindow, MainSettings settings)
|
||||
{
|
||||
this.Mode = mode;
|
||||
this.MainWindow = mainWindow;
|
||||
this.Settings = settings;
|
||||
this._Installer = new Lazy<InstallerVM>(() => new InstallerVM(this, source));
|
||||
this._Compiler = new Lazy<CompilerVM>(() => new CompilerVM(this));
|
||||
Mode = mode;
|
||||
MainWindow = mainWindow;
|
||||
Settings = settings;
|
||||
_Installer = new Lazy<InstallerVM>(() => new InstallerVM(this, source));
|
||||
_Compiler = new Lazy<CompilerVM>(() => new CompilerVM(this));
|
||||
|
||||
// Set up logging
|
||||
Utils.LogMessages
|
||||
@ -51,27 +51,27 @@ namespace Wabbajack
|
||||
.FlattenBufferResult()
|
||||
.Top(5000)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Bind(this.Log)
|
||||
.Bind(Log)
|
||||
.Subscribe()
|
||||
.DisposeWith(this.CompositeDisposable);
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
// Wire mode to drive the active pane.
|
||||
// Note: This is currently made into a derivative property driven by mode,
|
||||
// but it can be easily changed into a normal property that can be set from anywhere if needed
|
||||
this._ActivePane = this.WhenAny(x => x.Mode)
|
||||
_ActivePane = this.WhenAny(x => x.Mode)
|
||||
.Select<RunMode, ViewModel>(m =>
|
||||
{
|
||||
switch (m)
|
||||
{
|
||||
case RunMode.Compile:
|
||||
return this._Compiler.Value;
|
||||
return _Compiler.Value;
|
||||
case RunMode.Install:
|
||||
return this._Installer.Value;
|
||||
return _Installer.Value;
|
||||
default:
|
||||
return default;
|
||||
}
|
||||
})
|
||||
.ToProperty(this, nameof(this.ActivePane));
|
||||
.ToProperty(this, nameof(ActivePane));
|
||||
|
||||
|
||||
// Compile progress updates and populate ObservableCollection
|
||||
|
@ -32,7 +32,7 @@ namespace Wabbajack
|
||||
ModListPath = modListPath;
|
||||
SourceModList = sourceModList;
|
||||
|
||||
ImageObservable = Observable.Return(this.ImageURL)
|
||||
ImageObservable = Observable.Return(ImageURL)
|
||||
.ObserveOn(RxApp.TaskpoolScheduler)
|
||||
.Select(url =>
|
||||
{
|
||||
@ -41,7 +41,7 @@ namespace Wabbajack
|
||||
if (!File.Exists(url)) return default(MemoryStream);
|
||||
if (string.IsNullOrWhiteSpace(sourceModList.Image)) return default(MemoryStream);
|
||||
if (sourceModList.Image.Length != 36) return default(MemoryStream);
|
||||
using (var fs = new FileStream(this.ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var fs = new FileStream(ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
{
|
||||
var ms = new MemoryStream();
|
||||
@ -55,7 +55,7 @@ namespace Wabbajack
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.LogToFile($"Exception while caching Mod List image {this.Name}\n{ex.ExceptionToString()}");
|
||||
Utils.LogToFile($"Exception while caching Mod List image {Name}\n{ex.ExceptionToString()}");
|
||||
return default(MemoryStream);
|
||||
}
|
||||
})
|
||||
@ -74,7 +74,7 @@ namespace Wabbajack
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.LogToFile($"Exception while caching Mod List image {this.Name}\n{ex.ExceptionToString()}");
|
||||
Utils.LogToFile($"Exception while caching Mod List image {Name}\n{ex.ExceptionToString()}");
|
||||
return default(BitmapImage);
|
||||
}
|
||||
})
|
||||
|
@ -35,14 +35,14 @@ namespace Wabbajack
|
||||
|
||||
public ModVM(NexusDownloader.State m)
|
||||
{
|
||||
this.ModName = NexusApiUtils.FixupSummary(m.ModName);
|
||||
this.ModID = m.ModID;
|
||||
this.ModDescription = NexusApiUtils.FixupSummary(m.Summary);
|
||||
this.ModAuthor = NexusApiUtils.FixupSummary(m.Author);
|
||||
this.IsNSFW = m.Adult;
|
||||
this.ModURL = m.NexusURL;
|
||||
this.ImageURL = m.SlideShowPic;
|
||||
this.ImageObservable = Observable.Return(this.ImageURL)
|
||||
ModName = NexusApiUtils.FixupSummary(m.ModName);
|
||||
ModID = m.ModID;
|
||||
ModDescription = NexusApiUtils.FixupSummary(m.Summary);
|
||||
ModAuthor = NexusApiUtils.FixupSummary(m.Author);
|
||||
IsNSFW = m.Adult;
|
||||
ModURL = m.NexusURL;
|
||||
ImageURL = m.SlideShowPic;
|
||||
ImageObservable = Observable.Return(ImageURL)
|
||||
.ObserveOn(RxApp.TaskpoolScheduler)
|
||||
.SelectTask(async url =>
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace Wabbajack
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.LogToFile($"Exception while caching slide {this.ModName} ({this.ModID})\n{ex.ExceptionToString()}");
|
||||
Utils.LogToFile($"Exception while caching slide {ModName} ({ModID})\n{ex.ExceptionToString()}");
|
||||
return default(MemoryStream);
|
||||
}
|
||||
})
|
||||
@ -79,7 +79,7 @@ namespace Wabbajack
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.LogToFile($"Exception while caching slide {this.ModName} ({this.ModID})\n{ex.ExceptionToString()}");
|
||||
Utils.LogToFile($"Exception while caching slide {ModName} ({ModID})\n{ex.ExceptionToString()}");
|
||||
return default(BitmapImage);
|
||||
}
|
||||
finally
|
||||
|
@ -22,9 +22,9 @@ namespace Wabbajack.UI
|
||||
|
||||
public ModeSelectionWindowVM()
|
||||
{
|
||||
this._CanInstall = this.WhenAny(x => x.SelectedModList)
|
||||
_CanInstall = this.WhenAny(x => x.SelectedModList)
|
||||
.Select(x => x != null)
|
||||
.ToProperty(this, nameof(this.CanInstall));
|
||||
.ToProperty(this, nameof(CanInstall));
|
||||
}
|
||||
|
||||
internal string Download()
|
||||
|
@ -1,4 +1,4 @@
|
||||
using DynamicData;
|
||||
using DynamicData;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System;
|
||||
@ -35,20 +35,20 @@ namespace Wabbajack
|
||||
|
||||
public SlideShow(InstallerVM appState)
|
||||
{
|
||||
this.Installer = appState;
|
||||
Installer = appState;
|
||||
|
||||
// Wire target slideshow index
|
||||
var intervalSeconds = 10;
|
||||
// Compile all the sources that trigger a slideshow update, any of which trigger a counter update
|
||||
var selectedIndex = Observable.Merge(
|
||||
// If user requests one manually
|
||||
this.SlideShowNextItemCommand.StartingExecution(),
|
||||
SlideShowNextItemCommand.StartingExecution(),
|
||||
// If the natural timer fires
|
||||
Observable.Merge(
|
||||
// Start with an initial timer
|
||||
Observable.Return(Observable.Interval(TimeSpan.FromSeconds(intervalSeconds))),
|
||||
// but reset timer if user requests one
|
||||
this.SlideShowNextItemCommand.StartingExecution()
|
||||
SlideShowNextItemCommand.StartingExecution()
|
||||
.Select(_ => Observable.Interval(TimeSpan.FromSeconds(intervalSeconds))))
|
||||
// When a new timer comes in, swap to it
|
||||
.Switch()
|
||||
@ -84,34 +84,34 @@ namespace Wabbajack
|
||||
.OfType<NexusDownloader.State>()
|
||||
.Select(nexus => new ModVM(nexus))
|
||||
// Shuffle it
|
||||
.Shuffle(this._random)
|
||||
.Shuffle(_random)
|
||||
.AsObservableChangeSet(x => x.ModID);
|
||||
})
|
||||
// Switch to the new list after every modlist change
|
||||
.Switch()
|
||||
// Filter out any NSFW slides if we don't want them
|
||||
.AutoRefreshOnObservable(slide => this.WhenAny(x => x.ShowNSFW))
|
||||
.Filter(slide => !slide.IsNSFW || this.ShowNSFW)
|
||||
.Filter(slide => !slide.IsNSFW || ShowNSFW)
|
||||
.RefCount();
|
||||
|
||||
// Find target mod to display by combining dynamic list with currently desired index
|
||||
this._TargetMod = Observable.CombineLatest(
|
||||
_TargetMod = Observable.CombineLatest(
|
||||
modVMs.QueryWhenChanged(),
|
||||
selectedIndex,
|
||||
resultSelector: (query, selected) => query.Items.ElementAtOrDefault(selected % query.Count))
|
||||
.StartWith(default(ModVM))
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.ToProperty(this, nameof(this.TargetMod));
|
||||
.ToProperty(this, nameof(TargetMod));
|
||||
|
||||
// Mark interest and materialize image of target mod
|
||||
this._Image = this.WhenAny(x => x.TargetMod)
|
||||
_Image = this.WhenAny(x => x.TargetMod)
|
||||
// We want to Switch here, not SelectMany, as we want to hotswap to newest target without waiting on old ones
|
||||
.Select(x => x?.ImageObservable ?? Observable.Return(default(BitmapImage)))
|
||||
.Switch()
|
||||
.ToProperty(this, nameof(this.Image));
|
||||
.ToProperty(this, nameof(Image));
|
||||
|
||||
this.VisitNexusSiteCommand = ReactiveCommand.Create(
|
||||
execute: () => Process.Start(this.TargetMod.ModURL),
|
||||
VisitNexusSiteCommand = ReactiveCommand.Create(
|
||||
execute: () => Process.Start(TargetMod.ModURL),
|
||||
canExecute: this.WhenAny(x => x.TargetMod.ModURL)
|
||||
.Select(x => x?.StartsWith("https://") ?? false)
|
||||
.ObserveOnGuiThread());
|
||||
@ -126,4 +126,4 @@ namespace Wabbajack
|
||||
// so at the boundary of a page, the next image won't be cached. Need like a Page() /w an offset parameter, or something.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,17 +64,17 @@ namespace Wabbajack
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this._ShowAuthor = this.WhenAny(x => x.Author)
|
||||
_ShowAuthor = this.WhenAny(x => x.Author)
|
||||
.Select(x => !string.IsNullOrWhiteSpace(x))
|
||||
.ToProperty(this, nameof(this.ShowAuthor));
|
||||
.ToProperty(this, nameof(ShowAuthor));
|
||||
|
||||
this._ShowDescription = this.WhenAny(x => x.Description)
|
||||
_ShowDescription = this.WhenAny(x => x.Description)
|
||||
.Select(x => !string.IsNullOrWhiteSpace(x))
|
||||
.ToProperty(this, nameof(this.ShowDescription));
|
||||
.ToProperty(this, nameof(ShowDescription));
|
||||
|
||||
this._ShowTitle = this.WhenAny(x => x.Title)
|
||||
_ShowTitle = this.WhenAny(x => x.Title)
|
||||
.Select(x => !string.IsNullOrWhiteSpace(x))
|
||||
.ToProperty(this, nameof(this.ShowTitle));
|
||||
.ToProperty(this, nameof(ShowTitle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace Wabbajack
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.IsChecked = true;
|
||||
IsChecked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ namespace Wabbajack
|
||||
|
||||
if (args.Length != 3) return;
|
||||
var modlistPath = args[2];
|
||||
this._settings = MainSettings.LoadSettings();
|
||||
Initialize(RunMode.Install, modlistPath, this._settings);
|
||||
_settings = MainSettings.LoadSettings();
|
||||
Initialize(RunMode.Install, modlistPath, _settings);
|
||||
}
|
||||
|
||||
public MainWindow(RunMode mode, string source, MainSettings settings)
|
||||
@ -32,10 +32,10 @@ namespace Wabbajack
|
||||
private void Initialize(RunMode mode, string source, MainSettings settings)
|
||||
{
|
||||
InitializeComponent();
|
||||
this._settings = settings;
|
||||
_settings = settings;
|
||||
_mwvm = new MainWindowVM(mode, source, this, settings);
|
||||
Utils.Log($"Wabbajack Build - {ThisAssembly.Git.Sha}");
|
||||
this.DataContext = _mwvm;
|
||||
DataContext = _mwvm;
|
||||
}
|
||||
|
||||
internal bool ExitWhenClosing = true;
|
||||
@ -43,11 +43,11 @@ namespace Wabbajack
|
||||
private void Window_Closing(object sender, CancelEventArgs e)
|
||||
{
|
||||
_mwvm.Dispose();
|
||||
MainSettings.SaveSettings(this._settings);
|
||||
MainSettings.SaveSettings(_settings);
|
||||
if (ExitWhenClosing)
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ namespace Wabbajack
|
||||
{
|
||||
ShutdownOnClose = false;
|
||||
var window = new MainWindow(RunMode.Compile, null, settings);
|
||||
window.Left = this.Left;
|
||||
window.Top = this.Top;
|
||||
window.Left = Left;
|
||||
window.Top = Top;
|
||||
window.Show();
|
||||
Close();
|
||||
}
|
||||
@ -65,8 +65,8 @@ namespace Wabbajack
|
||||
ShutdownOnClose = false;
|
||||
settings.Installer.LastInstalledListLocation = Path.GetDirectoryName(file);
|
||||
var window = new MainWindow(RunMode.Install, file, settings);
|
||||
window.Left = this.Left;
|
||||
window.Top = this.Top;
|
||||
window.Left = Left;
|
||||
window.Top = Top;
|
||||
window.Show();
|
||||
Close();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace Wabbajack
|
||||
protected static void WireNotifyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (!(d is UserControlRx control)) return;
|
||||
if (object.Equals(e.OldValue, e.NewValue)) return;
|
||||
if (Equals(e.OldValue, e.NewValue)) return;
|
||||
control.RaisePropertyChanged(e.Property.Name);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user