Merge pull request #320 from Noggog/reimplement-readme-small-improvements

Reimplement readme small improvements
This commit is contained in:
Timothy Baldridge 2019-12-27 16:06:45 -08:00 committed by GitHub
commit 19889e450e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 66 additions and 28 deletions

View File

@ -95,10 +95,8 @@ namespace Wabbajack.Lib
ModList.Readme = $"readme{readme.Extension}"; ModList.Readme = $"readme{readme.Extension}";
} }
// DISABLED FOR THIS RELEASE ModList.ReadmeIsWebsite = ReadmeIsWebsite;
//ModList.ReadmeIsWebsite = ReadmeIsWebsite;
//ModList.ToJSON(Path.Combine(ModListOutputFolder, "modlist.json"));
ModList.ToCERAS(Path.Combine(ModListOutputFolder, "modlist"), CerasConfig.Config); ModList.ToCERAS(Path.Combine(ModListOutputFolder, "modlist"), CerasConfig.Config);
if (File.Exists(ModListOutputFile)) if (File.Exists(ModListOutputFile))

View File

@ -32,8 +32,7 @@ namespace Wabbajack.Lib
}, },
}; };
// DISABLED FOR THIS RELEASE Config.VersionTolerance.Mode = VersionToleranceMode.Standard;
//Config.VersionTolerance.Mode = VersionToleranceMode.Standard;
} }
} }
} }

View File

@ -119,8 +119,7 @@ namespace Wabbajack.Lib
/// <summary> /// <summary>
/// Whether readme is a website /// Whether readme is a website
/// </summary> /// </summary>
/// DISABLED FOR THIS RELEASE public bool ReadmeIsWebsite;
//public bool ReadmeIsWebsite;
} }
public class Directive public class Directive

View File

@ -1,4 +1,4 @@
using DynamicData; using DynamicData;
using Microsoft.WindowsAPICodePack.Dialogs; using Microsoft.WindowsAPICodePack.Dialogs;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
@ -80,7 +80,7 @@ namespace Wabbajack.Lib
this.WhenAny(x => x.TargetPath) this.WhenAny(x => x.TargetPath)
// Dont want to debounce the initial value, because we know it's null // Dont want to debounce the initial value, because we know it's null
.Skip(1) .Skip(1)
.Debounce(TimeSpan.FromMilliseconds(200)) .Debounce(TimeSpan.FromMilliseconds(200), RxApp.TaskpoolScheduler)
.StartWith(default(string)), .StartWith(default(string)),
resultSelector: (existsOption, type, path) => (ExistsOption: existsOption, Type: type, Path: path)) resultSelector: (existsOption, type, path) => (ExistsOption: existsOption, Type: type, Path: path))
.StartWith((ExistsOption: ExistCheckOption, Type: PathType, Path: TargetPath)) .StartWith((ExistsOption: ExistCheckOption, Type: PathType, Path: TargetPath))
@ -107,7 +107,7 @@ namespace Wabbajack.Lib
.Replay(1) .Replay(1)
.RefCount(); .RefCount();
_exists = Observable.Interval(TimeSpan.FromSeconds(3)) _exists = Observable.Interval(TimeSpan.FromSeconds(3), RxApp.TaskpoolScheduler)
// Only check exists on timer if desired // Only check exists on timer if desired
.FilterSwitch(doExistsCheck) .FilterSwitch(doExistsCheck)
.Unit() .Unit()
@ -119,6 +119,7 @@ namespace Wabbajack.Lib
.CombineLatest(existsCheckTuple, .CombineLatest(existsCheckTuple,
resultSelector: (_, tuple) => tuple) resultSelector: (_, tuple) => tuple)
// Refresh exists // Refresh exists
.ObserveOn(RxApp.TaskpoolScheduler)
.Select(t => .Select(t =>
{ {
switch (t.ExistsOption) switch (t.ExistsOption)
@ -146,7 +147,7 @@ namespace Wabbajack.Lib
} }
}) })
.DistinctUntilChanged() .DistinctUntilChanged()
.ObserveOn(RxApp.MainThreadScheduler) .ObserveOnGuiThread()
.StartWith(false) .StartWith(false)
.ToProperty(this, nameof(Exists)); .ToProperty(this, nameof(Exists));
@ -217,6 +218,7 @@ namespace Wabbajack.Lib
if (filter.Failed) return filter; if (filter.Failed) return filter;
return ErrorResponse.Convert(err); return ErrorResponse.Convert(err);
}) })
.ObserveOnGuiThread()
.ToProperty(this, nameof(ErrorState)); .ToProperty(this, nameof(ErrorState));
_inError = this.WhenAny(x => x.ErrorState) _inError = this.WhenAny(x => x.ErrorState)
@ -242,6 +244,7 @@ namespace Wabbajack.Lib
if (!string.IsNullOrWhiteSpace(filters)) return filters; if (!string.IsNullOrWhiteSpace(filters)) return filters;
return err?.Reason; return err?.Reason;
}) })
.ObserveOnGuiThread()
.ToProperty(this, nameof(ErrorTooltip)); .ToProperty(this, nameof(ErrorTooltip));
} }

