private void DrawCharts() { App.Current.Dispatcher.Invoke((System.Action) delegate { IncomeSeries = new SeriesCollection { new LineSeries { Title = "Income", Values = Income.AsChartValues(), Stroke = Brushes.LightGray, }, }; FluidLevelSeries = new SeriesCollection { new LineSeries { Title = "Fluid level", Values = FluidLevel.AsChartValues(), Stroke = Brushes.LightGray }, }; if (Hours.Count > 0) { WorkingSeries1 = new SeriesCollection { new LineSeries { Title = "Time", Values = Hours[0].Hours.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Hours.Count > 1) { WorkingSeries2 = new SeriesCollection { new LineSeries { Title = "Time", Values = Hours[1].Hours.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Hours.Count > 2) { WorkingSeries3 = new SeriesCollection { new LineSeries { Title = "Time", Values = Hours[2].Hours.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Flows.Count > 0) { FlowSeries1 = new SeriesCollection { new LineSeries { Title = "Flow", Values = Flows[0].Flows.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Flows.Count > 1) { FlowSeries2 = new SeriesCollection { new LineSeries { Title = "Flow", Values = Flows[1].Flows.AsChartValues(), Stroke = Brushes.LightGray }, }; } if (Flows.Count > 2) { FlowSeries3 = new SeriesCollection { new LineSeries { Title = "Flow", Values = Flows[2].Flows.AsChartValues(), Stroke = Brushes.LightGray }, }; } }); }