using GreenTree.Nachtragsmanagement.Core.Plugins;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace GreenTree.Nachtragsmanagement.Services.Misc
{
public class NotificationService : INotificationService
{
///
/// Searches for all implementations of the INotificationPlugin
///
public IEnumerable GetNotificationPlugins()
{
var type = typeof(INotificationPlugin);
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
var types = assemblies
.SelectMany(p => p.GetTypes())
.Where(p => type.IsAssignableFrom(p) && !p.IsInterface)
.Select(p => Activator.CreateInstance(p))
.OfType()
.ToList();
return types;
}
}
}