public static double TotalCost(Currencies selectedCurrency) { LoadExchangeRates(); ObservableCollection <Cost> allCosts = DBFunctions.GetAllCosts(); double ttl = 0; foreach (var c in allCosts) { switch (selectedCurrency) { case Currencies.Euro: ttl += ToEuro(c.Currency, c.Value); break; case Currencies.Pound: ttl += ToPound(c.Currency, c.Value); break; case Currencies.Dollar: ttl += ToDollar(c.Currency, c.Value); break; case Currencies.Yen: ttl += ToYen(c.Currency, c.Value); break; } } return(ttl); }
private void UpdateCosts() { Currencies currency = SettingsHelper.GetCurrency(); AllCosts.ItemsSource = DBFunctions.GetAllCosts(); double tCost = CostConversions.TotalCost(currency); ColourTV(tCost, CstTotal); if (tCost < 0) { tCost = -tCost; } CstTotal.Text = DefaultVars.currency[(int)SettingsHelper.GetCurrency()] + tCost.ToString(DefaultVars.costFormat); }