// 磁贴更新----收支 private void UpdateTiles() { double incomes = 0, outcomes = 0; for (int i = 0; i < incomesList.AllIncomes.Count; i++) { if (incomesList.AllIncomes.ToArray()[i].date.Month == DateTimeOffset.Now.Month) { if (incomesList.AllIncomes.ToArray()[i].inOrOut == "支出") { outcomes += incomesList.AllIncomes.ToArray()[i].amount; } else { incomes += incomesList.AllIncomes.ToArray()[i].amount; } } } App.UpdateTile(new TileBindingContentAdaptive() { Children = { new TileText() { Text = "本月支出", Style = TileTextStyle.CaptionSubtle }, new TileText() { Text = outcomes.ToString() + "元", Style = TileTextStyle.Caption }, new TileText() { Text = "本月收入", Style = TileTextStyle.CaptionSubtle }, new TileText() { Text = incomes.ToString() + "元", Style = TileTextStyle.Caption } } }, 0); }
// 磁贴更新----goalslist private void UpdateWideTile() { Models.Goal firstUnfinishedGoal = goalsList.getFirstUnfinishedGoal(); if (firstUnfinishedGoal != null) { App.UpdateTile(new TileBindingContentAdaptive() { Children = { new TileText() { Text = "最新目标", Style = TileTextStyle.SubtitleSubtle }, new TileText() { Text = firstUnfinishedGoal.goalName, Style = TileTextStyle.Subtitle }, //new TileText() //{ // Text = firstUnfinishedGoal.description, // Style = TileTextStyle.CaptionSubtle //}, new TileText() { Text = firstUnfinishedGoal.dueTime.ToString("yyyy/MM/dd dddd"), Style = TileTextStyle.CaptionSubtle } //new TileImage() //{ // Source = new TileImageSource("ms-appdata:///local/Projects/03509dce-9bf3-47c8-be42-7cd32ce458b4/Slides/" + firstUnfinishedGoal.imageName), // Align = TileImageAlign.Left //} } }, 1); } else { TileUpdateManager.CreateTileUpdaterForApplication().Clear(); } }