public static NotificationVM FromPropertyName(string propertyName) { NotificationVM notificationVM = new NotificationVM(); typeof(NotificationVM).GetProperty(propertyName).SetValue(notificationVM, true); notificationVM.SortIndex = NotificationVM.NotificationSortIndex[propertyName]; return(notificationVM); }
private void InsertOrRemoveNotification(string propertyName, bool insert) { if (insert) { this.Notifications.Add(NotificationVM.FromPropertyName(propertyName)); this.Notifications.Sort(this._notificationsComparer); } else { NotificationVM notificationVM = this.Notifications.SingleOrDefault((NotificationVM n) => (bool)typeof(NotificationVM).GetProperty(propertyName).GetValue(n)); bool flag = notificationVM != null; if (flag) { this.Notifications.Remove(notificationVM); } } }