public async Task OnListItemTapped(NotificationViewModel vm) { switch (vm.NotificationType) { // depending on notification type and other entries navigate to new page, or do something case NotificationType.Feature: // should be actioned by button press break; case NotificationType.FeatureUpdate: // should be actioned by button press break; case NotificationType.Offer: if (!string.IsNullOrWhiteSpace(vm.UrlLink)) { // Navigate to url in WebView } break; default: if (!string.IsNullOrWhiteSpace(vm.Message)) { // Navigate to Message page } break; } if (vm.IsUnread) { // change state to read vm.IsUnread = false; // update stored entry to persist the state (note: Notification has a Read property, not UnRead) await Settings.UpdateNotificationAsync(vm.Id, true); } }
public void AddNotification(NotificationViewModel notification) { _notificationCollection.Add(notification); OnPropertyChanged <ObservableCollection <NotificationViewModel> >(nameof(NotificationCollection)); }