mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Added version display to main window
This commit is contained in:
parent
ebd5e4183a
commit
e6c98fc3eb
@ -3,11 +3,13 @@ using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.StatusFeed;
|
||||
@ -38,6 +40,9 @@ namespace Wabbajack
|
||||
public readonly UserInterventionHandlers UserInterventionHandlers;
|
||||
public Dispatcher ViewDispatcher { get; set; }
|
||||
|
||||
public ICommand CopyVersionCommand { get; }
|
||||
public string VersionDisplay { get; }
|
||||
|
||||
public MainWindowVM(MainWindow mainWindow, MainSettings settings)
|
||||
{
|
||||
MainWindow = mainWindow;
|
||||
@ -79,6 +84,22 @@ namespace Wabbajack
|
||||
// Start on mode selection
|
||||
ActivePane = ModeSelectionVM;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
VersionDisplay = $"v{fvi.FileVersion}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.Error(ex);
|
||||
VersionDisplay = "ERROR";
|
||||
}
|
||||
CopyVersionCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
Clipboard.SetText($"Wabbajack {VersionDisplay}\n{ThisAssembly.Git.Sha}");
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsStartingFromModlist(out string modlistPath)
|
||||
|
@ -38,4 +38,16 @@
|
||||
</DataTemplate>
|
||||
</ContentPresenter.Resources>
|
||||
</ContentPresenter>
|
||||
|
||||
<mahapps:MetroWindow.RightWindowCommands>
|
||||
<mahapps:WindowCommands>
|
||||
<Button Command="{Binding CopyVersionCommand}" Content="{Binding VersionDisplay}">
|
||||
<Button.ToolTip>
|
||||
<TextBlock>
|
||||
Wabbajack Version<LineBreak />
|
||||
Click to copy to clipboard</TextBlock>
|
||||
</Button.ToolTip>
|
||||
</Button>
|
||||
</mahapps:WindowCommands>
|
||||
</mahapps:MetroWindow.RightWindowCommands>
|
||||
</mahapps:MetroWindow>
|
||||
|
Loading…
Reference in New Issue
Block a user