コード例 #1
0
        protected void ClearAllEvents()
        {
            if (PropertyChanged != null)
            {
                foreach (var eventhandler in PropertyChanged.GetInvocationList())
                {
                    PropertyChanged -= (PropertyChangedEventHandler)eventhandler;
                }

                PropertyChanged = null;
            }

            if (NotifyDirty != null)
            {
                foreach (var eventhandler in NotifyDirty.GetInvocationList())
                {
                    NotifyDirty -= (System.EventHandler)eventhandler;
                }

                NotifyDirty = null;
            }

            if (ObjectChanged != null)
            {
                foreach (var eventhandler in ObjectChanged.GetInvocationList())
                {
                    ObjectChanged -= (ObjectChangedEventHandler)eventhandler;
                }

                ObjectChanged = null;
            }
        }
コード例 #2
0
ファイル: ObjectProto.cs プロジェクト: hotab/OpticalBuilder
 public event EventHandler <EventArgs> ObjectChanged; //Об'єкт змінився - подія
 public void RaiseChanged()                           //Об'єкт змінився - пробудити подію
 {
     if (ObjectChanged != null)
     {
         ObjectChanged.Invoke(this, new EventArgs());
     }
 }
コード例 #3
0
ファイル: ListManager.cs プロジェクト: NikitaAx21/mechat
        private void OnObjectChanged(Object obj)
        {
            ObjectChanged?.Invoke(obj);
            //=========================
            Thickness RealCM_Margin = MarginCM();

            MarginCM_Change.Invoke(RealCM_Margin);
        }
コード例 #4
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (objectIsNew)
     {
         DataSource.Add(editObject);
     }
     StopEditMode();
     ObjectChanged?.Invoke(this, editObject);
 }
コード例 #5
0
        internal void DoObjectChanged(TabularObject obj, string propertyName, object oldValue, object newValue)
        {
            if (_disableUpdates)
            {
                return;
            }

            var e = new ObjectChangedEventArgs(obj, propertyName, oldValue, newValue);

            ObjectChanged?.Invoke(this, e);
        }
コード例 #6
0
        public void SetValue(object value)
        {
            Property.SetValue(Instance.ProxiedObject, value);

            ObjectChanged?.Invoke(new ObjectChangedEventArgs
            {
                Object       = Instance.ProxiedObject,
                PropertyName = Property.Name
            });
            Instance.RaisePropertyChanged(string.Empty);
        }
コード例 #7
0
        public void Save <T>(T reference, Predicate <T> predicate) where T : Sprite, new()
        {
            if (reference == null)
            {
                return;
            }

            var obj = Query(predicate);

            obj = reference;

            ObjectChanged?.Invoke(obj);
        }
コード例 #8
0
 public void SetObject(T value)
 {
     if (!ReferenceEquals(_obj, value))
     {
         object old = _obj;
         if (_obj != null)
         {
             _obj.PropertyChanged -= _obj_PropertyChanged;
         }
         _obj = value;
         if (_obj != null)
         {
             _obj.PropertyChanged += _obj_PropertyChanged;
         }
         ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(old));
         ObjectPropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
     }
 }
コード例 #9
0
        /// <summary>Selects the objects changed.</summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entries">The entries.</param>
        /// <param name="properties">The properties.</param>
        /// <returns></returns>
        public static IReadOnlyCollection <ObjectChanged <T> > SelectObjectsChanged <T>(this ChangeTracker entries, ICollection <string> properties) where T : class
        {
            var itens = new List <ObjectChanged <T> >();

            if (entries?.HasChanges() != true)
            {
                return(itens);
            }
            foreach (var entry in entries.Entries <T>().Where(e => !IgnoreStates.Contains(e.State)))
            {
                var propertiesChanged = entry.SelectPropertiesChanged(properties);
                if (!propertiesChanged.Any())
                {
                    continue;
                }
                var oc = new ObjectChanged <T>(((int)entry.State), entry.State.ToString(), entry.Entity, propertiesChanged);
                itens.Add(oc);
            }

            return(itens);
        }
コード例 #10
0
 /// <summary>
 /// Raises an ObjectChanged event.
 /// </summary>
 private void OnObjectChanged(object changeArgument)
 {
     ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(commandConfig, changeArgument));
 }
コード例 #11
0
 /// <summary>
 /// Вызвать событие ObjectChanged
 /// </summary>
 private void OnObjectChanged(object changeArgument)
 {
     ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(modbusCmd, changeArgument));
 }
コード例 #12
0
        internal void DoObjectChanged(TabularObject obj, string propertyName, object oldValue, object newValue)
        {
            var e = new ObjectChangedEventArgs(obj, propertyName, oldValue, newValue);

            ObjectChanged?.Invoke(this, e);
        }
コード例 #13
0
 private void _NotifyObservers()
 {
     ObjectChanged.Invoke(this, null);
 }
コード例 #14
0
 /// <summary>
 /// Raises an ObjectChanged event.
 /// </summary>
 private void OnObjectChanged(object changeArgument)
 {
     ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(subscriptionConfig, changeArgument));
 }
コード例 #15
0
 protected virtual void NotifyPrimitiveChanged(SyncPrimitive primitive)
 {
     ObjectChanged.RaiseEvent(this);
 }
コード例 #16
0
 public void OnNext(ObjectChanged<Person> value)
 {
     Console.WriteLine(value);
 }
コード例 #17
0
ファイル: CtrlElem.cs プロジェクト: zuoyangithub/scada
 /// <summary>
 /// Вызвать событие ObjectChanged
 /// </summary>
 private void OnObjectChanged(object changeArgument)
 {
     ObjectChanged?.Invoke(this, new ObjectChangedEventArgs(elemInfo, changeArgument));
 }
コード例 #18
0
 private void OnObjectChanged(ObjectChangedEventArgs args)
 {
     ObjectChanged?.Invoke(this, args);
 }
コード例 #19
0
 public void RaiseObjectChanged(CustomEventArgs <object> args)
 {
     ObjectChanged?.Invoke(this, args);
 }
コード例 #20
0
ファイル: ChoEventManager.cs プロジェクト: lanicon/Cinchoo
 public void OnObjectChanged(object target, EventArgs e)
 {
     ObjectChanged.Raise(target, e);
 }
コード例 #21
0
 /// <summary>
 /// Raises the <see cref="ObjectChanged"/> event for the specified <paramref name="propertyName"/>.
 /// </summary>
 /// <param name="propertyName">Name of the changed property</param>
 protected virtual void RaiseObjectChanged(string propertyName)
 {
     ObjectChanged?.Invoke(this, propertyName);
 }