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}";
}
// 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);
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>
/// Whether readme is a website
/// </summary>
/// DISABLED FOR THIS RELEASE
//public bool ReadmeIsWebsite;
public bool ReadmeIsWebsite;
}
public class Directive

View File

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

View File

@ -60,6 +60,9 @@ namespace Wabbajack
[Reactive]
public ErrorResponse? Completed { get; set; }
private readonly ObservableAsPropertyHelper<string> _progressTitle;
public string ProgressTitle => _progressTitle.Value;
public CompilerVM(MainWindowVM mainWindowVM)
{
MWVM = mainWindowVM;
@ -114,8 +117,9 @@ namespace Wabbajack
_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)
.Throttle(TimeSpan.FromMilliseconds(50), RxApp.TaskpoolScheduler)
.DistinctUntilChanged()
.ObserveOn(RxApp.MainThreadScheduler)
.Select(path =>
{
if (string.IsNullOrWhiteSpace(path)) return UIUtils.BitmapImageFromResource("Resources/Wabba_Mouth_No_Text.png");
@ -157,7 +161,7 @@ namespace Wabbajack
return ret;
})
.ToObservableChangeSet(x => x.Status.ID)
.Batch(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler)
.Batch(TimeSpan.FromMilliseconds(50), RxApp.TaskpoolScheduler)
.EnsureUniqueChanges()
.Filter(i => i.Status.IsWorking && i.Status.ID != WorkQueue.UnassignedCpuId)
.ObserveOn(RxApp.MainThreadScheduler)
@ -246,6 +250,22 @@ namespace Wabbajack
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(
this.WhenAny(x => x.ModList.Error),
this.WhenAny(x => x.ModList)
.Select(x => x?.ImageObservable ?? Observable.Empty<BitmapImage>())
.Select(x => x?.ImageObservable ?? Observable.Return(WabbajackLogo))
.Switch()
.StartWith(WabbajackLogo),
this.WhenAny(x => x.Slideshow.Image)
@ -228,21 +228,24 @@ namespace Wabbajack
.Select<BitmapImage, ImageSource>(x => x)
.ToProperty(this, nameof(Image));
_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)
.StartWith(default(string)),
this.WhenAny(x => x.Installing),
resultSelector: (modList, mod, installing) => installing ? mod : modList)
.ToProperty(this, nameof(TitleText));
_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)
.StartWith(default(string)),
this.WhenAny(x => x.Installing),
resultSelector: (modList, mod, installing) => installing ? mod : modList)
.ToProperty(this, nameof(AuthorText));
_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)
.StartWith(default(string)),
this.WhenAny(x => x.Installing),
@ -278,8 +281,14 @@ namespace Wabbajack
this.WhenAny(x => x.StartedInstallation),
resultSelector: (installing, started) =>
{
if (!installing) return "Configuring";
return started ? "Installing" : "Installed";
if (installing)
{
return "Installing";
}
else
{
return started ? "Installed" : "Configuring";
}
})
.ToProperty(this, nameof(ProgressTitle));
@ -298,7 +307,7 @@ namespace Wabbajack
return ret;
})
.ToObservableChangeSet(x => x.Status.ID)
.Batch(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler)
.Batch(TimeSpan.FromMilliseconds(50), RxApp.TaskpoolScheduler)
.EnsureUniqueChanges()
.Filter(i => i.Status.IsWorking && i.Status.ID != WorkQueue.UnassignedCpuId)
.ObserveOn(RxApp.MainThreadScheduler)

View File

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

View File

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

View File

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

View File

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

View File

@ -381,6 +381,21 @@
<local:VortexInstallerConfigView />
</DataTemplate>
</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>
</Grid>
<local:BeginButton