public FormulaFormatterViewModel(ILocalizerService localizerService, ITypesContainer container, Func <IArgumentViewModel> argumentViewModelGettingFunc, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, IFormattingService formattingService) { _localizerService = localizerService; _container = container; _argumentViewModelGettingFunc = argumentViewModelGettingFunc; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; _formattingService = formattingService; ArgumentViewModels = new ObservableCollection <IArgumentViewModel>(); _formulaFormatter = _container.Resolve <IUshortsFormatter>(StringKeys.FORMULA_FORMATTER) as IFormulaFormatter; if (_formulaFormatter == null) { throw new ArgumentException(); } CheckCommand = new RelayCommand(OnCheckCommandExecute); DeleteArgumentCommand = new RelayCommand <IArgumentViewModel>(OnDeleteArgumentExecute); AddArgumentCommand = new RelayCommand(OnAddArgumentExecute); _formulaFormatter.NumberOfSimbolsAfterComma = 3; InitializeFormulaTooltip(); }
public ConfigurationEditorViewModelValidator(IFormatterEditorFactory formatterEditorFactory, ILocalizerService localizerService, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel) { _formatterEditorFactory = formatterEditorFactory; _localizerService = localizerService; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; }
public CompareResourceConditionViewModel(ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, List <string> conditionsList) { _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; SelectPropertyFromResourceCommand = new RelayCommand(OnSelectPropertyFromResourceExecute); ConditionsList = conditionsList; }
public BoolToAddressDependencyViewModel(IFormatterEditorFactory formatterEditorFactory, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel) { _formatterEditorFactory = formatterEditorFactory; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; ShowFormatterParametersIfTrueCommand = new RelayCommand(OnShowFormatterParametersIfTrueExecute); ShowFormatterParametersIfFalseCommand = new RelayCommand(OnShowFormatterParametersIfFalseExecute); SetResourceToDependencyCommand = new RelayCommand(OnSetResourceToDependencyExecute); }
public MeasuringElementEditorViewModelFactory(ITypesContainer container, IMeasuringElementFactory measuringElementFactory, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, IFormatterEditorFactory formatterEditorFactory) { _container = container; _measuringElementFactory = measuringElementFactory; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; _formatterEditorFactory = formatterEditorFactory; }
public void ValidateEditorPropertySharedResourceRegexWithResourceIsNotString() { IResultingDeviceViewModel initialDevice = Program.GetApp().Container.Resolve <IResultingDeviceViewModel>(); var configurationEditorViewModel = _typesContainer.Resolve <IFragmentEditorViewModel>( ApplicationGlobalNames.FragmentInjectcionStrings.CONFIGURATION + ApplicationGlobalNames.CommonInjectionStrings.EDITOR_VIEWMODEL) as ConfigurationEditorViewModel; var deviceSharedResources = new DeviceSharedResources(); ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel = _typesContainer.Resolve <ISharedResourcesGlobalViewModel>(); sharedResourcesGlobalViewModel.InitializeFromResources(deviceSharedResources); var rootGroup = new ConfigurationGroupEditorViewModel() { Name = "root" }; configurationEditorViewModel.RootConfigurationItemViewModels.Add(rootGroup); var property = EditorHelpers.AddPropertyViewModel(rootGroup.ChildStructItemViewModels, 1, _typesContainer); property.FormatterParametersViewModel.RelatedUshortsFormatterViewModel = new BoolFormatterViewModel(); property.Name = "Pupa"; configurationEditorViewModel.SelectedRow = property; sharedResourcesGlobalViewModel.AddAsSharedResourceWithContainer(property, null, false); property.Parent = rootGroup; var property2 = EditorHelpers.AddPropertyViewModel(rootGroup.ChildStructItemViewModels, 2, _typesContainer); property2.DependencyViewModels.Add( new ConditionResultDependencyViewModel(new List <IResultViewModel>(), new List <IConditionViewModel>()) { SelectedConditionViewModel = new RegexMatchConditionViewModel( _typesContainer.Resolve <ISharedResourcesGlobalViewModel>()) { ReferencedResourcePropertyName = "Pupa" } }); initialDevice.FragmentEditorViewModels .Add(configurationEditorViewModel); var res = _typesContainer.Resolve <IDeviceEditorViewModelValidator>() .ValidateDeviceEditor(new List <IFragmentEditorViewModel>() { configurationEditorViewModel }); Assert.True(res.Count == 1); }
public void EditorCopyPropAsSharedResources() { var configurationEditorViewModel = _typesContainer.Resolve <IFragmentEditorViewModel>( ApplicationGlobalNames.FragmentInjectcionStrings.CONFIGURATION + ApplicationGlobalNames.CommonInjectionStrings.EDITOR_VIEWMODEL) as ConfigurationEditorViewModel; var deviceSharedResources = new DeviceSharedResources(); ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel = _typesContainer.Resolve <ISharedResourcesGlobalViewModel>(); sharedResourcesGlobalViewModel.InitializeFromResources(deviceSharedResources); var rootGroup = new ConfigurationGroupEditorViewModel() { Name = "root" }; configurationEditorViewModel.RootConfigurationItemViewModels.Add(rootGroup); var addedRow = AddPropertyViewModel(rootGroup.ChildStructItemViewModels, 1, _typesContainer); configurationEditorViewModel.SelectedRows = new List <IEditorConfigurationItemViewModel>() { addedRow }; sharedResourcesGlobalViewModel.AddAsSharedResourceWithContainer(addedRow, null, false); configurationEditorViewModel.CopyElementCommand.Execute(null); configurationEditorViewModel.SelectedRow = rootGroup; Assert.True(configurationEditorViewModel.PasteAsChildElementCommand.CanExecute(null)); configurationEditorViewModel.PasteAsChildElementCommand.Execute(null); var copiedRow = rootGroup.ChildStructItemViewModels[1]; configurationEditorViewModel.SelectedRow = (IEditorConfigurationItemViewModel)copiedRow; Assert.True( (configurationEditorViewModel.AddSelectedElementAsResourceCommand as RelayCommand).CanExecute(null)); var result = ConfigurationFragmentFactory.CreateConfiguration(configurationEditorViewModel); Assert.AreEqual(result.RootConfigurationItemList.Count, 1); var itemList = (result.RootConfigurationItemList[0] as DefaultItemsGroup).ConfigurationItemList; CheckPropertyResultProperty(itemList, 1); CheckPropertyResultProperty(itemList, 1, 1); Assert.AreEqual(itemList.Count, 2); }
public MissingDependenciesConfigurationValidator(IFormatterEditorFactory formatterEditorFactory, ILocalizerService localizerService, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, IDependenciesService dependenciesService, DependencyFillHelper dependencyFillHelper) { _formatterEditorFactory = formatterEditorFactory; _localizerService = localizerService; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; _dependenciesService = dependenciesService; _dependencyFillHelper = dependencyFillHelper; }
public ConnectionStateViewModel(ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, IComPortConfigurationViewModel comPortConfigurationViewModel) { this._sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; this.SelectTestConnectionProperty = new RelayCommand(this.OnSelectTestConnectionExecute); this.SubmitCommand = new RelayCommand <object>(this.OnSubmitExecute); this.CancelCommand = new RelayCommand <object>(this.OnCancelExecute); this.ExpectedValues = new ObservableCollection <StringWrapper>(); this.DeleteExpectedValueCommand = new RelayCommand <object>(this.OnDeleteExpectedValueExecute); this.AddExpectedValueCommand = new RelayCommand(this.OnAddExpectedValueExecute); this.DefaultComPortConfigurationViewModel = comPortConfigurationViewModel; }
public RegexConditionsValidator(IFormatterEditorFactory formatterEditorFactory, ILocalizerService localizerService, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, IDependenciesService dependenciesService, DependencyFillHelper dependencyFillHelper, IFormatterInfoService formatterInfoService) { _formatterEditorFactory = formatterEditorFactory; _localizerService = localizerService; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; _dependenciesService = dependenciesService; _dependencyFillHelper = dependencyFillHelper; _formatterInfoService = formatterInfoService; }
public AnalogMeasuringElementEditorViewModel(IFormatterEditorFactory formatterEditorFactory, IApplicationGlobalCommands applicationGlobalCommands, IDependenciesService dependenciesService, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel) { _formatterEditorFactory = formatterEditorFactory; _applicationGlobalCommands = applicationGlobalCommands; _dependenciesService = dependenciesService; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; ShowFormatterParametersCommand = new RelayCommand(OnShowFormatterParametersExecute); ShowDependenciesCommand = new RelayCommand(OnShowDependenciesExecute); }
private void InitializeProperty(IPropertyEditorViewModel editorPropertyViewModel, IProperty property) { editorPropertyViewModel.IsMeasureUnitEnabled = property.IsMeasureUnitEnabled; editorPropertyViewModel.MeasureUnit = property.MeasureUnit; editorPropertyViewModel.IsRangeEnabled = property.IsRangeEnabled; if (property.IsRangeEnabled) { IRangeViewModel rangeViewModel = _container.Resolve <IRangeViewModel>(); rangeViewModel.RangeFrom = property.Range.RangeFrom.ToString(); rangeViewModel.RangeTo = property.Range.RangeTo.ToString(); editorPropertyViewModel.RangeViewModel = rangeViewModel; } editorPropertyViewModel.Address = property.Address.ToString(); editorPropertyViewModel.NumberOfPoints = property.NumberOfPoints.ToString(); var formatterParametersViewModel = StaticContainer.Container.Resolve <IFormatterViewModelFactory>() .CreateFormatterViewModel(property.UshortsFormatter); editorPropertyViewModel.FormatterParametersViewModel = formatterParametersViewModel; editorPropertyViewModel.NumberOfWriteFunction = property.NumberOfWriteFunction; ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel = StaticContainer.Container.Resolve <ISharedResourcesGlobalViewModel>(); if (sharedResourcesGlobalViewModel.CheckDeviceSharedResourcesWithContainersContainsModel(property)) { sharedResourcesGlobalViewModel.AddExistingResourceWithContainer(editorPropertyViewModel, property); } if (property.Dependencies != null && property.Dependencies.Count > 0) { editorPropertyViewModel.DependencyViewModels.Clear(); editorPropertyViewModel.DependencyViewModels.AddCollection(property.Dependencies .Select(_container.Resolve <DependencyFillHelper>().CreateDependencyViewModel).ToList()); } editorPropertyViewModel.IsFromBits = property.IsFromBits; if (editorPropertyViewModel.BitNumbersInWord != null) { property.BitNumbers.ForEach(bitNum => editorPropertyViewModel.BitNumbersInWord.First(model => model.BitNumber == bitNum).IsChecked = true); } if (editorPropertyViewModel is ICanBeHidden canBeHidden) { canBeHidden.IsHidden = property.IsHidden; } InitializeBaseProperties(editorPropertyViewModel, property); }
public void EditorAllFormattersPropFromSharedResourcesSave() { var configurationEditorViewModel = _typesContainer.Resolve <IFragmentEditorViewModel>( ApplicationGlobalNames.FragmentInjectcionStrings.CONFIGURATION + ApplicationGlobalNames.CommonInjectionStrings.EDITOR_VIEWMODEL) as ConfigurationEditorViewModel; var deviceSharedResources = new DeviceSharedResources(); ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel = _typesContainer.Resolve <ISharedResourcesGlobalViewModel>(); sharedResourcesGlobalViewModel.InitializeFromResources(deviceSharedResources); CreateFormatterParametersForResourcesViewModel(1); CreateFormatterParametersForResourcesViewModel(2); CreateFormatterParametersForResourcesViewModel(3); CreateFormatterParametersForResourcesViewModel(4); CreateFormatterParametersForResourcesViewModel(5); CreateFormatterParametersForResourcesViewModel(6); var rootGroup = new ConfigurationGroupEditorViewModel() { Name = "root" }; AddPropertyWithFormatterFromResourceViewModel(rootGroup.ChildStructItemViewModels, 1); AddPropertyWithFormatterFromResourceViewModel(rootGroup.ChildStructItemViewModels, 2); AddPropertyWithFormatterFromResourceViewModel(rootGroup.ChildStructItemViewModels, 3); AddPropertyWithFormatterFromResourceViewModel(rootGroup.ChildStructItemViewModels, 4); AddPropertyWithFormatterFromResourceViewModel(rootGroup.ChildStructItemViewModels, 5); AddPropertyWithFormatterFromResourceViewModel(rootGroup.ChildStructItemViewModels, 6); configurationEditorViewModel.RootConfigurationItemViewModels.Add(rootGroup); var result = ConfigurationFragmentFactory.CreateConfiguration(configurationEditorViewModel); Assert.AreEqual(result.RootConfigurationItemList.Count, 1); var itemList = (result.RootConfigurationItemList[0] as DefaultItemsGroup).ConfigurationItemList; CheckPropertyResultProperty(itemList, 1); CheckPropertyResultProperty(itemList, 2); CheckPropertyResultProperty(itemList, 3); CheckPropertyResultProperty(itemList, 4); CheckPropertyResultProperty(itemList, 5); CheckPropertyResultProperty(itemList, 6); Assert.AreEqual(itemList.Count, 6); }
private void CreateFormatterParametersForResourcesViewModel(int identity) { ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel = _typesContainer.Resolve <ISharedResourcesGlobalViewModel>(); var formatterViewModel = CreateFormatterViewModel(identity, _typesContainer); sharedResourcesGlobalViewModel.AddAsSharedResource(new FormatterParametersViewModel() { IsFromSharedResources = false, Name = "formatter" + identity, RelatedUshortsFormatterViewModel = formatterViewModel }, false); ISaveFormatterService saveFormatterService = _typesContainer.Resolve <ISaveFormatterService>(); IUshortsFormatter resourceUshortsFormatter = saveFormatterService.CreateUshortsParametersFormatter(formatterViewModel); resourceUshortsFormatter.Name = "formatter" + identity; sharedResourcesGlobalViewModel.UpdateSharedResource(resourceUshortsFormatter); }
public ResultingDeviceViewModel(IDevice device, ITypesContainer container, ILocalizerService localizerService, IDeviceSharedResources deviceSharedResources, IApplicationGlobalCommands applicationGlobalCommands, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, IFragmentEditorViewModelFactory fragmentEditorViewModelFactory, IConnectionStateViewModelFactory connectionStateViewModelFactory, ISerializerService serializerService) { _device = device; _container = container; _deviceSharedResources = deviceSharedResources; _applicationGlobalCommands = applicationGlobalCommands; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; _fragmentEditorViewModelFactory = fragmentEditorViewModelFactory; _connectionStateViewModelFactory = connectionStateViewModelFactory; _serializerService = serializerService; DeviceName = localizerService.GetLocalizedString(ApplicationGlobalNames.DefaultStringsForUi.NEW_DEVICE_STRING); FragmentEditorViewModels = new ObservableCollection <IFragmentEditorViewModel>(); sharedResourcesGlobalViewModel.InitializeFromResources(deviceSharedResources); NavigateToConnectionTestingCommand = new RelayCommand(OnNavigateToConnectionTestingExecute); }
public ConditionFillHelper(ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel) { _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; }
public DiscretMeasuringElementEditorViewModel(IBitAddressEditorViewModel bitAddressEditorViewModel, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel) { _bitAddressEditorViewModel = bitAddressEditorViewModel; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; AddAsResourceCommand = new RelayCommand(OnAddAsResource); }
public ConfigurationEditorViewModel( IApplicationGlobalCommands applicationGlobalCommands, Func <IElementAddingCommand> elementAddingCommandAddingFunc, IFormatterEditorFactory formatterEditorFactory, IFragmentSettingsViewModel fragmentSettingsViewModel, ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel, IDependenciesService dependenciesService, DependencyFillHelper dependencyFillHelper, BaseValuesFillHelper baseValuesFillHelper, ImportPropertiesFromExcelTypeAHelper importPropertiesFromExcelTypeAHelper ) { _allRows = new ObservableCollection <IConfigurationItemViewModel>(); _applicationGlobalCommands = applicationGlobalCommands; _formatterEditorFactory = formatterEditorFactory; _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; _dependenciesService = dependenciesService; _dependencyFillHelper = dependencyFillHelper; _baseValuesFillHelper = baseValuesFillHelper; _importPropertiesFromExcelTypeAHelper = importPropertiesFromExcelTypeAHelper; FragmentSettingsViewModel = fragmentSettingsViewModel; RootConfigurationItemViewModels = new ObservableCollection <IConfigurationItemViewModel>(); ElementsAddingCommandCollection = new ObservableCollection <IElementAddingCommand>(); AddRootElementCommand = new RelayCommand(OnAddRootElement); AddRootGroupElementCommand = new RelayCommand(OnAddRootGroupElementExecute); IElementAddingCommand command = elementAddingCommandAddingFunc(); command.Name = "AddChildElement"; command.AddingCommand = new RelayCommand(OnAddChildElementExecute, CanExecuteAddChildElement); ElementsAddingCommandCollection.Add(command); command = elementAddingCommandAddingFunc(); command.Name = "AddChildGroup"; command.AddingCommand = new RelayCommand(OnAddChildGroupElementExecute, CanExecuteAddChildGroupElement); ElementsAddingCommandCollection.Add(command); EditElementCommand = new RelayCommand(OnEditElementExecute, CanExecuteEditElement); DeleteElementCommand = new RelayCommand(OnDeleteElementExecute, CanExecuteDeleteElement); ShowFormatterParametersCommand = new RelayCommand(OnShowFormatterParametersExecute, CanExecuteShowFormatterParameters); SetElementDownCommand = new RelayCommand(OnSetElementDownExecute, CanExecuteSetElementDown); SetElementUpCommand = new RelayCommand(OnSetElementUpExecute, CanExecuteSetElementUp); OpenConfigurationSettingsCommand = new RelayCommand(OnOpenConfigurationSettingsExecute); CopyElementCommand = new RelayCommand(OnCopyElementExecute, CanExecuteCopyElement); CutElementCommand = new RelayCommand(OnCutElementExecute, CanExecuteCutElement); PasteAsChildElementCommand = new RelayCommand(OnPasteAsChildElementExecute, CanPasteAsChildElementElement); AddSelectedElementAsResourceCommand = new RelayCommand(OnAddSelectedElementAsResourceExecute, CanExecuteAddSelectedElementAsResource); ShowDependenciesCommand = new RelayCommand(OnShowDependenciesExecute, CanExecuteShowDependencies); ShowFiltersCommand = new RelayCommand(OnShowFiltersExecute, CanExecuteShowFilters); EditDescriptionCommand = new RelayCommand(OnEditDescriptionExecute, CanExecuteEditDescription); IncreaseAddressCommand = new RelayCommand(() => OnChangeAddress(true), () => SelectedRows.All(model => model is IAddressChangeable)); DecreaseAddressCommand = new RelayCommand(() => OnChangeAddress(false), () => SelectedRows.All(model => model is IAddressChangeable)); AddDependencyToManyProps = new RelayCommand(OnAddDependencyToManyPropsExecute, CanExecuteAddDependencyToManyProps); TriggerAdditionalSettingsCommand = new RelayCommand(() => { IsAdditionalSettingsOpened = true; }); AddressIteratorValue = 1; OnSelectionChangedCommand = new RelayCommand <object>(OnSelectionChangedExecute); SelectedRows = new List <IEditorConfigurationItemViewModel>(); OpenBasicValuesCommand = new RelayCommand(OnOpenBasicValuesExacute); MigrateComplexPropertiesCommand = new RelayCommand(OnMigrateComplexPropertiesExecute); BaseValuesViewModel = new BaseValuesViewModel(); ImportPropertiesFromExcelTypeACommand = new RelayCommand(OnImportPropertiesFromExcelTypeAExecute); EditCommand = new RelayCommand(OnEditExecute); SetIsFromBitsToManyPropsViewModel = new SetIsFromBitsToManyPropsViewModel(this); }
public RegexMatchConditionViewModel(ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel) { _sharedResourcesGlobalViewModel = sharedResourcesGlobalViewModel; SelectPropertyFromResourceCommand = new RelayCommand(OnSelectPropertyFromResourceExecute); }
public void ValidateEditorRemovePropertySharedResource() { IResultingDeviceViewModel initialDevice = Program.GetApp().Container.Resolve <IResultingDeviceViewModel>(); var configurationEditorViewModel = _typesContainer.Resolve <IFragmentEditorViewModel>( ApplicationGlobalNames.FragmentInjectcionStrings.CONFIGURATION + ApplicationGlobalNames.CommonInjectionStrings.EDITOR_VIEWMODEL) as ConfigurationEditorViewModel; var deviceSharedResources = new DeviceSharedResources(); ISharedResourcesGlobalViewModel sharedResourcesGlobalViewModel = _typesContainer.Resolve <ISharedResourcesGlobalViewModel>(); sharedResourcesGlobalViewModel.InitializeFromResources(deviceSharedResources); var rootGroup = new ConfigurationGroupEditorViewModel() { Name = "root" }; configurationEditorViewModel.RootConfigurationItemViewModels.Add(rootGroup); var property = EditorHelpers.AddPropertyViewModel(rootGroup.ChildStructItemViewModels, 1, _typesContainer); property.Name = "Pupa"; configurationEditorViewModel.SelectedRow = property; sharedResourcesGlobalViewModel.AddAsSharedResourceWithContainer(property, null, false); property.Parent = rootGroup; property.DeleteElement(); var property2 = EditorHelpers.AddPropertyViewModel(rootGroup.ChildStructItemViewModels, 2, _typesContainer); property2.DependencyViewModels.Add( new ConditionResultDependencyViewModel(new List <IResultViewModel>(), new List <IConditionViewModel>()) { SelectedConditionViewModel = new CompareResourceConditionViewModel( _typesContainer.Resolve <ISharedResourcesGlobalViewModel>(), new List <string>(Enum.GetNames(typeof(ConditionsEnum)))) { ReferencedResourcePropertyName = "Pupa" } }); initialDevice.FragmentEditorViewModels .Add(configurationEditorViewModel); var res = _typesContainer.Resolve <IDeviceEditorViewModelValidator>() .ValidateDeviceEditor(new List <IFragmentEditorViewModel>() { configurationEditorViewModel }); Assert.True(res.Count == 1); Assert.True(res[0].ErrorMessage.Contains(ApplicationGlobalNames.StatusMessages.RESOURCE_FOR_DEPENDENCY_NOT_FOUND_MESSAGE)); }
public FormatterSelectionViewModel(ITypesContainer container, List <IUshortFormattableEditorViewModel> ushortFormattableViewModels, List <IConfigurationItemViewModel> rootConfigurationItemViewModels) { CurrentResourceString = null; _container = container; _ushortFormattableViewModel = ushortFormattableViewModels; _sharedResourcesGlobalViewModel = _container.Resolve <ISharedResourcesGlobalViewModel>(); _ushortsFormatterViewModels = new ObservableCollection <IUshortsFormatterViewModel>(); UshortsFormatterViewModels.AddCollection(_container.ResolveAll <IUshortsFormatterViewModel>()); BitNumbersInWord = new ObservableCollection <IBitViewModel>(); // for (int i = 15; i >= 0; i--) // { // IBitViewModel bitViewModel = new BitViewModel(i, true); // BitNumbersInWord.Add(bitViewModel); //} IsBitsEditingEnabled = false; if (ushortFormattableViewModels.Count == 1) { var ushortFormattableViewModel = ushortFormattableViewModels.First(); if (ushortFormattableViewModel is IBitsConfigViewModel bitsConfigViewModel) { BitNumbersInWord.AddCollection( BitOwnershipHelper.CreateBitViewModelsWithOwnership(bitsConfigViewModel, rootConfigurationItemViewModels)); bitsConfigViewModel.CopyBitsTo(this); IsBitsEditingEnabled = true; } if (ushortFormattableViewModel.FormatterParametersViewModel != null) { if (_sharedResourcesGlobalViewModel.GetResourceViewModelByName( ushortFormattableViewModel.FormatterParametersViewModel.Name).IsSuccess) { CurrentResourceString = ushortFormattableViewModel.FormatterParametersViewModel.Name; _isFormatterFromResource = true; ushortFormattableViewModel.FormatterParametersViewModel.RelatedUshortsFormatterViewModel = container.Resolve <IFormatterViewModelFactory>().CreateFormatterViewModel( _sharedResourcesGlobalViewModel.GetResourceByName(_currentResourceString) as IUshortsFormatter).RelatedUshortsFormatterViewModel; } var formatter = _ushortsFormatterViewModels.FirstOrDefault(f => f.StrongName == ushortFormattableViewModel.FormatterParametersViewModel .RelatedUshortsFormatterViewModel.StrongName); var existingIndex = _ushortsFormatterViewModels.IndexOf(formatter); _ushortsFormatterViewModels.RemoveAt(existingIndex); _ushortsFormatterViewModels.Insert(existingIndex, ushortFormattableViewModel.FormatterParametersViewModel.RelatedUshortsFormatterViewModel); SelectedUshortsFormatterViewModel = ushortFormattableViewModel.FormatterParametersViewModel .RelatedUshortsFormatterViewModel; } } CancelCommand = new RelayCommand <object>(OnCancelExecute); OkCommand = new RelayCommand <object>(OnOkExecute); ResetCommand = new RelayCommand(OnResetExecute); AddAsResourceCommand = new RelayCommand(OnAddAsResourceExecute); SelectFromResourcesCommand = new RelayCommand(OnSelectFromResourcesExecute); }