NexusSite command moved to Slideshow

This commit is contained in:
Justin Swanson 2019-10-13 20:15:41 -05:00
parent 2f5b789d11
commit 8956fe6fd3
5 changed files with 16 additions and 26 deletions

View File

@ -66,7 +66,6 @@ namespace Wabbajack
public IReactiveCommand ChangeDownloadPathCommand { get; }
public IReactiveCommand BeginCommand { get; }
public IReactiveCommand ShowReportCommand { get; }
public IReactiveCommand VisitNexusSiteCommand { get; }
public IReactiveCommand OpenReadmeCommand { get; }
public IReactiveCommand OpenModListPropertiesCommand { get; }
@ -89,7 +88,6 @@ namespace Wabbajack
this.ChangePathCommand = ReactiveCommand.Create(ExecuteChangePath);
this.ChangeDownloadPathCommand = ReactiveCommand.Create(ExecuteChangeDownloadPath);
this.ShowReportCommand = ReactiveCommand.Create(ShowReport);
this.VisitNexusSiteCommand = ReactiveCommand.Create(VisitNexusSite);
this.OpenModListPropertiesCommand = ReactiveCommand.Create(
execute: OpenModListProperties,
canExecute: this.WhenAny(x => x.UIReady)
@ -104,15 +102,6 @@ namespace Wabbajack
canExecute: this.WhenAny(x => x.UIReady)
.ObserveOnGuiThread());
// Apply modlist properties when it changes
this.WhenAny(x => x.ModList)
.NotNull()
.Subscribe(modList =>
{
this._nexusSiteURL = modList.Website;
})
.DisposeWith(this.CompositeDisposable);
this.Slideshow = new SlideShow(this);
// Initialize work queue
@ -182,15 +171,6 @@ namespace Wabbajack
Process.Start(file);
}
public string _nexusSiteURL = null;
private void VisitNexusSite()
{
if (_nexusSiteURL != null && _nexusSiteURL.StartsWith("https://"))
{
Process.Start(_nexusSiteURL);
}
}
private ModlistPropertiesWindow modlistPropertiesWindow;
public string newImagePath;
public string readmePath;
@ -368,7 +348,7 @@ namespace Wabbajack
ModListAuthor = ChangedProperties ? this.Slideshow.AuthorName : null,
ModListDescription = ChangedProperties ? this.Slideshow.Summary : null,
ModListImage = ChangedProperties ? newImagePath : null,
ModListWebsite = ChangedProperties ? _nexusSiteURL : null,
ModListWebsite = ChangedProperties ? this.Slideshow.NexusSiteURL : null,
ModListReadme = ChangedProperties ? readmePath : null
};
var th = new Thread(() =>

View File

@ -30,8 +30,6 @@ namespace Wabbajack
Utils.SetLoggerFn(s => context.LogMsg(s));
Utils.SetStatusFn((msg, progress) => WorkQueue.Report(msg, progress));
_state._nexusSiteURL = "https://github.com/wabbajack-tools/wabbajack";
new Thread(() =>
{
if (mode == RunMode.Compile)

View File

@ -51,7 +51,7 @@ namespace Wabbajack
state.Slideshow.ModName = ModlistNameProperty.Text;
state.Slideshow.Summary = ModlistDescriptionProperty.Text;
state.Slideshow.AuthorName = ModlistAuthorProperty.Text;
state._nexusSiteURL = ModlistWebsiteProperty.Text;
state.Slideshow.NexusSiteURL = ModlistWebsiteProperty.Text;
state.readmePath = ModlistReadmeProperty.Text;
state.ChangedProperties = true;

View File

@ -1,6 +1,7 @@
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
@ -78,7 +79,11 @@ namespace Wabbajack
private string _Summary;
public string Summary { get => _Summary; set => this.RaiseAndSetIfChanged(ref _Summary, value); }
private string _NexusSiteURL = "https://github.com/wabbajack-tools/wabbajack";
public string NexusSiteURL { get => _NexusSiteURL; set => this.RaiseAndSetIfChanged(ref _NexusSiteURL, value); }
public IReactiveCommand SlideShowNextItemCommand { get; } = ReactiveCommand.Create(() => { });
public IReactiveCommand VisitNexusSiteCommand { get; }
public SlideShow(AppState appState)
{
@ -88,11 +93,18 @@ namespace Wabbajack
_random = new Random();
AppState = appState;
this.VisitNexusSiteCommand = ReactiveCommand.Create(
execute: () => Process.Start(this.NexusSiteURL),
canExecute: this.WhenAny(x => x.NexusSiteURL)
.Select(x => x?.StartsWith("https://") ?? false)
.ObserveOnGuiThread());
// Apply modlist properties when it changes
this.WhenAny(x => x.AppState.ModList)
.NotNull()
.Subscribe(modList =>
{
this.NexusSiteURL = modList.Website;
this.ModName = modList.Name;
this.AuthorName = modList.Author;
this.Summary = modList.Description;
@ -215,7 +227,7 @@ namespace Wabbajack
this.ModName = slide.ModName;
this.AuthorName = slide.ModAuthor;
this.Summary = slide.ModDescription;
AppState._nexusSiteURL = slide.ModURL;
this.NexusSiteURL = slide.ModURL;
}
SlidesQueue.Dequeue();

View File

@ -111,7 +111,7 @@
<Button
Grid.Row="4"
Height="30"
Command="{Binding AppState.VisitNexusSiteCommand}">
Command="{Binding VisitNexusSiteCommand}">
<TextBlock
FontSize="15"
FontWeight="Bold"