Exemple #1
0
            internal ReadingCollectionDto CreateDto()
            {
                ReadingCollectionDto dto = new ReadingCollectionDto();

                dto.MaxReadings = this.maxSize;
                foreach (Reading reading in this.readings)
                {
                    dto.Add(reading.CreateDto());
                }
                return(dto);
            }
Exemple #2
0
        private ReadingCollectionDto ReadAccumulatedReadings()
        {
            ReadingCollectionDto dto = new ReadingCollectionDto();

            if (this.reader.IsEmptyElement != true)
            {
                this.reader.Read();

                do
                {
                    this.reader.Read();

                    ReadingDto reading = new ReadingDto();

                    // Value
                    this.reader.ReadStartElement("Value");
                    reading.Value = this.reader.ReadContentAsDouble();
                    this.reader.ReadEndElement();

                    // Timestamp
                    this.reader.ReadStartElement("Timestamp");
                    reading.Timestamp = this.reader.ReadContentAsDateTime();
                    this.reader.ReadEndElement();

                    dto.Add(reading);
                } while (this.reader.ReadToNextSibling("Reading"));

                this.reader.ReadEndElement();
            }
            else
            {
                this.reader.Read();
            }

            return(dto);
        }