Beispiel #1
0
 public void SaveCurrentState()
 {
     if (IsSaveCurrentState)
     {
         return;
     }
     else
     {
         OldValues.Clear();
         IsSaveCurrentState = true;
     }
     foreach (var item in Items)
     {
         if (item is IResettable r && !ResetExeclusions.Contains(r))
         {
             r.SaveCurrentState();
         }
     }
     foreach (var item in InternalDictionary)
     {
         if (!PropertyResetExeclusions.Contains(item.Key) && item.Value.Value is IResettable ro && !ResetExeclusions.Contains(ro))
         {
             ro.SaveCurrentState();
         }
     }
     IsSaveCurrentState = false;
 }
Beispiel #2
0
 public void Reset()
 {
     if (IsReset)
     {
         return;
     }
     else
     {
         foreach (var item in OldValues)
         {
             if (item.Key == nameof(Count))
             {
                 continue;
             }
             SetPropertyValue(item.Value, item.Key);
         }
         OldValues.Clear();
         IsReset = true;
     }
     foreach (var item in Items)
     {
         if (item is IResettable r && !ResetExeclusions.Contains(r))
         {
             r.Reset();
         }
     }
     foreach (var item in InternalDictionary)
     {
         if (!PropertyResetExeclusions.Contains(item.Key) && item.Value.Value is IResettable ro && !ResetExeclusions.Contains(ro))
         {
             ro.Reset();
         }
     }
     IsReset = false;
 }
Beispiel #3
0
 private void ResettableValueCollection_PropertyChanging(object sender, System.ComponentModel.PropertyChangingEventArgs e)
 {
     if (OldValues.ContainsKey(e.PropertyName) || PropertyResetExeclusions.Contains(e.PropertyName))
     {
         return;
     }
     OldValues[e.PropertyName] = GetPropertyValue(e.PropertyName);
 }
Beispiel #4
0
 private void ResettableObject_PropertyChanging(object sender, PropertyChangingEventArgs e)
 {
     if (OldValues.ContainsKey(e.PropertyName) || PropertyResetExeclusions.Contains(e.PropertyName))
     {
         return;
     }
     //store old value in OldValues
     OldValues[e.PropertyName] = GetPropertyValue(e.PropertyName);
 }