public void Initialize(List <IFormattedValue> formattedValues, IRecordTemplate recordTemplate) { this._formattedValues = formattedValues; this._recordTemplate = recordTemplate; int numberOfValue = 0; numberOfValue = this._recordTemplate.JournalParameters.IndexOf(this.OscilloscopeTags .First((tag => tag.TagKey == OscilloscopeKeys.LEN)).RelatedJournalParameter); this._oscillogramCountingsNumber = (int)Math.Ceiling((this._formattedValues[numberOfValue] as INumericValue).NumValue); numberOfValue = this._recordTemplate.JournalParameters.IndexOf(this.OscilloscopeTags .First((tag => tag.TagKey == OscilloscopeKeys.REZ)).RelatedJournalParameter); this._sizeOfCountingInWords = (int)Math.Ceiling((this._formattedValues[numberOfValue] as INumericValue).NumValue); numberOfValue = this._recordTemplate.JournalParameters.IndexOf(this.OscilloscopeTags .First((tag => tag.TagKey == OscilloscopeKeys.POINT)).RelatedJournalParameter); this._pointOfStart = (int)Math.Ceiling((this._formattedValues[numberOfValue] as INumericValue).NumValue); numberOfValue = this._recordTemplate.JournalParameters.IndexOf(this.OscilloscopeTags .First((tag => tag.TagKey == OscilloscopeKeys.AFTER)).RelatedJournalParameter); this._sizeAfter = (int)Math.Ceiling((this._formattedValues[numberOfValue] as INumericValue).NumValue); numberOfValue = this._recordTemplate.JournalParameters.IndexOf(this.OscilloscopeTags .First((tag => tag.TagKey == OscilloscopeKeys.BEGIN)).RelatedJournalParameter); this._beginAddresInData = (int)Math.Ceiling((this._formattedValues[numberOfValue] as INumericValue).NumValue); numberOfValue = this._recordTemplate.JournalParameters.IndexOf(this.OscilloscopeTags .First((tag => tag.TagKey == OscilloscopeKeys.DATATIME)).RelatedJournalParameter); if (!(this._formattedValues[numberOfValue] is ITimeValue)) { throw new ArgumentException("Time value not on right place"); } this._dataTimeJournalValue = (this._formattedValues[numberOfValue] as ITimeValue); numberOfValue = this._recordTemplate.JournalParameters.IndexOf(this.OscilloscopeTags .First((tag => tag.TagKey == OscilloscopeKeys.ALM)).RelatedJournalParameter); this._alarm = (this._formattedValues[numberOfValue]).AsString(); }
public async Task <IFormattedValue> VisitTimeFormatter(IUshortsFormatter formatter) { ITimeValue value = _typesContainer.Resolve <ITimeValue>(); IDefaultTimeFormatter timeFormatter = formatter as IDefaultTimeFormatter; value.NumberOfPointsInUse = timeFormatter.NumberOfPointsInUse; value.MillisecondsDecimalsPlaces = timeFormatter.MillisecondsDecimalsPlaces; for (int i = 0; i < timeFormatter.NumberOfPointsInUse; i++) { if (timeFormatter.YearPointNumber == i) { value.YearValue = _ushortsPayload[i]; } else if (timeFormatter.MonthPointNumber == i) { value.MonthValue = _ushortsPayload[i]; } else if (timeFormatter.DayInMonthPointNumber == i) { value.DayInMonthValue = _ushortsPayload[i]; } else if (timeFormatter.HoursPointNumber == i) { value.HoursValue = _ushortsPayload[i]; } else if (timeFormatter.MinutesPointNumber == i) { value.MinutesValue = _ushortsPayload[i]; } else if (timeFormatter.SecondsPointNumber == i) { value.SecondsValue = _ushortsPayload[i]; } else if (timeFormatter.MillisecondsPointNumber == i) { value.MillisecondsValue = _ushortsPayload[i]; } } return(value); }
public IEditableValueViewModel VisitTimeValue(ITimeValue timeValue) { throw new NotImplementedException(); }
public IFormattedValueViewModel VisitTimeValue(ITimeValue timeValue) { return(GetDefaultStringValue(timeValue)); }