mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Add Task Bar updates
This commit is contained in:
parent
b9e44101aa
commit
3e8fbf0540
22
Wabbajack.App.Wpf/Messages/TaskBarUpdate.cs
Normal file
22
Wabbajack.App.Wpf/Messages/TaskBarUpdate.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Windows.Shell;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Wabbajack.Messages;
|
||||
|
||||
public class TaskBarUpdate
|
||||
{
|
||||
public string Description { get; init; }
|
||||
public double ProgressValue { get; init; }
|
||||
public TaskbarItemProgressState State { get; init; }
|
||||
|
||||
public static void Send(string description, TaskbarItemProgressState state = TaskbarItemProgressState.None,
|
||||
double progressValue = 0)
|
||||
{
|
||||
MessageBus.Current.SendMessage(new TaskBarUpdate()
|
||||
{
|
||||
Description = description,
|
||||
ProgressValue = progressValue,
|
||||
State = state
|
||||
});
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ using System.Reactive;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Shell;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
@ -203,6 +204,7 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
||||
ModListImage = BitmapFrame.Create(await StandardInstaller.ModListImageStream(path));
|
||||
|
||||
StatusText = $"Install configuration for {ModList.Name}";
|
||||
TaskBarUpdate.Send($"Loaded {ModList.Name}", TaskbarItemProgressState.Normal);
|
||||
|
||||
var hex = (await ModListLocation.TargetPath.ToString().Hash()).ToHex();
|
||||
var prevSettings = await _settingsManager.Load<SavedInstallSettings>(InstallSettingsPrefix + hex);
|
||||
@ -258,13 +260,17 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM
|
||||
StatusText = update.StatusText;
|
||||
StatusProgress = update.StepsProgress;
|
||||
|
||||
TaskBarUpdate.Send(update.StatusText, TaskbarItemProgressState.Indeterminate, update.StepsProgress.Value);
|
||||
};
|
||||
await installer.Begin(CancellationToken.None);
|
||||
|
||||
TaskBarUpdate.Send($"Finished install of {ModList.Name}", TaskbarItemProgressState.Normal);
|
||||
|
||||
InstallState = InstallState.Success;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskBarUpdate.Send($"Error during install of {ModList.Name}", TaskbarItemProgressState.Error);
|
||||
InstallState = InstallState.Failure;
|
||||
}
|
||||
|
||||
|
@ -78,4 +78,7 @@
|
||||
</Button>
|
||||
</mahapps:WindowCommands>
|
||||
</mahapps:MetroWindow.RightWindowCommands>
|
||||
<Window.TaskbarItemInfo>
|
||||
<TaskbarItemInfo x:Name="TaskbarItemInfo"></TaskbarItemInfo>
|
||||
</Window.TaskbarItemInfo>
|
||||
</mahapps:MetroWindow>
|
||||
|
@ -9,6 +9,7 @@ using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack;
|
||||
using Wabbajack.LibCefHelpers;
|
||||
using Wabbajack.Messages;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.Paths.IO;
|
||||
using Wabbajack.Util;
|
||||
@ -43,6 +44,14 @@ namespace Wabbajack
|
||||
Environment.Exit(-1);
|
||||
};
|
||||
|
||||
MessageBus.Current.Listen<TaskBarUpdate>()
|
||||
.Subscribe(u =>
|
||||
{
|
||||
TaskbarItemInfo.Description = u.Description;
|
||||
TaskbarItemInfo.ProgressValue = u.ProgressValue;
|
||||
TaskbarItemInfo.ProgressState = u.State;
|
||||
});
|
||||
|
||||
_logger.LogInformation("Wabbajack Build - {Sha}",ThisAssembly.Git.Sha);
|
||||
_logger.LogInformation("Running in {EntryPoint}", KnownFolders.EntryPoint);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user