View File

@ -60,6 +60,9 @@ namespace Wabbajack
[Reactive] [Reactive]
public ErrorResponse? Completed { get; set; } public ErrorResponse? Completed { get; set; }
private readonly ObservableAsPropertyHelper<string> _progressTitle;
public string ProgressTitle => _progressTitle.Value;
public CompilerVM(MainWindowVM mainWindowVM) public CompilerVM(MainWindowVM mainWindowVM)
{ {
MWVM = mainWindowVM; MWVM = mainWindowVM;
@ -114,8 +117,9 @@ namespace Wabbajack
_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 so that it only loads image after any sets of swaps have completed
.Throttle(TimeSpan.FromMilliseconds(50), RxApp.MainThreadScheduler) .Throttle(TimeSpan.FromMilliseconds(50), RxApp.TaskpoolScheduler)
.DistinctUntilChanged() .DistinctUntilChanged()
.ObserveOn(RxApp.MainThreadScheduler)
.Select(path => .Select(path =>
{ {
if (string.IsNullOrWhiteSpace(path)) return UIUtils.BitmapImageFromResource("Resources/Wabba_Mouth_No_Text.png"); if (string.IsNullOrWhiteSpace(path)) return UIUtils.BitmapImageFromResource("Resources/Wabba_Mouth_No_Text.png");
@ -157,7 +161,7 @@ namespace Wabbajack
return ret; return ret;
}) })
.ToObservableChangeSet(x => x.Status.ID) .ToObservableChangeSet(x => x.Status.ID)
.Batch(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler) .Batch(TimeSpan.FromMilliseconds(50), RxApp.TaskpoolScheduler)
.EnsureUniqueChanges() .EnsureUniqueChanges()
.Filter(i => i.Status.IsWorking && i.Status.ID != WorkQueue.UnassignedCpuId) .Filter(i => i.Status.IsWorking && i.Status.ID != WorkQueue.UnassignedCpuId)
.ObserveOn(RxApp.MainThreadScheduler) .ObserveOn(RxApp.MainThreadScheduler)
@ -246,6 +250,22 @@ namespace Wabbajack
Process.Start("explorer.exe", OutputLocation.TargetPath); Process.Start("explorer.exe", OutputLocation.TargetPath);
} }
}); });
_progressTitle = Observable.CombineLatest(
this.WhenAny(x => x.Compiling),
this.WhenAny(x => x.StartedCompilation),
resultSelector: (compiling, started) =>
{
if (compiling)
{
return "Compiling";
}
else
{
return started ? "Compiled" : "Configuring";
}
})
.ToProperty(this, nameof(ProgressTitle));
} }
} }
} }

View File

