140 lines
4.3 KiB
C#
140 lines
4.3 KiB
C#
using System;
|
|
using System.Windows.Media.Imaging;
|
|
using DTS.Common;
|
|
using DTS.Common.Interface;
|
|
using DTS.Viewer.TestSummaryList;
|
|
using DTS.Viewer.TestSummaryList.ViewModel;
|
|
using Prism.Ioc;
|
|
using Prism.Modularity;
|
|
using Unity;
|
|
// ReSharper disable RedundantAttributeUsageProperty
|
|
// ReSharper disable UnusedParameter.Local
|
|
|
|
|
|
[assembly: TestSummaryListModuleName()]
|
|
[assembly: TestSummaryListModuleImageAttribute()]
|
|
namespace DTS.Viewer.TestSummaryList
|
|
{
|
|
[Module(ModuleName = "TestSummaryList")]
|
|
public class TestSummaryListModule : IModule
|
|
{
|
|
/// <summary>
|
|
/// Injected unity container
|
|
/// </summary>
|
|
private readonly IUnityContainer _unityContainer;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="TestSummaryListModule"/> class.
|
|
/// </summary>
|
|
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
|
public TestSummaryListModule(IUnityContainer unityContainer)
|
|
{
|
|
|
|
_unityContainer = unityContainer;
|
|
}
|
|
|
|
public void Initialize()
|
|
{
|
|
// Register View & View-Model with Unity dependency injection container as a singleton.
|
|
_unityContainer.RegisterType<ITestSummaryListView, TestSummaryListView>();
|
|
_unityContainer.RegisterType<ITestSummaryListViewModel, TestSummaryViewListModel>();
|
|
}
|
|
|
|
public void OnInitialized(IContainerProvider containerProvider)
|
|
{
|
|
|
|
}
|
|
|
|
public void RegisterTypes(IContainerRegistry containerRegistry)
|
|
{
|
|
Initialize();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Attribute class contains assembly name
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
|
public class TestSummaryListModuleNameAttribute : TextAttribute
|
|
{
|
|
public TestSummaryListModuleNameAttribute() : this(null) { }
|
|
|
|
public TestSummaryListModuleNameAttribute(string s)
|
|
{
|
|
AssemblyName = AssemblyNames.TestSummaryList.ToString();
|
|
}
|
|
|
|
public override string AssemblyName { get; }
|
|
|
|
public override Type GetAttributeType()
|
|
{
|
|
return typeof(TextAttribute);
|
|
}
|
|
|
|
public override string GetAssemblyName()
|
|
{
|
|
return AssemblyName;
|
|
}
|
|
}
|
|
|
|
/// <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 TestSummaryListModuleImageAttribute : ImageAttribute
|
|
{
|
|
private BitmapImage _img;
|
|
|
|
public TestSummaryListModuleImageAttribute() : this(null) { }
|
|
public override BitmapImage AssemblyImage
|
|
{
|
|
get { _img = AssemblyInfo.GetImage(AssemblyNames.TestSummaryList.ToString()); return _img; }
|
|
}
|
|
public TestSummaryListModuleImageAttribute(string s)
|
|
{
|
|
_img = AssemblyInfo.GetImage(AssemblyNames.TestSummaryList.ToString());
|
|
}
|
|
|
|
public override Type GetAttributeType()
|
|
{
|
|
return typeof(ImageAttribute);
|
|
}
|
|
public override BitmapImage GetAssemblyImage()
|
|
{
|
|
return AssemblyImage;
|
|
}
|
|
private string _name;
|
|
public override string AssemblyName
|
|
{
|
|
get { _name = AssemblyNames.TestSummaryList.ToString(); return _name; }
|
|
}
|
|
|
|
public override string GetAssemblyName()
|
|
{
|
|
return AssemblyName;
|
|
}
|
|
private string _group;
|
|
public override string AssemblyGroup
|
|
{
|
|
get { _group = eAssemblyGroups.Viewer.ToString(); return _group; }
|
|
}
|
|
|
|
public override string GetAssemblyGroup()
|
|
{
|
|
return AssemblyGroup;
|
|
}
|
|
|
|
private eAssemblyRegion _region;
|
|
public override eAssemblyRegion AssemblyRegion
|
|
{
|
|
get { _region = eAssemblyRegion.TestSummaryRegion; return _region; }
|
|
}
|
|
public override eAssemblyRegion GetAssemblyRegion()
|
|
{
|
|
return AssemblyRegion;
|
|
}
|
|
}
|
|
}
|
|
|
|
|