示例#1
0
        /// <summary>
        /// Método que se ejecuta cuando se dispara el evento PropertyChanged de un elemento.
        /// Este método, lanza el evento ItemPropertyChanged, enviando como argumentos el elemento de la
        /// colección en el que ha cambiado alguna propiedad y el nombre de la propiedad.
        /// </summary>
        private void ChildPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            T   typedSender = (T)sender;
            var args        = new ItemChangedEventArgs <T>(typedSender, e.PropertyName);

            ItemPropertyChanged?.Invoke(this, args);
        }
示例#2
0
        private void TreeListViewPropertyChanged(object sender, TreeListView.PropertyChangedEventArgs e)
        {
            var args = new ItemPropertyChangedEventArgs(e.Node.Tag, e.PropertyIndex, e.Value);

            ItemPropertyChanged.Raise(this, args);
            e.CancelChange = args.CancelChange;
        }
 private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (raiseEvents)
     {
         ItemPropertyChanged?.Invoke(this, new CollectionItemPropertyChangedEventArgs <T>((T)sender, e.PropertyName));
     }
 }
示例#4
0
        private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            NotifyCollectionChangedEventArgs a = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);

            OnCollectionChanged(a);
            ItemPropertyChanged?.Invoke(sender, e);
        }
示例#5
0
        protected virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, sender, sender,
                                                            IndexOf((T)sender));

            OnCollectionChanged(args);

            ItemPropertyChanged?.Invoke(sender, e);
        }
示例#6
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ItemPropertyChanged?.Invoke(sender, e);

            // TODO: Optimize
            if (e.PropertyName == "TextDisplay" || e.PropertyName == "Description" || e.PropertyName == "Color" ||
                e.PropertyName == "CheckState")
            {
                Invalidate();
            }
        }
示例#7
0
        /// <summary>Invokes the ItemPropertyChanged event</summary>
        /// <exception cref="Exception">Thrown when failed to invoke item property changed</exception
        private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                NotifyCollectionChangedEventArgs a = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);
                OnCollectionChanged(a);

                ItemPropertyChanged?.Invoke(sender, e);
            }
            catch (Exception ex)
            {
                throw new Exception("Failed to invoke item property changed", ex);
            }
        }
示例#8
0
        private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            _sync.AcquireWriterLock(Timeout.Infinite);

            var item = (T)sender;

            var containsAfter = ApplyFilter(item);

            if (containsAfter)
            {
                ItemPropertyChanged?.Invoke(sender, e);
            }

            _sync.ReleaseWriterLock();
        }
示例#9
0
 public void RaiseHasCollectionChanges(TrackItem item, string propertyName)
 {
     if (propertyName != null && Properties?.All(p => p.Name != propertyName) == true)
     {
         return;
     }
     OnPropertyChanged(new PropertyChangedEventArgs(nameof(HasCollectionChanges)));
     if (item != null && propertyName != null)
     {
         ItemPropertyChanged?.Invoke(this, new TrackItemEvent <T> {
             Item = item as TrackItem <T>, PropertyNameChanged = propertyName
         });
     }
     ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(nameof(HasErrors)));
 }
        private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ((ObservableEntity)sender).OnPreUpdate(this, out bool vetoed);
            if (!vetoed)
            {
                _session.Update(sender);

                if (!Transaction.IsActive)
                {
                    _session.Flush();
                }
            }

            ItemPropertyChanged?.Invoke(sender, e);
        }
示例#11
0
        private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ItemPropertyChangedEventArgs <T> args = new ItemPropertyChangedEventArgs <T>((T)sender, e.PropertyName);

            ItemPropertyChanged?.Invoke(this, args);

            IList <EventHandler <ItemPropertyChangedEventArgs <T> > > list;

            if (!itemPropertyChangedEventHandlers.TryGetValue(e.PropertyName, out list))
            {
                return;
            }

            foreach (EventHandler <ItemPropertyChangedEventArgs <T> > handler in list)
            {
                handler?.Invoke(this, args);
            }
        }
示例#12
0
        public void OnItemPropertyChanged(T item, int index, PropertyChangedEventArgs e)
        {
            var lindex = indexes.GetIndex(e.PropertyName);

            if (lindex != null)
            {
                if (e is PropertyChangedDetailEventArgs details)
                {
                    lindex.Remove(item, details.OldValue);
                    lindex.Add(item, details.NewValue);
                }
                else
                {
                    lindex.Refresh(item);
                }
            }
            if (IsSorted)
            {
                if (index < 0)
                {
                    index = items.IndexOf(item);
                }
                int newindex = GetIndexBySort(item);
                if (newindex < 0)
                {
                    newindex = -newindex - 1;
                }
                if (index != newindex)
                {
                    if (newindex > index)
                    {
                        newindex--;
                    }
                    if (newindex > items.Count)
                    {
                        newindex = items.Count;
                    }
                    items.RemoveAt(index);
                    items.Insert(newindex, item);
                    OnListChanged(NotifyCollectionChangedAction.Move, item, newindex, index);
                }
            }
            ItemPropertyChanged?.Invoke(item, e);
        }