@ -210,7 +210,7 @@ namespace Wabbajack
_image = Observable.CombineLatest( _image = Observable.CombineLatest(
this.WhenAny(x => x.ModList.Error), this.WhenAny(x => x.ModList.Error),
this.WhenAny(x => x.ModList) this.WhenAny(x => x.ModList)
.Select(x => x?.ImageObservable ?? Observable.Empty<BitmapImage>()) .Select(x => x?.ImageObservable ?? Observable.Return(WabbajackLogo))
.Switch() .Switch()
.StartWith(WabbajackLogo), .StartWith(WabbajackLogo),
this.WhenAny(x => x.Slideshow.Image) this.WhenAny(x => x.Slideshow.Image)
@ -228,21 +228,24 @@ namespace Wabbajack
.Select<BitmapImage, ImageSource>(x => x) .Select<BitmapImage, ImageSource>(x => x)
.ToProperty(this, nameof(Image)); .ToProperty(this, nameof(Image));
_titleText = Observable.CombineLatest( _titleText = Observable.CombineLatest(
this.WhenAny(x => x.ModList.Name), this.WhenAny(x => x.ModList)
.Select(modList => modList?.Name ?? string.Empty),
this.WhenAny(x => x.Slideshow.TargetMod.ModName) this.WhenAny(x => x.Slideshow.TargetMod.ModName)
.StartWith(default(string)), .StartWith(default(string)),
this.WhenAny(x => x.Installing), this.WhenAny(x => x.Installing),
resultSelector: (modList, mod, installing) => installing ? mod : modList) resultSelector: (modList, mod, installing) => installing ? mod : modList)
.ToProperty(this, nameof(TitleText)); .ToProperty(this, nameof(TitleText));
_authorText = Observable.CombineLatest( _authorText = Observable.CombineLatest(
this.WhenAny(x => x.ModList.Author), this.WhenAny(x => x.ModList)
.Select(modList => modList?.Author ?? string.Empty),
this.WhenAny(x => x.Slideshow.TargetMod.ModAuthor) this.WhenAny(x => x.Slideshow.TargetMod.ModAuthor)
.StartWith(default(string)), .StartWith(default(string)),
this.WhenAny(x => x.Installing), this.WhenAny(x => x.Installing),
resultSelector: (modList, mod, installing) => installing ? mod : modList) resultSelector: (modList, mod, installing) => installing ? mod : modList)
.ToProperty(this, nameof(AuthorText)); .ToProperty(this, nameof(AuthorText));
_description = Observable.CombineLatest( _description = Observable.CombineLatest(
this.WhenAny(x => x.ModList.Description), this.WhenAny(x => x.ModList)
.Select(modList => modList?.Description ?? string.Empty),
this.WhenAny(x => x.Slideshow.TargetMod.ModDescription) this.WhenAny(x => x.Slideshow.TargetMod.ModDescription)
.StartWith(default(string)), .StartWith(default(string)),
this.WhenAny(x => x.Installing), this.WhenAny(x => x.Installing),
@ -278,8 +281,14 @@ namespace Wabbajack
this.WhenAny(x => x.StartedInstallation), this.WhenAny(x => x.StartedInstallation),
resultSelector: (installing, started) => resultSelector: (installing, started) =>
{ {
if (!installing) return "Configuring"; if (installing)
return started ? "Installing" : "Installed"; {
return "Installing";
}
else
{
return started ? "Installed" : "Configuring";
}
}) })
.ToProperty(this, nameof(ProgressTitle)); .ToProperty(this, nameof(ProgressTitle));
@ -298,7 +307,7 @@ namespace Wabbajack
return ret; return ret;
}) })
.ToObservableChangeSet(x => x.Status.ID) .ToObservableChangeSet(x => x.Status.ID)
.Batch(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler) .Batch(TimeSpan.FromMilliseconds(50), RxApp.TaskpoolScheduler)
.EnsureUniqueChanges() .EnsureUniqueChanges()
.Filter(i => i.Status.IsWorking && i.Status.ID != WorkQueue.UnassignedCpuId) .Filter(i => i.Status.IsWorking && i.Status.ID != WorkQueue.UnassignedCpuId)
.ObserveOn(RxApp.MainThreadScheduler) .ObserveOn(RxApp.MainThreadScheduler)

