diff --git a/WowUp.WPF/Services/AddonService.cs b/WowUp.WPF/Services/AddonService.cs index c78797cb..6d18f377 100644 --- a/WowUp.WPF/Services/AddonService.cs +++ b/WowUp.WPF/Services/AddonService.cs @@ -46,6 +46,7 @@ namespace WowUp.WPF.Services public event AddonEventHandler AddonInstalled; public event AddonEventHandler AddonUpdated; public event AddonStateEventHandler AddonStateChanged; + public event AddonListUpdatedEventHandler AddonListUpdated; public string BackupPath => Path.Combine(FileUtilities.AppDataPath, BackupFolder); @@ -175,10 +176,10 @@ namespace WowUp.WPF.Services { var newAddons = await ScanAddons(clientType); addons = UpdateAddons(addons, newAddons); + AddonListUpdated?.Invoke(this, new EventArgs()); } await SyncAddons(clientType, addons); - return addons; } catch(Exception ex) diff --git a/WowUp.WPF/Services/Contracts/IAddonService.cs b/WowUp.WPF/Services/Contracts/IAddonService.cs index fcf70fd7..30ea5a72 100644 --- a/WowUp.WPF/Services/Contracts/IAddonService.cs +++ b/WowUp.WPF/Services/Contracts/IAddonService.cs @@ -10,6 +10,7 @@ namespace WowUp.WPF.Services.Contracts { public delegate void AddonEventHandler(object sender, AddonEventArgs e); public delegate void AddonStateEventHandler(object sender, AddonStateEventArgs e); + public delegate void AddonListUpdatedEventHandler(object sender, EventArgs e); public interface IAddonService { @@ -17,6 +18,7 @@ namespace WowUp.WPF.Services.Contracts event AddonEventHandler AddonInstalled; event AddonEventHandler AddonUpdated; event AddonStateEventHandler AddonStateChanged; + event AddonListUpdatedEventHandler AddonListUpdated; string BackupPath { get; } diff --git a/WowUp.WPF/ViewModels/GetAddonsViewModel.cs b/WowUp.WPF/ViewModels/GetAddonsViewModel.cs index c2947a0b..a8a44f39 100644 --- a/WowUp.WPF/ViewModels/GetAddonsViewModel.cs +++ b/WowUp.WPF/ViewModels/GetAddonsViewModel.cs @@ -77,6 +77,11 @@ namespace WowUp.WPF.ViewModels OnRefresh(); }; + _addonService.AddonListUpdated += (sender, args) => + { + OnRefresh(); + }; + _sessionService.SessionChanged += (sender, args) => { SelectedClientType = args.SessionState.SelectedClientType;