// 从数据库获取所有消费记录和用户设置 // 设置当月消费和当天消费 // 更新磁贴 private void FetchData() { try { dataEntries = DataBase.GetAllEntries(); userSetting = DataBase.GetUserSetting(); if (userSetting.Catagories == null) { DataBase.InitializeUserSetting(); userSetting = DataBase.GetUserSetting(); } currentMonth = new MonthData(DateTime.Now.Month, 0); FetchCurrentMonth(); todayData = GetDayDataOfMonth(DateTime.Now.Year, DateTime.Now.Month)[DateTime.Now.Day - 1]; UpdateTile(); } catch (Exception e) { Console.Error.WriteLine(e.ToString()); } }
// 返回当天的消费 public DayData GetTodaySpent() { todayData = GetDayDataOfMonth(DateTime.Now.Year, DateTime.Now.Month)[DateTime.Now.Day - 1]; return(todayData); }