public MainWindow() { InitializeComponent(); StreamResourceInfo dataStreamInfo = Application.GetResourceStream(new Uri("Data/GDPStatistic.xml", UriKind.RelativeOrAbsolute)); XmlGdpValueProvider valueProvider = new XmlGdpValueProvider(dataStreamInfo.Stream); DataContext = new MainViewModel(valueProvider); }
public MainViewModel(XmlGdpValueProvider valueProvider) { GdpValues = valueProvider.GetValues(); MinGdpValue = GdpValues.Min(gdp => gdp.Value); MaxGdpValue = GdpValues.Max(gdp => gdp.Value); StartYear = GdpValues.Min(gdp => gdp.Year); EndYear = GdpValues.Max(gdp => gdp.Year); CountryNames = GdpValues.Select(gdp => gdp.CountryName); ContinentNames = GdpValues.Select(gdp => gdp.ContinentName); }