Exemplo n.º 1
0
        public void Initialize(ITypesContainer container)
        {
            container.Register <IDeviceConnection, Model.ModBusRtuConnection>(StringKeys.MODBUS_RTU_CONNECTION);
            container.Register <IModbusRtuConnection, Model.ModBusRtuConnection>();
            container.Register <IDeviceConnectionViewModel, ModBusConnectionViewModel>(StringKeys.MODBUS_RTU_CONNECTION + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);

            //регистрация фабрики
            container.Register <IDeviceConnectionFactory, ModBusRtuConnectionFactory>(StringKeys.MODBUSRTU_CONNECTION_FACTORY_NAME);

            container.Register <IComPortConfigurationFactory, ComPortConfigurationFactory>();
            container.Register <IComPortConfigurationViewModelFactory, ComPortConfigurationViewModelFactory>();
            container.Register <IComPortConfiguration, ComPortConfiguration>();
            container.Register <IComPortConfigurationViewModel, ComPortConfigurationViewModel>();
            container.Register <IComPortInterrogationViewModel, ComPortInterrogationViewModel>();
            container.Register <IModBusConnectionViewModel, ModBusConnectionViewModel>();

            //регистрация менеджера подключений
            container.Register <IComConnectionManager, ComConnectionManager>(true);

            //регистрация известных для сериализации типов
            //ISerializerService serializerService = container.Resolve<ISerializerService>();
            //serializerService.AddKnownTypeForSerialization(typeof(Model.ModBusRtuConnection));
            //serializerService.AddKnownTypeForSerialization(typeof(ComPortConfiguration));
            //serializerService.AddNamespaceAttribute("modBusRtuConnection", "ModBusRtuConnectionNS");
            //serializerService.AddNamespaceAttribute("comPortConfiguration", "ComPortConfigurationNS");

            //регистрация ресурсов
            IXamlResourcesService xamlResourcesService = container.Resolve <IXamlResourcesService>();

            xamlResourcesService.AddResourceAsGlobal("Resources/ModBusRtuConnectionResources.xaml", GetType().Assembly);
            xamlResourcesService.AddResourceAsGlobal("Resources/ComPortConfigurationResources.xaml", GetType().Assembly);
        }
Exemplo n.º 2
0
        public void Initialize(ITypesContainer container)
        {
            container.Register(typeof(IUshortsFormatterViewModel), typeof(StringFormatter1251ViewModel),
                               StringKeys.STRING_FORMATTER1251 + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(CodeFormatterViewModel),
                               StringKeys.CODE_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(AsciiStringFormatterViewModel),
                               StringKeys.ASCII_STRING_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(DictionaryMatchingFormatterViewModel),
                               StringKeys.DICTIONARY_MATCHING_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(FormulaFormatterViewModel),
                               StringKeys.FORMULA_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(DirectFormatterViewModel),
                               StringKeys.DIRECT_USHORT_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            //containerRegistry.Register(typeof(IUshortsFormatterViewModel), typeof(BitGroupFormatterViewModel), StringKeys.BITS_GROUP_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(BoolFormatterViewModel),
                               StringKeys.BOOL_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(DefaultTimeFormatterViewModel),
                               StringKeys.DEFAULT_TIME_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(IUshortsFormatterViewModel), typeof(DefaultBitMaskFormatterViewModel),
                               StringKeys.DEFAULT_BIT_MASK_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);

            container.Register(typeof(IUshortsFormatterViewModel), typeof(UshortToIntegerFormatterViewModel),
                               StringKeys.USHORT_TO_INTEGER_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            // container.Register(typeof(IViewModel), typeof(StringFormatter1251ViewModel), StringKeys.STRING_FORMATTER1251 + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);

            //container.Register(typeof(IViewModel), typeof(AsciiStringFormatterViewModel), StringKeys.ASCII_STRING_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            //container.Register(typeof(IViewModel), typeof(DictionaryMatchingFormatterViewModel), StringKeys.DICTIONARY_MATCHING_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            //container.Register(typeof(IViewModel), typeof(FormulaFormatterViewModel), StringKeys.FORMULA_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            //container.Register(typeof(IViewModel), typeof(DirectFormatterViewModel), StringKeys.DIRECT_USHORT_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            ////containerRegistry.Register(typeof(IViewModel), typeof(BitGroupFormatterViewModel), StringKeys.BITS_GROUP_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            //container.Register(typeof(IViewModel), typeof(BoolFormatterViewModel), StringKeys.BOOL_FORMATTER + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register(typeof(ISharedBitViewModel), typeof(SharedBitViewModel));
            container.Register(typeof(IArgumentViewModel), typeof(ArgumentViewModel));
            container.Register(typeof(IFormatterEditorFactory), typeof(FormatterEditorFactory));
            container.Register(typeof(ISaveFormatterService), typeof(SaveFormatterService));
            container.Register(typeof(IFormatterViewModelFactory), typeof(FormatterViewModelFactory));
            container.Register <IFormatterParametersViewModel, FormatterParametersViewModel>();
            container.Register <IEditableValueCopyVisitorProvider, EditableValueCopyVisitorProvider>();
            container.Register <ICodeFormatterService, UniconEngineCodeFormatterService>(true);
            container.Register <IFormatterInfoService, FormatterInfoService>(true);

            IXamlResourcesService xamlResourcesService = container.Resolve <IXamlResourcesService>();

            xamlResourcesService.AddResourceAsGlobal("Resources/FormattersTemplates.xaml", GetType().Assembly);
            xamlResourcesService.AddResourceAsGlobal("Resources/InnerMembersTemplates.xaml", GetType().Assembly);
        }
Exemplo n.º 3
0
        /// <summary>
        /// метод, который вызавается при инициализации модуля
        /// </summary>
        public void Initialize()
        {
            //регистрация фабрики
            _container.RegisterType <IDeviceConnectionFactory, OfflineConnectionFactory>(ApplicationGlobalNames
                                                                                         .OFFLINE_CONNECTION_FACTORY_NAME, new ContainerControlledLifetimeManager());



            //регистрация ресурсов
            _xamlResourcesService.AddResourceAsGlobal("Resources/OfflineConnectionResources.xaml", this.GetType().Assembly);
        }
Exemplo n.º 4
0
        public void Initialize(ITypesContainer container)
        {
            container.Register <IDeviceConnection, Model.MockConnection>(StringKeys.MOCK_CONNECTION);
            container.Register <IDeviceConnectionViewModel, MockConnectionViewModel>(StringKeys.MOCK_CONNECTION + ApplicationGlobalNames.CommonInjectionStrings.VIEW_MODEL);
            container.Register <Model.MockConnection>();
            //регистрация фабрики
            container.Register <IDeviceConnectionFactory, MockConnectionFactory>(StringKeys.MOCK_CONNECTION_FACTORY_NAME);
            //регистрация ресурсов
            IXamlResourcesService xamlResourcesService = container.Resolve <IXamlResourcesService>();

            xamlResourcesService.AddResourceAsGlobal("Resources/MockConnectionResources.xaml", GetType().Assembly);
        }