public void UpdateLiveTile() { try { var todaysAmount = _drinkLogCache.GetTodaysAmount(); // set livetile var tileTemplate = NotificationsExtensions.TileContent.TileContentFactory.CreateTileSquare150x150Text01(); tileTemplate.TextHeading.Text = _resourceRepository.GetString("msgTodaysProgress"); tileTemplate.TextBody1.Text = string.Format(_resourceRepository.GetString("txtDailyGoal"), _unitHelper.GetAmount(_settingsStore.DailyGoal), _unitHelper.AmountText); tileTemplate.TextBody2.Text = string.Format(_resourceRepository.GetString("txtAchievedToday"), _unitHelper.GetAmount(todaysAmount), _unitHelper.AmountText); var tileTemplateWide = NotificationsExtensions.TileContent.TileContentFactory.CreateTileWide310x150Text01(); tileTemplateWide.TextHeading.Text = _resourceRepository.GetString("msgTodaysProgress"); tileTemplateWide.TextBody1.Text = string.Format(_resourceRepository.GetString("txtDailyGoal"), _unitHelper.GetAmount(_settingsStore.DailyGoal), _unitHelper.AmountText); tileTemplateWide.TextBody2.Text = string.Format(_resourceRepository.GetString("txtAchievedToday"), _unitHelper.GetAmount(todaysAmount), _unitHelper.AmountText); tileTemplateWide.Square150x150Content = tileTemplate; var updater = TileUpdateManager.CreateTileUpdaterForApplication(); updater.EnableNotificationQueue(true); updater.Clear(); updater.Update(new TileNotification(tileTemplateWide.GetXml())); } catch (Exception ex) { // suppress _log.Log(ex.Message, LogCacheLogLevel.Error); } }
private async void RefreshDailyAmount() { await _drinkLogRepository.SyncCacheEntriesAsync(); DailyGoal = _unitHelper.GetAmount(_settingsStore.DailyGoal).ToString(); var amount = _unitHelper.GetAmount(_drinkLogCache.GetTodaysAmount()); if (amount != DailyProgress) { DailyProgress = amount; } }