diff --git a/Wabbajack.App.Wpf/Messages/TaskBarUpdate.cs b/Wabbajack.App.Wpf/Messages/TaskBarUpdate.cs new file mode 100644 index 00000000..b4aede1e --- /dev/null +++ b/Wabbajack.App.Wpf/Messages/TaskBarUpdate.cs @@ -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 + }); + } +} diff --git a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs index a924bc5f..cfb30e45 100644 --- a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs @@ -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(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; } diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml b/Wabbajack.App.Wpf/Views/MainWindow.xaml index 50108bc6..62b70dab 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml @@ -78,4 +78,7 @@ + + + diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs index e3088ba3..a91c3807 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs @@ -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() + .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);