init
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using DTS.Common.Interface;
|
||||
using Prism.Ioc;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
|
||||
namespace TablesSettings
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "TablesSettings")]
|
||||
public class TablesSettingsModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TablesSettingsModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public TablesSettingsModule(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<ITablesSettingsView, TablesSettingsView>();
|
||||
_unityContainer.RegisterType<ITablesSettingsViewModel, TablesSettingsViewModel>();
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
/// <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 TablesSettingsImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public TablesSettingsImageAttribute() : this(null) { }
|
||||
public override eAssemblyRegion AssemblyRegion => throw new NotImplementedException();
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.TablesSettings.ToString()); return _img; }
|
||||
}
|
||||
public TablesSettingsImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.TablesSettings.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.TablesSettings.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Administrative.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user