View File

@ -59,7 +59,7 @@ namespace Wabbajack
this.WhenAny(x => x.Location.TargetPath), this.WhenAny(x => x.Location.TargetPath),
this.WhenAny(x => x.DownloadLocation.TargetPath), this.WhenAny(x => x.DownloadLocation.TargetPath),
resultSelector: (target, download) => (target, download)) resultSelector: (target, download) => (target, download))
.ObserveOn(RxApp.MainThreadScheduler) .ObserveOn(RxApp.TaskpoolScheduler)
.Select(i => MO2Installer.CheckValidInstallPath(i.target, i.download)) .Select(i => MO2Installer.CheckValidInstallPath(i.target, i.download))
.ObserveOnGuiThread(); .ObserveOnGuiThread();

View File

@ -40,11 +40,8 @@ namespace Wabbajack
public readonly UserInterventionHandlers UserInterventionHandlers; public readonly UserInterventionHandlers UserInterventionHandlers;
public readonly LoginManagerVM LoginManagerVM; public readonly LoginManagerVM LoginManagerVM;
public readonly List<ViewModel> NavigationTrail = new List<ViewModel>(); public readonly List<ViewModel> NavigationTrail = new List<ViewModel>();
public Dispatcher ViewDispatcher { get; set; }
public ICommand CopyVersionCommand { get; } public ICommand CopyVersionCommand { get; }
public ICommand ShowLoginManagerVM { get; } public ICommand ShowLoginManagerVM { get; }
@ -54,7 +51,6 @@ namespace Wabbajack
public MainWindowVM(MainWindow mainWindow, MainSettings settings) public MainWindowVM(MainWindow mainWindow, MainSettings settings)
{ {
MainWindow = mainWindow; MainWindow = mainWindow;
ViewDispatcher = MainWindow.Dispatcher;
Settings = settings; Settings = settings;
Installer = new Lazy<InstallerVM>(() => new InstallerVM(this)); Installer = new Lazy<InstallerVM>(() => new InstallerVM(this));
Compiler = new Lazy<CompilerVM>(() => new CompilerVM(this)); Compiler = new Lazy<CompilerVM>(() => new CompilerVM(this));

View File

@ -87,8 +87,7 @@ namespace Wabbajack
public void OpenReadmeWindow() public void OpenReadmeWindow()
{ {
if (string.IsNullOrEmpty(Readme)) return; if (string.IsNullOrEmpty(Readme)) return;
// DISABLED FOR THIS RELEASE if (SourceModList.ReadmeIsWebsite)
if (false) // SourceModList.ReadmeIsWebsite)
{ {
Process.Start(Readme); Process.Start(Readme);
} }

View File

@ -77,7 +77,7 @@
Grid.ColumnSpan="5" Grid.ColumnSpan="5"
OverhangShadow="True" OverhangShadow="True"
ProgressPercent="{Binding PercentCompleted}" ProgressPercent="{Binding PercentCompleted}"
StatePrefixTitle="Compiling" /> StatePrefixTitle="{Binding ProgressTitle}" />
<Button <Button
x:Name="BackButton" x:Name="BackButton"
Grid.Row="0" Grid.Row="0"

View File

@ -381,6 +381,21 @@
<local:VortexInstallerConfigView /> <local:VortexInstallerConfigView />
</DataTemplate> </DataTemplate>
</ContentPresenter.Resources> </ContentPresenter.Resources>
<ContentPresenter.Style>
<Style TargetType="ContentPresenter">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Content}" Value="{x:Null}">
<Setter Property="ContentPresenter.ContentTemplate">
<Setter.Value>
<DataTemplate>
<Rectangle Height="74" />
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentPresenter.Style>
</ContentPresenter> </ContentPresenter>
</Grid> </Grid>
<local:BeginButton <local:BeginButton