init
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Viewer.PSDReport;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using Unity.Lifetime;
|
||||
|
||||
|
||||
[assembly: PSDReportModuleName()]
|
||||
[assembly: PSDReportModuleImageAttribute()]
|
||||
namespace DTS.Viewer.PSDReport
|
||||
{
|
||||
[Module(ModuleName = "PSDReport")]
|
||||
public class PSDReportModule : IPSDReportModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
public bool SessionStarted { get; private set; }
|
||||
|
||||
public PSDReportModule(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_unityContainer.RegisterType<IPSDReportModule, PSDReportModule>(new ContainerControlledLifetimeManager());
|
||||
}
|
||||
|
||||
public void StartSession()
|
||||
{
|
||||
var eventAggregator = _unityContainer.Resolve<IEventAggregator>();
|
||||
eventAggregator.GetEvent<LoadViewModulEvent>().Publish(new LoadViewModulArg());
|
||||
SessionStarted = true;
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Attribute class contains assembly name
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class PSDReportModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public PSDReportModuleNameAttribute() : this(null) { }
|
||||
|
||||
public PSDReportModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.PSDReport.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 PSDReportModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public PSDReportModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.PSDReport.ToString()); return _img; }
|
||||
}
|
||||
public PSDReportModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.PSDReport.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.PSDReport.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.PSDReportRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user