/* * public NotificationChain basicAdd(T element, NotificationChain msgs) * { * this.Add(element); * * if (element is InternalEObject && owner != null) * { * var oclelement = element as InternalEObject; * oclelement.eBasicSetContainer(owner, -1, null); * } * * return msgs; * } */ public NotificationChain basicAdd(T element, NotificationChain notifications) { if (isNotificationRequired()) { int index = Count; bool oldIsSet = this.notEmpty(); //doAddUnique(index, object); this.Add(element); NotificationImpl notification = new NotificationImpl(NotificationImpl.ADD, null, element, index, oldIsSet); //createNotification(Notification.ADD, null, object, index, oldIsSet); if (notifications == null) { notifications = notification; } else { notifications.add(notification); } } else { //doAddUnique(size, object); this.Add(element); } return(notifications); }
public NotificationChain basicRemove(T element, NotificationChain notifications) { //int index = indexOf(object); //if (index != -1) if (this.Contains(element)) { if (isNotificationRequired()) { //bool oldIsSet = isSet(); bool oldIsSet = this.Count != 0; //Object oldObject = doRemove(index); var oldObject = element; //TODO fix me: var index = 1000; this.Remove(element); //NotificationImpl notification = createNotification(Notification.REMOVE, oldObject, null, index, oldIsSet); NotificationImpl notification = new NotificationImpl(NotificationImpl.REMOVE, oldObject, null, index, oldIsSet); if (notifications == null) { notifications = notification; } else { notifications.add(notification); } } else { //doRemove(index); this.Remove(element); } } return(notifications); }
public async Task Current_is_set() { var list = ImmutableList.Create(1, 2, 3); var notification = new NotificationImpl(list, NotifyCollectionChangedAction.Reset, ImmutableList <int> .Empty, ImmutableList <int> .Empty); await Verify(notification.Current); }
public void Current_is_set() { var list = ImmutableList.Create(1, 2, 3); var notification = new NotificationImpl(list, NotifyCollectionChangedAction.Reset, ImmutableList <int> .Empty, ImmutableList <int> .Empty); notification.Current.Should().Equal(list); }
public void addUnique(T element) { if (isNotificationRequired()) { //int index = size; int index = size() - 1; //boolean oldIsSet = isSet(); bool oldIsSet = this.notEmpty(); //doAddUnique(object); this.Add(element); //NotificationImpl notification = createNotification(NotificationImpl.ADD, null, element, index, oldIsSet); NotificationImpl notification = new NotificationImpl(NotificationImpl.ADD, null, element, index, oldIsSet); if (hasInverse()) { NotificationChain notifications = inverseAdd(element, null); /* * if (hasShadow()) * { * notifications = shadowAdd(object, notifications); * } */ if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { dispatchNotification(notification); } } else { //doAddUnique(object); this.Add(element); if (hasInverse()) { NotificationChain notifications = inverseAdd(element, null); if (notifications != null) { notifications.dispatch(); } } } }
/// <summary> /// Transform a notification impl to a notification /// </summary> /// <param name="list"></param> /// <returns></returns> public static NotificationList ToNotificationList(this NotificationImpl list) { var notificationList = new NotificationList(list.NotificationName, list.Users.ToList().ToUsers(), list.Groups.ToList().ToGroups()) { Type = list.Type, //Users = list.Users.ToList().ToUsers(), //Groups = list.Groups.ToList().ToGroups() }; return(notificationList); }
public T remove_(T element) { if (isNotificationRequired()) { NotificationChain notifications = null; //bool oldIsSet = isSet(); bool oldIsSet = this.Count != 0; /* * if (hasShadow()) * { * notifications = shadowRemove(basicGet(index), null); * } */ this.Remove(element); T oldObject = element; //TODO determine index if possible var index = 1000; //NotificationImpl notification = createNotification(NotificationImpl.REMOVE, oldObject, null, index, oldIsSet); NotificationImpl notification = new NotificationImpl(NotificationImpl.REMOVE, oldObject, null, index, oldIsSet); if (hasInverse() && oldObject != null) { notifications = inverseRemove(oldObject, notifications); if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } else { if (notifications == null) { dispatchNotification(notification); } else { notifications.add(notification); notifications.dispatch(); } } return(oldObject); } else { this.Remove(element); T oldObject = element; if (hasInverse() && oldObject != null) { NotificationChain notifications = inverseRemove(oldObject, null); if (notifications != null) { notifications.dispatch(); } } return(oldObject); } }
public static int GetNewNotificationCount(string serviceCode) { Log.Debug("[Notification] GetNewNotificationCount"); return(NotificationImpl.GetNewNotificationCount(serviceCode)); }
public virtual void CreateNotificationList(NotificationImpl list) { throw new NotImplementedException(); }
/// <summary> /// Create the given list /// </summary> /// <param name="list"></param> public void CreateNotificationList(NotificationImpl list) { db.NotificationImpls.Add(list); db.SaveChanges(); }
/// <summary> /// Create a new notification list /// </summary> /// <param name="list"></param> public void CreateNotificationList(NotificationImpl list) { }