public override async void OnNavigatedTo(string parameter, NavigationMode mode, Dictionary<string, object> state) { Debug.WriteLine("In DetailPageViewModel OnNavigatedTo"); _repository = Repositories.MessageItemRepository.GetInstance(); await LoadRuntimeDataAsync(parameter); // Since we are viewing this item, set its status to 'Read' this.MessageItem.IsRead = true; await _repository.UpdateAsync(this.MessageItem); #region Remove corresponding item from Action Center // Also remove it from the Action Center if it is there //ToastNotificationManager.History.Remove(parameter); #endregion #region Sync Tile badge count with unread toasts count from Action Center //// Set the Badge count on the tile //var toasts = ToastNotificationManager.History.GetHistory(); //if (toasts != null) //{ // var count = toasts.Count(); // // Sync up the count on the tile // TileServices.SetBadgeCountOnTile(count); //} #endregion }
public override async void OnNavigatedTo(string parameter, NavigationMode mode, Dictionary <string, object> state) { Debug.WriteLine("In DetailPageViewModel OnNavigatedTo"); _repository = Repositories.MessageItemRepository.GetInstance(); await LoadRuntimeDataAsync(parameter); // Since we are viewing this item, set its status to 'Read' this.MessageItem.IsRead = true; await _repository.UpdateAsync(this.MessageItem); #region Remove corresponding item from Action Center // Also remove it from the Action Center if it is there //ToastNotificationManager.History.Remove(parameter); #endregion #region Sync Tile badge count with unread toasts count from Action Center //// Set the Badge count on the tile //var toasts = ToastNotificationManager.History.GetHistory(); //if (toasts != null) //{ // var count = toasts.Count(); // // Sync up the count on the tile // TileServices.SetBadgeCountOnTile(count); //} #endregion }
private async Task LoadRuntimeDataAsync() { _repository = Repositories.MessageItemRepository.GetInstance(); _repository.LoadData(); this.MessageItems.Clear(); foreach (var messageItem in _repository.GetAllMessageItems()) { this.MessageItems.Add(messageItem); } // Set the count on the simulated tile int unreadCount = (from m in this.MessageItems where !m.IsRead select m).Count(); this.TileSimulationBadgeCount = unreadCount; }
private async Task LoadRuntimeDataAsync() { _repository = Repositories.MessageItemRepository.GetInstance(); _repository.LoadData(); this.MessageItems.Clear(); foreach (var messageItem in _repository.GetAllMessageItems()) { this.MessageItems.Add(messageItem); } // Set the count on the simulated tile int unreadCount = (from m in this.MessageItems where !m.IsRead select m).Count(); this.TileSimulationBadgeCount = unreadCount; }