Example #1
0
 private void Dst_DirtyStateChange(object sender, DirtyStateChangeEventArgs e)
 {
     if (_signalling == 0)
     {
         DirtyStateChange?.Invoke(this, e);
     }
 }
Example #2
0
 internal void SetDirty()
 {
     if (!_isDirty)
     {
         DirtyStateChange?.Invoke(this, new DirtyStateChangeEventArgs(true));
         _isDirty = true;
     }
 }
Example #3
0
 public void ResetClean()
 {
     if (_isDirty)
     {
         DirtyStateChange?.Invoke(this, new DirtyStateChangeEventArgs(false));
         _isDirty = false;
     }
 }
Example #4
0
        protected override void OnPropertyChanged(string propName, object oldVal, object newVal, bool isBag)
        {
            if (propName[0] != KeyService.SHADOW_PROP_PREFIX)
            {
                base.OnPropertyChanged(propName, oldVal, newVal, isBag);

                Globals.GlobalPropertyChangePreview?.Invoke(this, propName, oldVal, newVal);

                if (SafeGetState() == ObjectState.Unchanged)
                {
                    SetRowState(ObjectState.Modified);
                    DirtyStateChange?.Invoke(this, new DirtyStateChangeEventArgs(ObjectState.Modified));
                }
            }
        }
Example #5
0
        public override void AcceptChanges()
        {
            bool changed = false;

            using (new WriterLock(_lock))
            {
                if (_rowState == ObjectState.Deleted)
                {
                    SetRowState(ObjectState.Unlinked);
                    return;
                }

                if (_originalValues != null)
                {
                    if (_source != null)
                    {
                        // Handle CLR properties that are R/W
                        foreach (var(name, type, readable, writeable) in _source.FastGetAllProperties(true, true))
                        {
                            _originalValues[name] = _source.FastGetValue(name);
                        }
                    }

                    foreach (var kvp in _valueBag)
                    {
                        _originalValues[kvp.Key] = kvp.Value;
                    }
                }

                changed = (_rowState != ObjectState.Unchanged);

                SetRowState(ObjectState.Unchanged);
                _isBagChanged = false;
            }

            if (changed)
            {
                DirtyStateChange?.Invoke(this, new DirtyStateChangeEventArgs(ObjectState.Unchanged));
            }
        }
Example #6
0
        protected override void OnPropertyChanged(string propName, object?oldVal, object?newVal, bool isBag)
        {
            if (propName[0] != KeyService.SHADOW_PROP_PREFIX)
            {
                base.OnPropertyChanged(propName, oldVal, newVal, isBag);

                Globals.GlobalPropertyChangePreview?.Invoke(this, propName, oldVal, newVal);

                if (SafeGetState() == ObjectState.Unchanged)
                {
                    if (!Globals.GlobalPropertiesExcludedFromDirtyCheck.Contains(propName))
                    {
#if DEBUG
                        if (CEFDebug.DebugEnabled)
                        {
                            CEFDebug.WriteInfo($"PropChange: {propName}, {oldVal}, {newVal}");
                        }
#endif
                        SetRowState(ObjectState.Modified);
                        DirtyStateChange?.Invoke(this, new DirtyStateChangeEventArgs(ObjectState.Modified));
                    }
                }
            }
        }