/// <summary>
        /// Initializes a new instance of the <see cref="NotifyChangeMonitor{T}"/> class.
        /// </summary>
        /// <param name="obj">Object to monitor.</param>
        public NotifyChangeMonitor(T obj)
        {
            this.obj = obj;

            this.obj.PropertyChanged += (sender, args) => PropertiesChanged.Add(args.PropertyName);
            this.obj.OnChanged       += (sender, wasChanged) => StateChanges.Add(wasChanged);
        }
Beispiel #2
0
        private void AddStateChange(SaleStateChange stateChange, bool isInitialStateChange)
        {
            if (stateChange is null)
            {
                throw new BaristaException("invalid_sale_state_change", "The state change is empty.");
            }

            ValidateStateChange(stateChange.State, isInitialStateChange);
            StateChanges.Add(stateChange);
            SetUpdatedNow();
        }
Beispiel #3
0
    public void TrackStateChange(State <T> oldState, State <T> newState)
    {
        if (TrackChanges)
        {
            if (oldState != null)
            {
                StateChangeRecord <T> record = new StateChangeRecord <T>(oldState.Name, newState.Name, TimingFunction.Invoke());

                StateChanges.Add(record);
            }
        }
    }