using System;
using System.ComponentModel.Composition;
using System.Windows.Media.Imaging;
using DTS.Common;
using DTS.Common.Interface;
using DTS.Common.Interface.RegionOfInterest.RegionOfInterestChannels;
using Prism.Ioc;
using Prism.Modularity;
using RegionOfInterestChannels;
using Unity;
// ReSharper disable CheckNamespace
// ReSharper disable RedundantAttributeUsageProperty
// ReSharper disable UnusedParameter.Local
[assembly: RegionOfInterestChannelsModuleName]
[assembly: RegionOfInterestChannelsModuleImageAttribute]
namespace RegionOfInterestChannels
{
[Export(typeof(IModule))]
[Module(ModuleName = "RegionOfInterestChannelsModule")]
public class RegionOfInterestChannelsModule : IModule
{
///
/// Injected unity container
///
private readonly Unity.IUnityContainer _unityContainer;
///
/// Initializes a new instance of the class.
///
/// Obtained reference of the unity container by using dependency injection.
public RegionOfInterestChannelsModule(Unity.IUnityContainer unityContainer)
{
_unityContainer = unityContainer;
}
public void Initialize()
{
// Register View & View-Model with Unity dependency injection container as a singleton.
_unityContainer.RegisterType();
_unityContainer.RegisterType();
}
public void OnInitialized(IContainerProvider containerProvider)
{
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
Initialize();
}
}
///
/// Attribute class contains assembly name
///
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class RegionOfInterestChannelsModuleNameAttribute : TextAttribute
{
public RegionOfInterestChannelsModuleNameAttribute() : this(null) { }
public RegionOfInterestChannelsModuleNameAttribute(string s)
{
AssemblyName = AssemblyNames.RegionOfInterestChannels.ToString();
}
public override string AssemblyName { get; }
public override Type GetAttributeType()
{
return typeof(TextAttribute);
}
public override string GetAssemblyName()
{
return AssemblyName;
}
}
///
/// Attribute class contains assembly image and name - used on the Main screen to SummaryModule available components
///
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class RegionOfInterestChannelsModuleImageAttribute : ImageAttribute
{
private BitmapImage _img;
public RegionOfInterestChannelsModuleImageAttribute() : this(null) { }
public override BitmapImage AssemblyImage
{
get { _img = AssemblyInfo.GetImage(AssemblyNames.RegionOfInterestChannels.ToString()); return _img; }
}
public RegionOfInterestChannelsModuleImageAttribute(string s)
{
_img = AssemblyInfo.GetImage(AssemblyNames.RegionOfInterestChannels.ToString());
}
public override Type GetAttributeType()
{
return typeof(ImageAttribute);
}
public override BitmapImage GetAssemblyImage()
{
return AssemblyImage;
}
private string _name;
public override string AssemblyName
{
get { _name = AssemblyNames.RegionOfInterestChannels.ToString(); return _name; }
}
public override string GetAssemblyName()
{
return AssemblyName;
}
private string _group;
public override string AssemblyGroup
{
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
}
public override string GetAssemblyGroup()
{
return AssemblyGroup;
}
private eAssemblyRegion _region;
public override eAssemblyRegion AssemblyRegion
{
get { _region = eAssemblyRegion.RegionOfInterestChannelsRegion; return _region; }
}
public override eAssemblyRegion GetAssemblyRegion()
{
return AssemblyRegion;
}
}
}