public AddDataResult AddNewDataSource(VisualizationDataSource dataSource) { VisualizationDataSource oldDataSource = null; foreach (VisualizationDataSource innerDataSource in dataSources) { if (innerDataSource.ParameterName == dataSource.ParameterName) { oldDataSource = innerDataSource; break; } } if (oldDataSource != null) { Algorithms algorithm = oldDataSource.Algorithm; dataSources.Remove(oldDataSource); dataSource.Algorithm = algorithm; dataSource.Data = AnalyzeData(dataSource.Data); dataSources.Add(dataSource); return(AddDataResult.Replaced); } else if (dataSources.Count < DataSourceMaxCount) { dataSource.Data = AnalyzeData(dataSource.Data); dataSources.Add(dataSource); return(AddDataResult.Added); } else { return(AddDataResult.Skipped); } }
public AddDataResult AddNewDataSource(VisualizationDataSource dataSource) { VisualizationDataSource oldDataSource = null; foreach (VisualizationDataSource innerDataSource in dataSources) { if (innerDataSource.ParameterName == dataSource.ParameterName) { oldDataSource = innerDataSource; break; } } if (oldDataSource != null) { Algorithms algorithm = oldDataSource.Algorithm; dataSources.Remove(oldDataSource); dataSource.Algorithm = algorithm; dataSource.Data = AnalyzeData(dataSource.Data); dataSources.Add(dataSource); return AddDataResult.Replaced; } else if (dataSources.Count < DataSourceMaxCount) { dataSource.Data = AnalyzeData(dataSource.Data); dataSources.Add(dataSource); return AddDataResult.Added; } else { return AddDataResult.Skipped; } }