示例#13
0
        public EnhancedObservableCollection(IEnumerable <T> collection, CollectionOptions options)
            : base(collection)
        {
            _options = options;
            collection?.ForEach(subscribeToPropertyChanged);

            _suppressNotification.Deactivated +=
                () => OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            _suppressItemPropertyChangedNotifications.Deactivated +=
                () =>
            {
                foreach (var e in _awaitingItemPropertyChangedEvents)
                {
                    if (this.Contains(e.Item))
                    {
                        ItemPropertyChanged?.Invoke(this, e);
                    }
                }
                _awaitingItemPropertyChangedEvents.Clear();
            };
        }
示例#14
0
        void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var eventArgs = new ItemPropertyChangedEventArgs <T>(e, (T)sender);

            if (!_suppressItemPropertyChangedNotifications.IsActive && !_ignoreItemPropertyChangedNotifications.IsActive)
            {
                ItemPropertyChanged?.Invoke(this, eventArgs);
            }
            else if (_suppressItemPropertyChangedNotifications.IsActive && !_ignoreItemPropertyChangedNotifications.IsActive)
            {
                _awaitingItemPropertyChangedEvents.Add(eventArgs);
            }
            else if (_suppressItemPropertyChangedNotifications.IsActive && _ignoreItemPropertyChangedNotifications.IsActive)
            {
                throw new NotSupportedException("Setting ignoring and supressing mode simultaneously is not supported");
            }
            else
            {
                // Ignoring
            }
        }
示例#15
0
        private void ChangeNotificationWrapperOnCollectionItemPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var adv = e as AdvancedPropertyChangedEventArgs;

            if (!Equals(adv.OldValue, adv.NewValue))
            {
                if (IsEditing && e.PropertyName == nameof(ModelBase.IsUserModified))
                {
                    if ((bool)adv.NewValue)
                    {
                        _userModifiedItems.Add(sender as T);
                    }
                    else
                    {
                        _userModifiedItems.Remove(sender as T);
                    }

                    UpdateIsUserModifiedFlag();
                }

                ItemPropertyChanged?.Invoke(sender, adv);
            }
        }
 private void OnItemPropertyChanged(T item, string propertyName)
 {
     ItemPropertyChanged.Raise(this, new ItemPropertyChangedEventArgs <T>(item, propertyName));
 }
示例#17
0
 protected virtual void OnItemPropertyChanged(
     T item, PropertyChangedEventArgs args)
 {
     ItemPropertyChanged?.Invoke(item, args);
 }
 protected virtual void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     ItemPropertyChanged?.Invoke(sender, e);
 }
 private void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     ItemPropertyChanged?.Invoke(this, e);
 }
示例#20
0
 /// <summary>
 /// Notify that a value has changed in the collection.
 /// </summary>
 /// <param name="propertyName">Name of the changed property.</param>
 public void RaisePropertyChanged(string propertyName) =>
 ItemPropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
示例#21
0
 void OnItemPropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     ItemPropertyChanged?.Invoke(this, new ItemPropertyChangedEventArgs(sender, args.PropertyName));
 }
示例#22
0
 private void _ItemPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     ItemPropertyChanged?.Invoke(this, e);
     // OnPropertyChanged(new PropertyChangedEventArgs("Item[]"));
 }
示例#23
0
 protected virtual void OnItemPropertyChanged(DraggableComponentModel item)
 {
     ItemPropertyChanged?.Invoke(this, item);
 }
示例#24
0
 void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
     ItemPropertyChanged?.Invoke(sender, e);
 }
示例#25
0
 private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     ItemPropertyChanged?.Invoke(sender, e);
 }
 void OnItemPropertyChanged(object sender, RelayedEventArgs <PropertyChangedEventArgs> e)
 {
     ItemPropertyChanged?.Invoke(this, e);
 }
示例#27
0
        private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            T item = (T)sender;

            ItemPropertyChanged?.Invoke(this, new ItemPropertyChangedEventArgs <T>(item, e.PropertyName));
        }
示例#28
0
 private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     CheckDisposed();
     ItemPropertyChanged?.Invoke(this, new ItemPropertyChangedEventArgs(sender, this.IndexOf((T)sender), e));
 }
        //  public void

        protected void OnItemPropertyChanged(ItemPropertyChangedEventArgs e)
        {
            ItemPropertyChanged?.Invoke(this, e);
        }
示例#30
0
 /// <summary>
 /// 引发 <see cref="ItemPropertyChanged" /> 事件
 /// </summary>
 /// <param name="ea">包含此事件的参数</param>
 protected virtual void OnItemPropertyChanged(ItemPropertyChangedEventArgs <T> ea)
 {
     ItemPropertyChanged?.Invoke(this, ea);
 }