94 lines
3.4 KiB
C#
94 lines
3.4 KiB
C#
using System;
|
|
using System.ComponentModel.Composition;
|
|
using System.Windows.Media.Imaging;
|
|
using DTS.Common;
|
|
using DTS.Common.Interface;
|
|
using Microsoft.Practices.Prism.Modularity;
|
|
using Microsoft.Practices.Unity;
|
|
|
|
namespace PedestrianAndHeadReports
|
|
{
|
|
[Export(typeof(IModule))]
|
|
[Module(ModuleName = "PedestrianAndHeadReportsModule")]
|
|
public class PedestrianAndHeadReportsModule : IModule
|
|
{
|
|
/// <summary>
|
|
/// Injected unity container
|
|
/// </summary>
|
|
private readonly IUnityContainer _unityContainer;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="PedestrianAndHeadReportsModule"/> class.
|
|
/// </summary>
|
|
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
|
public PedestrianAndHeadReportsModule(IUnityContainer unityContainer)
|
|
{
|
|
_unityContainer = unityContainer;
|
|
}
|
|
|
|
public void Initialize()
|
|
{
|
|
// Register View & View-Model with Unity dependency injection container as a singleton.
|
|
_unityContainer.RegisterType<IHeadReportInputView, HeadReportInputView>();
|
|
_unityContainer.RegisterType<IHeadReportOutputView, HeadReportOutputView>();
|
|
_unityContainer.RegisterType<IHeadReportViewModel, HeadReportViewModel>();
|
|
_unityContainer.RegisterType<ITRLReportInputView, TRLReportInputView>();
|
|
_unityContainer.RegisterType<ITRLReportOutputView, TRLReportOutputView>();
|
|
_unityContainer.RegisterType<ITRLReportViewModel, TRLReportViewModel>();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Attribute class contains assembly image and name - used on the Main screen to display available components
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
|
public class PedestrianAndHeadReportsImageAttribute : ImageAttribute
|
|
{
|
|
private BitmapImage _img;
|
|
|
|
public PedestrianAndHeadReportsImageAttribute () : this(null) { }
|
|
public override BitmapImage AssemblyImage
|
|
{
|
|
get { _img = AssemblyInfo.GetImage(AssemblyNames.DB.ToString()); return _img; }
|
|
}
|
|
public PedestrianAndHeadReportsImageAttribute(string s)
|
|
{
|
|
_img = AssemblyInfo.GetImage(AssemblyNames.DB.ToString());
|
|
}
|
|
|
|
public override Type GetAttributeType()
|
|
{
|
|
return typeof(ImageAttribute);
|
|
}
|
|
public override BitmapImage GetAssemblyImage()
|
|
{
|
|
return AssemblyImage;
|
|
}
|
|
private string _name;
|
|
public override string AssemblyName
|
|
{
|
|
get { _name = AssemblyNames.PowerAndBattery.ToString(); return _name; }
|
|
}
|
|
|
|
public override string GetAssemblyName()
|
|
{
|
|
return AssemblyName;
|
|
}
|
|
private string _group;
|
|
public override string AssemblyGroup
|
|
{
|
|
get { _group = eAssemblyGroups.Administrative.ToString(); return _group; }
|
|
}
|
|
|
|
public override string GetAssemblyGroup()
|
|
{
|
|
return AssemblyGroup;
|
|
}
|
|
public override eAssemblyRegion GetAssemblyRegion()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
public override eAssemblyRegion AssemblyRegion => throw new NotImplementedException();
|
|
}
|
|
}
|
|
|