mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Basic AutoUpdater.NET added. GUI button to update
This commit is contained in:
parent
2a7455f275
commit
cd3e186d73
@ -36,7 +36,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.VirtualFileSystem
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.Test", "Wabbajack.Test\Wabbajack.Test.csproj", "{81F87B8B-D5CE-4807-9005-38DE95BD7840}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.CLI", "Wabbajack.CLI\Wabbajack.CLI.csproj", "{685D8BB1-D178-4D2C-85C7-C54A36FB7454}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wabbajack.CLI", "Wabbajack.CLI\Wabbajack.CLI.csproj", "{685D8BB1-D178-4D2C-85C7-C54A36FB7454}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -46,102 +46,78 @@ Global
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Debug|x64.Build.0 = Debug|x64
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|x64.ActiveCfg = Release|x64
|
||||
{B3F3FB6E-B9EB-4F49-9875-D78578BC7AE5}.Release|x64.Build.0 = Release|x64
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Debug|x64.Build.0 = Debug|x64
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|x64.ActiveCfg = Release|x64
|
||||
{FF5D892F-8FF4-44FC-8F7F-CD58F307AD1B}.Release|x64.Build.0 = Release|x64
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Debug|x64.Build.0 = Debug|x64
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|x64.ActiveCfg = Release|x64
|
||||
{0A820830-A298-497D-85E0-E9A89EFEF5FE}.Release|x64.Build.0 = Release|x64
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Debug|x64.Build.0 = Debug|x64
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|x64.ActiveCfg = Release|x64
|
||||
{9E69BC98-1512-4977-B683-6E7E5292C0B8}.Release|x64.Build.0 = Release|x64
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Debug|x64.Build.0 = Debug|x64
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|x64.ActiveCfg = Release|x64
|
||||
{5D6A2EAF-6604-4C51-8AE2-A746B4BC5E3E}.Release|x64.Build.0 = Release|x64
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Debug|x64.Build.0 = Debug|x64
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Release|x64.ActiveCfg = Release|x64
|
||||
{37E4D421-8FD3-4D57-8F3A-7A511D6ED5C5}.Release|x64.Build.0 = Release|x64
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Debug|x64.Build.0 = Debug|x64
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Release|x64.ActiveCfg = Release|x64
|
||||
{DE18D89E-39C5-48FD-8E42-16235E3C4593}.Release|x64.Build.0 = Release|x64
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Debug|x64.Build.0 = Debug|x64
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Release|x64.ActiveCfg = Release|x64
|
||||
{6ED08CFB-B879-4B55-8741-663A4A3491CE}.Release|x64.Build.0 = Release|x64
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Debug|x64.Build.0 = Debug|x64
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|x64.ActiveCfg = Release|x64
|
||||
{89281BA1-67C8-48D2-9D6E-0F5CC85AD8C9}.Release|x64.Build.0 = Release|x64
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Debug|x64.Build.0 = Debug|x64
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|x64.ActiveCfg = Release|x64
|
||||
{F72C17EC-0881-4455-8B0E-E1CC4FFD642E}.Release|x64.Build.0 = Release|x64
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Debug|x64.Build.0 = Debug|x64
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|x64.ActiveCfg = Release|x64
|
||||
{81F87B8B-D5CE-4807-9005-38DE95BD7840}.Release|x64.Build.0 = Release|x64
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.Build.0 = Release|Any CPU
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Debug|x64.Build.0 = Debug|x64
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.ActiveCfg = Release|x64
|
||||
{685D8BB1-D178-4D2C-85C7-C54A36FB7454}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1343,6 +1343,30 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="TransparentBackgroundButtonStyle"
|
||||
BasedOn="{StaticResource MainButtonStyle}"
|
||||
TargetType="{x:Type Button}">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" Value="{StaticResource MahApps.Brushes.Gray7}" />
|
||||
<Setter Property="Foreground" Value="{StaticResource IntenseComplementaryBrush}" />
|
||||
<Setter Property="Background" Value="{StaticResource DarkBackgroundBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="BorderBrush" Value="{StaticResource DarkComplementaryBrush}" />
|
||||
<Setter Property="Background" Value="{StaticResource DarkBackgroundBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- ToggleButton -->
|
||||
<Style TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DynamicData;
|
||||
using AutoUpdaterDotNET;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
@ -6,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -46,6 +48,9 @@ namespace Wabbajack
|
||||
|
||||
public string VersionDisplay { get; }
|
||||
|
||||
[Reactive]
|
||||
public bool UpdateAvailable { get; private set; }
|
||||
|
||||
public MainWindowVM(MainWindow mainWindow, MainSettings settings)
|
||||
{
|
||||
ConverterRegistration.Register();
|
||||
@ -79,7 +84,7 @@ namespace Wabbajack
|
||||
{
|
||||
await UserInterventionHandlers.Handle(msg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex)
|
||||
when (ex.GetType() != typeof(TaskCanceledException))
|
||||
{
|
||||
Utils.Error(ex, $"Error while handling user intervention of type {msg?.GetType()}");
|
||||
@ -129,6 +134,21 @@ namespace Wabbajack
|
||||
canExecute: this.WhenAny(x => x.ActivePane)
|
||||
.Select(active => !SettingsPane.IsValueCreated || !object.ReferenceEquals(active, SettingsPane.Value)),
|
||||
execute: () => NavigateTo(SettingsPane.Value));
|
||||
|
||||
// Latch onto update events and update GUI
|
||||
AutoUpdater.CheckForUpdateEvent += (args) =>
|
||||
{
|
||||
UpdateAvailable = args.IsUpdateAvailable;
|
||||
};
|
||||
|
||||
// Trigger a query for updates soon after starting
|
||||
Observable.Return(Unit.Default)
|
||||
.Delay(TimeSpan.FromSeconds(3))
|
||||
.ObserveOnGuiThread()
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
AutoUpdater.Start(@"https://www.wabbajack.org/current-version.xml");
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsStartingFromModlist(out string modlistPath)
|
||||
|
@ -1,7 +1,10 @@
|
||||
using ReactiveUI;
|
||||
using AutoUpdaterDotNET;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Windows.Input;
|
||||
using Wabbajack.Common;
|
||||
@ -15,6 +18,7 @@ namespace Wabbajack
|
||||
public ICommand BrowseCommand { get; }
|
||||
public ICommand InstallCommand { get; }
|
||||
public ICommand CompileCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> UpdateCommand { get; }
|
||||
|
||||
public ModeSelectionVM(MainWindowVM mainVM)
|
||||
{
|
||||
@ -34,6 +38,24 @@ namespace Wabbajack
|
||||
|
||||
CompileCommand = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Compiler.Value));
|
||||
BrowseCommand = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Gallery.Value));
|
||||
|
||||
UpdateCommand = ReactiveCommand.Create(
|
||||
canExecute: mainVM.WhenAny(x => x.UpdateAvailable)
|
||||
.ObserveOnGuiThread(),
|
||||
execute: () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (AutoUpdater.DownloadUpdate())
|
||||
{
|
||||
mainVM.ShutdownApplication();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Utils.Error(exception, "Could not download update.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
<local:InstallationView ViewModel="{Binding}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:ModeSelectionVM}">
|
||||
<local:ModeSelectionView />
|
||||
<local:ModeSelectionView ViewModel="{Binding}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:ModListGalleryVM}">
|
||||
<local:ModListGalleryView ViewModel="{Binding}" />
|
||||
|
@ -1,4 +1,4 @@
|
||||
<UserControl
|
||||
<rxui:ReactiveUserControl
|
||||
x:Class="Wabbajack.ModeSelectionView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@ -6,9 +6,10 @@
|
||||
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DataContext="{d:DesignInstance local:ModeSelectionVM}"
|
||||
xmlns:rxui="http://reactiveui.net"
|
||||
d:DesignHeight="700"
|
||||
d:DesignWidth="1000"
|
||||
x:TypeArguments="local:ModeSelectionVM"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@ -33,6 +34,25 @@
|
||||
</LinearGradientBrush>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Button
|
||||
x:Name="UpdateAvailableButton"
|
||||
Margin="6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource TransparentBackgroundButtonStyle}">
|
||||
<StackPanel Margin="5" Orientation="Horizontal">
|
||||
<icon:PackIconMaterial
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{StaticResource ComplementaryBrush}"
|
||||
Kind="Download" />
|
||||
<TextBlock
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{StaticResource ComplementaryBrush}"
|
||||
Text="Update Available" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Grid Grid.Row="1" Margin="5,15">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
@ -40,13 +60,13 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
x:Name="BrowseButton"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="15,0"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
ClipToBounds="False"
|
||||
Command="{Binding BrowseCommand}">
|
||||
ClipToBounds="False">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
@ -195,13 +215,13 @@
|
||||
</Grid>
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="InstallButton"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="15,0"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
ClipToBounds="False"
|
||||
Command="{Binding InstallCommand}">
|
||||
ClipToBounds="False">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
@ -355,8 +375,8 @@
|
||||
Margin="15,0"
|
||||
Background="Transparent"
|
||||
BorderBrush="Transparent"
|
||||
ClipToBounds="False"
|
||||
Command="{Binding CompileCommand}">
|
||||
x:Name="CompileButton"
|
||||
ClipToBounds="False">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Background="{TemplateBinding Background}">
|
||||
@ -513,4 +533,4 @@
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
</rxui:ReactiveUserControl>
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@ -12,17 +14,39 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ModeSelectionView.xaml
|
||||
/// </summary>
|
||||
public partial class ModeSelectionView : UserControl
|
||||
public partial class ModeSelectionView : ReactiveUserControl<ModeSelectionVM>
|
||||
{
|
||||
public ModeSelectionView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.WhenActivated(dispose =>
|
||||
{
|
||||
this.WhenAny(x => x.ViewModel.BrowseCommand)
|
||||
.BindToStrict(this, x => x.BrowseButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.InstallCommand)
|
||||
.BindToStrict(this, x => x.InstallButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.CompileCommand)
|
||||
.BindToStrict(this, x => x.CompileButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
|
||||
this.WhenAny(x => x.ViewModel.UpdateCommand)
|
||||
.BindToStrict(this, x => x.UpdateAvailableButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.UpdateCommand.CanExecute)
|
||||
.Switch()
|
||||
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
|
||||
.BindToStrict(this, x => x.UpdateAvailableButton.Visibility)
|
||||
.DisposeWith(dispose);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autoupdater.NET.Official" Version="1.5.8" />
|
||||
<PackageReference Include="CefSharp.Wpf" Version="79.1.350" />
|
||||
<PackageReference Include="DynamicData" Version="6.14.3" />
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="3.8.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user