diff --git a/RaceLapTimer/Interfaces/IPluginLocator.cs b/RaceLapTimer/Interfaces/IPluginLocator.cs index 75f4006..16b5866 100644 --- a/RaceLapTimer/Interfaces/IPluginLocator.cs +++ b/RaceLapTimer/Interfaces/IPluginLocator.cs @@ -1,9 +1,11 @@ using System.Collections.Generic; +using System.Threading.Tasks; namespace Interfaces { public interface IPluginLocator { + Task> LocateAsync(); List Locate(); } } diff --git a/RaceLapTimer/Interfaces/Interfaces.csproj b/RaceLapTimer/Interfaces/Interfaces.csproj index 2ff5ad6..4c5685c 100644 --- a/RaceLapTimer/Interfaces/Interfaces.csproj +++ b/RaceLapTimer/Interfaces/Interfaces.csproj @@ -52,6 +52,7 @@ + diff --git a/RaceLapTimer/Interfaces/ProviderDetails.cs b/RaceLapTimer/Interfaces/ProviderDetails.cs new file mode 100644 index 0000000..9f0af3a --- /dev/null +++ b/RaceLapTimer/Interfaces/ProviderDetails.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Interfaces +{ + public class ProviderDetails + { + public string ProviderName { get; set; } + public string ProviderAuthor { get; set; } + public string ProviderDescription { get; set; } + + } +} diff --git a/RaceLapTimer/RaceLapTimer/Extensions/Notifications/NotificationManager.cs b/RaceLapTimer/RaceLapTimer/Extensions/Notifications/NotificationManager.cs index f3989b8..c7330bb 100644 --- a/RaceLapTimer/RaceLapTimer/Extensions/Notifications/NotificationManager.cs +++ b/RaceLapTimer/RaceLapTimer/Extensions/Notifications/NotificationManager.cs @@ -11,12 +11,16 @@ namespace RaceLapTimer.Extensions.Notifications { class NotificationManager : INotifierManager { - private readonly List _providers; - public NotificationManager(IPluginPathProvider pluginPath, IContainerHelper helper, IPluginLocator locator) + private List _providers; + + public NotificationManager(IPluginLocator locator) { - var providerFactories = locator.Locate(); - - //var providerFactories = helper.GetAll().ToList(); + RegisterProviders(locator); + } + + private async void RegisterProviders(IPluginLocator locator) + { + var providerFactories = await locator.LocateAsync(); _providers = new List(); foreach (var factory in providerFactories) { @@ -35,7 +39,6 @@ namespace RaceLapTimer.Extensions.Notifications { foreach (var provider in _providers) { - //provider.NotifyRaceStarted(args); Task.Factory.StartNew(() => { provider.NotifyRaceStarted(args); }); } } @@ -90,13 +93,5 @@ namespace RaceLapTimer.Extensions.Notifications } return false; } - - private class DiscoveredPlugin - { - public string FilePath { get; set; } - public Type PluginType { get; set; } - public Type TypeToBindTo { get; set; } - public string UniqueName { get; set; } - } } } diff --git a/RaceLapTimer/RaceLapTimer/Extensions/PluginLocator.cs b/RaceLapTimer/RaceLapTimer/Extensions/PluginLocator.cs index d2e451f..a683e1a 100644 --- a/RaceLapTimer/RaceLapTimer/Extensions/PluginLocator.cs +++ b/RaceLapTimer/RaceLapTimer/Extensions/PluginLocator.cs @@ -20,10 +20,10 @@ namespace RaceLapTimer.Extensions _pluginPath = pluginPath; } - //public async List Locate() - //{ - // return await Task.Run(()=> Locate()); - //} + public async Task> LocateAsync() + { + return await Task.Run(() => Locate()); + } public List Locate() { diff --git a/RaceLapTimer/RaceLapTimerHost/RaceLapTimerHost.csproj b/RaceLapTimer/RaceLapTimerHost/RaceLapTimerHost.csproj index 6021921..5132c59 100644 --- a/RaceLapTimer/RaceLapTimerHost/RaceLapTimerHost.csproj +++ b/RaceLapTimer/RaceLapTimerHost/RaceLapTimerHost.csproj @@ -90,8 +90,10 @@ - copy /B /Y "$(TargetDir)UdpNotifier.dll" "$(TargetDir)Plugins\UdpNotifier.dll" -copy /B /Y "$(TargetDir)NLogConfig.xml" "$(TargetDir)Configs\NLogConfig.xml" + copy /B /Y "$(SolutionDir)UdpNotifier\$(OutDir)UdpNotifier.dll" "$(TargetDir)Plugins\UdpNotifier.dll" +copy /B /Y "$(SolutionDir)IrDaemonNotifier\$(OutDir)IrDaemonNotifier.dll" "$(TargetDir)Plugins\IrDaemonNotifier.dll" +copy /B /Y "$(TargetDir)NLogConfig.xml" "$(TargetDir)Configs\NLogConfig.xml" +copy /B /Y "$(SolutionDir)RaceLapTimer\$(OutDir)Ninject.Extensions.Xml.dll" "$(TargetDir)Ninject.Extensions.Xml.dll"