Exemplo n.º 1
0
        public async Task ConnectionLost()
        {
            var applicationGlobalCommandsMock = ApplicationGlobalCommandsMock.Create().WithAskUserGlobalResult(false);

            _typesContainer.RegisterInstance <IApplicationGlobalCommands>(applicationGlobalCommandsMock);

            _configurationFragmentViewModel.DeviceContext.DeviceMemory.DeviceMemoryValues.Clear();
            var connection = new MockConnection();
            await _typesContainer.Resolve <IDevicesContainerService>()
            .ConnectDeviceAsync(_device, connection);

            MockConnection.IsConnectionLost = true;

            Assert.True(await TestsUtils.WaitUntil(() => _readCommand.CanExecute(null), 30000));
            _readCommand.Execute(null);

            Assert.True(await TestsUtils.WaitUntil(
                            () => !_deviceViewModel.ConnectionStateViewModel.IsDeviceConnected, 30000));

            MockConnection.IsConnectionLost = false;
            Assert.True(await TestsUtils.WaitUntil(() => _readCommand.CanExecute(null), 30000));
            _readCommand.Execute(null);

            Assert.True(await TestsUtils.WaitUntil(
                            () => _deviceViewModel.ConnectionStateViewModel.IsDeviceConnected, 30000));


            Assert.True(applicationGlobalCommandsMock.IsAskUserGlobalTriggered);
        }
Exemplo n.º 2
0
        public void Initialize(ITypesContainer container)
        {
            container.RegisterInstance <ILocalizerService>(new LocalizerService("ru-RU"));
            container.Register <ILogMessage, LogMessage>();
            container.Register <IDeviceLogger, DeviceLogger>();
            container.Register <IDevicesContainerService, DevicesContainerService>(true);
            container.Register <IXamlResourcesService, ApplicationXamlResourcesService>(true);

            container.Register <ISerializerService, SerializerService.SerializerService>(true);

            container.Register <IUniconProject, UniconProject.UniconProject>();
            container.Register <IUniconProjectService, UniconProjectService>(true);

            container.Register(typeof(IGeneralViewModelFactory <>), typeof(GeneralViewModelFactory <>));
            container.Register <IExceptionLoggerService, ExceptionLoggerService>();

            container.Register <ILogService, LogService.LogService>(true);

            container.RegisterInstance <IApplicationGlobalCommands>(
                new ApplicationGlobalCommands(container, container.Resolve <IDialogCoordinator>(), container.Resolve <ILocalizerService>()));

            // container.Resolve<ISerializerService>().AddKnownTypeForSerialization(typeof(DeviceLogger));
            // container.Resolve<ISerializerService>().AddNamespaceAttribute("deviceLogger", "DeviceLoggerNS");
        }
Exemplo n.º 3
0
        public void Initialize(ITypesContainer container)
        {
            container.Register <ExportSelectionViewModel>();
            container.Register(typeof(IFragmentViewModel), typeof(RuntimeConfigurationViewModel),
                               ApplicationGlobalNames.FragmentInjectcionStrings.CONFIGURATION_VIEWMODEL);

            container.RegisterInstance <IConfigurationItemFactory>(
                new ConfigurationItemFactory(container.Resolve <ITypesContainer>()));
            container.Register <IRuntimeConfigurationItemViewModelFactory,
                                RuntimeConfigurationItemViewModelFactory>();
            container.Register(typeof(IDependancyCondition), typeof(DependancyCondition));

            container.Register(typeof(IComplexProperty), typeof(ComplexProperty));
            container.Register(typeof(ISubProperty), typeof(SubProperty));
            container.Register(typeof(IDeviceConfiguration), typeof(DefaultDeviceConfiguration));
            container.Register(typeof(IItemsGroup), typeof(DefaultItemsGroup));
            container.Register(typeof(IProperty), typeof(DefaultProperty));
            container.Register(typeof(IGroupWithReiterationInfo), typeof(GroupWithReiterationInfo));
            container.Register(typeof(IReiterationSubGroupInfo), typeof(ReiterationSubGroupInfo));

            container.Register(typeof(IRuntimeItemGroupViewModel), typeof(RuntimeItemGroupViewModel));
            container.Register(typeof(IRuntimePropertyViewModel), typeof(RuntimePropertyViewModel));
            container.Register(typeof(IRuntimeConfigurationViewModel), typeof(RuntimeConfigurationViewModel));
            container.Register <IPropertyValueService, PropertyValueService>();
            container.Register(typeof(IFragmentSetting), typeof(ActivatedConfigurationSetting),
                               ConfigurationKeys.Settings.ACTIVATION_CONFIGURATION_SETTING);

            container.Register(typeof(IConfigurationTreeWalker), typeof(ConfigurationTreeWalker));

            //ISerializerService serializerService = container.Resolve<ISerializerService>();
            //serializerService.AddNamespaceAttribute("defaultDeviceConfiguration", "DefaultDeviceConfigurationNS");
            //serializerService.AddNamespaceAttribute("defaultItemsGroup", "DefaultItemsGroupNS");
            //serializerService.AddNamespaceAttribute("defaultProperty", "DefaultPropertyNS");
            //serializerService.AddNamespaceAttribute("activatedConfigurationSetting",
            //    "ActivatedConfigurationSettingNS");
            //serializerService.AddNamespaceAttribute("dependentProperty", "DependentPropertyNS");
            //serializerService.AddNamespaceAttribute("dependancyCondition", "DependancyConditionNS");
            //serializerService.AddNamespaceAttribute("complexProperty", "ComplexPropertyNS");
            //serializerService.AddNamespaceAttribute("subProperty", "SubPropertyNS");
            //serializerService.AddNamespaceAttribute("localDeviceValuesConfigurationItemBase",
            //    "LocalDeviceValuesConfigurationItemBaseNS");
            //serializerService.AddNamespaceAttribute("deviceMemory",
            //    "ConfigurationMemoryNS");
            //serializerService.AddNamespaceAttribute("addressValue",
            //    "AddressValueNS");
            //serializerService.AddKnownTypeForSerializationRange(new[]
            //{
            //    typeof(DefaultDeviceConfiguration),
            //    typeof(DefaultItemsGroup), typeof(DefaultProperty),
            //    typeof(List<DefaultItemsGroup>), typeof(List<DefaultProperty>), typeof(ActivatedConfigurationSetting),
            //    typeof(DependentProperty), typeof(DependancyCondition), typeof(ComplexProperty), typeof(SubProperty),
            //    typeof(GroupWithReiterationInfo), typeof(ReiterationSubGroupInfo),
            //    typeof(List<ReiterationSubGroupInfo>),
            //    typeof(DeviceMemory)
            //});

            //регистрация ресурсов
            container.Resolve <IXamlResourcesService>()
            .AddResourceAsGlobal("Resources/ConfigurationTemplates.xaml", GetType().Assembly);

            container.Resolve <ILoadAllService>().RegisterFragmentLoadHandler(
                ApplicationGlobalNames.FragmentInjectcionStrings.RUNTIME_CONFIGURATION_VIEWMODEL,
                LoadAllConfigurationHelper.GetConFigurationLoadingHelper());
        }