diff --git a/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj b/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj index 5463a7d..94d8376 100644 --- a/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj +++ b/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj @@ -62,6 +62,7 @@ + diff --git a/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs b/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs index 6576c85..0dc518e 100644 --- a/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs +++ b/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs @@ -15,11 +15,12 @@ namespace BuildsAppReborn.Access.UI.Notifications { [PriorityExport(typeof(INotificationProvider), -1)] [PartCreationPolicy(CreationPolicy.Shared)] - internal class DefaultNotificationProvider : INotificationProvider + internal class DefaultNotificationProvider : NotificationProviderBase, INotificationProvider { #region Constructors - public DefaultNotificationProvider() + [ImportingConstructor] + public DefaultNotificationProvider(GeneralSettings generalSettings) : base(generalSettings) { this.notifier = new Notifier(cfg => { @@ -38,7 +39,7 @@ public void ShowBuild(IBuild build, Func iconProvider, Action iconProvider, Action notificationClickAction) @@ -22,7 +31,7 @@ public void ShowBuild(IBuild build, Func iconProvider, Action buildDefinitionEqualityComparer, IEqualityComparer pullRequstEqualityComparer, GlobalSettingsContainer globalSettingsContainer) + internal BuildCache(IBuildMonitorBasic buildMonitor, IEqualityComparer buildDefinitionEqualityComparer, IEqualityComparer pullRequstEqualityComparer, GeneralSettings generalSettings) { BuildsStatus = new RangeObservableCollection(); this.buildDefinitionEqualityComparer = buildDefinitionEqualityComparer; this.pullRequstEqualityComparer = pullRequstEqualityComparer; - this.globalSettingsContainer = globalSettingsContainer; + this.generalSettings = generalSettings; buildMonitor.BuildsUpdated += OnBuildsUpdated; buildMonitor.MonitorStopped += (sender, args) => CacheStatus = BuildCacheStatus.NotConfigured; buildMonitor.MonitorStarted += (sender, args) => CacheStatus = BuildCacheStatus.Loading; @@ -137,11 +137,11 @@ private void OnBuildsUpdated(ICollection builds) var buildStatusGroups = new List(); - if (this.globalSettingsContainer.GeneralSettings.ViewStyle == BuildViewStyle.GroupByBuildDefinition) + if (this.generalSettings.ViewStyle == BuildViewStyle.GroupByBuildDefinition) { buildStatusGroups.AddRange(GroupBuildsByDefinition(builds, BuildsStatus)); } - else if (this.globalSettingsContainer.GeneralSettings.ViewStyle == BuildViewStyle.GroupByPullRequest) + else if (this.generalSettings.ViewStyle == BuildViewStyle.GroupByPullRequest) { var prBuilds = builds.Where(a => a.PullRequest != null).ToList(); @@ -214,8 +214,8 @@ private void UpdateCurrentIcon() private readonly IEqualityComparer buildDefinitionEqualityComparer; private BuildCacheStatus cacheStatus; private String currentIcon; - private readonly GlobalSettingsContainer globalSettingsContainer; private readonly IEqualityComparer pullRequstEqualityComparer; + private readonly GeneralSettings generalSettings; #endregion diff --git a/BuildsAppReborn.Client/GlobalSettingsContainer.cs b/BuildsAppReborn.Client/GlobalSettingsContainer.cs index 52964a4..6ade988 100644 --- a/BuildsAppReborn.Client/GlobalSettingsContainer.cs +++ b/BuildsAppReborn.Client/GlobalSettingsContainer.cs @@ -31,6 +31,7 @@ public GlobalSettingsContainer() /// /// The general settings. /// + [Export] public GeneralSettings GeneralSettings { get diff --git a/BuildsAppReborn.Contracts/Models/GeneralSettings.cs b/BuildsAppReborn.Contracts/Models/GeneralSettings.cs index f3a9032..2a9169b 100644 --- a/BuildsAppReborn.Contracts/Models/GeneralSettings.cs +++ b/BuildsAppReborn.Contracts/Models/GeneralSettings.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.ComponentModel.Composition; namespace BuildsAppReborn.Contracts.Models { + [PartCreationPolicy(CreationPolicy.Shared)] public class GeneralSettings { #region Constructors