public void Measure() { var boxSize = Variable(PageVariables.BoxSize); // In order to add the measurements in the correct order // we save them temporarily in an array Measurement[] measurements = new Measurement[Elements.Count]; Parallel.ForEach(Elements, (e, _, i) => { e.Document = this; measurements[i] = e.Measure(boxSize); }); Measurements.AddRange(measurements); foreach (var element in PageItems) { element.Document = this; } }
protected Terminal(Terminal terminal) : base(terminal) { ConductingEquipment = terminal.ConductingEquipment; ConnectivityNode = terminal.ConnectivityNode; Measurements.AddRange(terminal.Measurements); }
public async Task<Measurements> GetMeasurementsAsync(string databaseName, ShowMeasurements command = null) { ThrowIfDisposed(); Ensure.That(databaseName, nameof(databaseName)).IsNotNullOrWhiteSpace(); var result = new Measurements(); var json = await GetMeasurementsJsonAsync(databaseName, command).ForAwait(); var data = Requester.JsonSerializer.Deserialize<InfluxDbResponse>(json); if (data?.Results == null || !data.Results.Any()) return result; foreach (var serie in data.Results.SelectMany(r => r.Series)) result.AddRange(serie.Values.Select(value => value.First.ToObject<string>()).ToArray()); return result; }