public IEditorConfigurationItemViewModel VisitSubProperty(ISubProperty subProperty) { var res = _container.Resolve <ISubPropertyEditorViewModel>(); if (subProperty == null) { InitializeBaseProperties(res, subProperty); return(res); } InitializeProperty(res, subProperty); return(res); //res.BitNumbersInWord = subProperty.BitNumbersInWord }
//public override async Task<bool> Write() //{ // bool isToWrite = false; // if (this.LocalUshortsValue == null) return false; // foreach (ISubProperty subProperty in SubProperties) // { // if (!subProperty.IsValuesEqual) // { // isToWrite = true; // } // } // if (isToWrite) // { // this.LocalUshortsValue = GetParentLocalUshortsFromChildren(SubProperties); // if (_dataProvider is IQuickMemoryAccessDataProviderStub) // { // List<int> bitNumbers = new List<int>(); // SubProperties.ForEach((property => bitNumbers.AddRange(property.BitNumbersInWord))); // await (_dataProvider as IQuickMemoryAccessDataProviderStub).WriteMultipleRegistersByBitNumbersAsync( // Address, this.LocalUshortsValue, "WritingComplexProperty", bitNumbers); // } // else // { // return await base.Write(); // } // } // return isToWrite; //} // IQueryResult queryResult = this._queryResultFactory.CreateDefaultQueryResult(); //if (this.IsMemoryValuesSetsContainsAddress(startAddress)) //{ // bool[] bitArrayToWrite = dataToWrite.GetBoolArrayFromUshortArray(); // bool[] bitArrayExisting = // (new[] { this.GetValueFromMemoryValuesSets(startAddress) }).GetBoolArrayFromUshortArray(); // for (int i = 0; i < bitArrayToWrite.Length; i++) // { // if (bitNumbers.Contains(i)) // { // bitArrayExisting[i] = bitArrayToWrite[i]; // } // } // this.SetValueFromMemoryValuesSets(startAddress, bitArrayExisting.BoolArrayToUshort()); //} //queryResult.IsSuccessful = true; //return queryResult; //private ushort[] GetParentLocalUshortsFromChildren(List<ISubProperty> subProperties) //{ // foreach (ISubProperty subProperty in subProperties) // { // BitArray subPropertyBitArray = new BitArray(new int[] { subProperty.LocalUshortsValue[0] }); // foreach (int bitNum in subProperty.BitNumbersInWord) // { // _baseBools[bitNum] = subPropertyBitArray[subProperty.BitNumbersInWord.IndexOf(bitNum)]; // } // } // return new[] { (ushort)(new BitArray(_baseBools).GetIntFromBitArray()) }; //} protected override IConfigurationItem OnCloning() { ComplexProperty complexProperty = new ComplexProperty(); SubProperties.ForEach((property => { ISubProperty subProperty = property.Clone() as ISubProperty; complexProperty.SubProperties.Add(subProperty); })); complexProperty.UshortsFormatter = UshortsFormatter; complexProperty.Address = Address; complexProperty.NumberOfPoints = NumberOfPoints; complexProperty.MeasureUnit = MeasureUnit; complexProperty.IsMeasureUnitEnabled = IsMeasureUnitEnabled; complexProperty.Range = Range.Clone() as IRange; complexProperty.IsRangeEnabled = IsRangeEnabled; return(complexProperty); }
public Result VisitSubProperty(ISubProperty subProperty) { throw new System.NotImplementedException(); }
public IConfigurationItem ResolveSubPropertyItem() { ISubProperty subProperty = _container.Resolve(typeof(ISubProperty)) as ISubProperty; return(subProperty); }