public MainWindow() { //var chart = new LineChart(); InitializeComponent(); this.WindowState = System.Windows.WindowState.Maximized; this.DataContext = this; digitalCurrenciesList = parser.parse("digital_currencies.txt"); physicalCurrenciesList = parser.parse("physical_currencies.txt"); stocksList = parser.parse("stocks.txt"); chosenDigitalList = new ObservableCollection <CurrencyClass>(); chosenPhysicalList = new ObservableCollection <CurrencyClass>(); chosenStockList = new ObservableCollection <CurrencyClass>(); referentCurrenciesList = physicalCurrenciesList; shownCurrenciesList = new ObservableCollection <ShowingCurrencyClass>(); referentCurrency = new CurrencyClass(); loadData(); }
private void loadData() { using (StreamReader cit = new StreamReader(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\files\\savings.txt")) { string line = cit.ReadLine(); if (line != null) { string[] lista = line.Split(','); updateInterval = Double.Parse(lista[0]); string indexUpd = lista[1]; line = cit.ReadLine(); lista = line.Split(','); historyInterval = lista[0]; string indexHist = lista[1]; line = cit.ReadLine(); lista = line.Split(','); referentCurrency.Symbol = lista[0]; referentCurrency.Name = lista[1]; string indexRef = lista[2]; cit.ReadLine(); while ((line = cit.ReadLine()) != "ChosenPhysical") { lista = line.Split(','); CurrencyClass cc = new CurrencyClass(); cc.Symbol = lista[0]; cc.Name = lista[1]; cc.Client = new LoadJSON(); cc.startTiming(updateInterval); foreach (CurrencyClass cur in digitalCurrenciesList) { if (cur.Symbol.Equals(cc.Symbol)) { cur.CheckedBox = true; } } chosenDigitalList.Insert(0, cc); } while ((line = cit.ReadLine()) != "ChosenStock") { lista = line.Split(','); CurrencyClass cc = new CurrencyClass(); cc.Symbol = lista[0]; cc.Name = lista[1]; cc.Client = new LoadJSON(); cc.startTiming(updateInterval); foreach (CurrencyClass cur in physicalCurrenciesList) { if (cur.Symbol.Equals(cc.Symbol)) { cur.CheckedBox = true; } } chosenPhysicalList.Insert(0, cc); } while ((line = cit.ReadLine()) != "Shown") { lista = line.Split(','); CurrencyClass cc = new CurrencyClass(); cc.Symbol = lista[0]; cc.Name = lista[1]; foreach (CurrencyClass cur in stocksList) { if (cur.Symbol.Equals(cc.Symbol)) { cur.CheckedBox = true; } } chosenStockList.Insert(0, cc); } while ((line = cit.ReadLine()) != null) { lista = line.Split(','); object o = Enum.Parse(typeof(CurrencyIntervalType), lista[1]); loadJSON((CurrencyIntervalType)o, lista[0]); } cbRefCurrencies.SelectedIndex = int.Parse(indexRef); cbUpdateInterval.SelectedIndex = int.Parse(indexUpd); cbHistoryInterval.SelectedIndex = int.Parse(indexHist); } } }