private void InvokeAction(string emitterId, TimeSpanAction action) { lock (_emitters) { var emitter = _emitters.FirstOrDefault(x => x.Id == emitterId); if (emitter != null) { emitter.TimeSpanActions.Add(action.TimeSpan, action); } } }
private void SaveState(long timespan, TimeSpanAction action) { Console.WriteLine($"Saving timespan {timespan}"); var copy = _bankAccounts.Select(x => new BankAccount(x.Id, x.Name) { Money = x.Money }).ToList(); if (_historyTimespan.ContainsKey(timespan)) { _historyTimespan[timespan] = new History(copy, action); } else { _historyTimespan.Add(timespan, new History(copy, action)); } }
public History(List <BankAccount> bankAccounts, TimeSpanAction action) { BankAccounts = bankAccounts; Action = action; }