private void SyncHeader(Property prop) { try { Single goal = UserSettings.Current.GetGoal(prop); Amount total = Cache.GetPropertyTotal(date, prop); JournalViewHeaderVM header = GetHeader(prop); header.Value = total.ValueString(); if (Single.IsNaN(goal) || goal == 0) { header.SubHeader = ""; } else { var remaining = goal - total.ToSingle(); if (remaining < 0) { header.SubHeader = string.Format(AppResources.GoalOver, Floats.ToUIString(-remaining)); } else { header.SubHeader = string.Format(AppResources.GoalUnder, Floats.ToUIString(remaining)); } } } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public JournalViewHeaderVM GetHeader(Property prop) { JournalViewHeaderVM value; if (headers.TryGetValue(prop, out value)) { return(value); } value = new JournalViewHeaderVM(prop.FullCapitalizedText); headers.Add(prop, value); return(value); }