public void SaveCurrentState() { if (IsSaveCurrentState) { return; } else { OldValues.Clear(); IsSaveCurrentState = true; } foreach (var item in InternalDictionary) { if (!PropertyResetExeclusions.Contains(item.Key) && item.Value.Value is IResettable ro && !ResetExeclusions.Contains(ro)) { ro.SaveCurrentState(); } } foreach (var item in Items) { if (item is IResettable r && !ResetExeclusions.Contains(r)) { r.SaveCurrentState(); } } IsSaveCurrentState = false; }
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 InternalDictionary) { if (!PropertyResetExeclusions.Contains(item.Key) && item.Value.Value is IResettable ro && !ResetExeclusions.Contains(ro)) { ro.Reset(); } } foreach (var item in Items) { if (item is IResettable r && !ResetExeclusions.Contains(r)) { r.Reset(); } } IsReset = false; }