Exemple #1
0
 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);
         }
     }
 }
Exemple #2
0
        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));
            }
        }
Exemple #3
0
 public History(List <BankAccount> bankAccounts, TimeSpanAction action)
 {
     BankAccounts = bankAccounts;
     Action       = action;
 }