コード例 #1
0
 public ReminderService(
     IReminderStorage storage,
     IReminderSender sender,
     IReminderReceiver receiver,
     ReminderServiceParameters parameters)
 {
     _storage    = storage ?? throw new ArgumentNullException(nameof(storage));
     _sender     = sender ?? throw new ArgumentNullException(nameof(sender));
     _receiver   = receiver ?? throw new ArgumentNullException(nameof(receiver));
     _parameters = parameters ?? throw new ArgumentNullException(nameof(parameters));
 }
コード例 #2
0
 public ReminderService(
     IReminderStorage storage,
     IReminderSender sender,
     IReminderReceiver receiver,
     ReminderServiceParameters parameters)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
     _storage  = storage ?? throw new ArgumentNullException(nameof(storage));
     _sender   = sender ?? throw new ArgumentNullException(nameof(sender));
     _receiver = receiver ?? throw new ArgumentNullException(nameof(receiver));
     _receiver.MessageReceived += OnMessageReceived;
     _createdItemTimer          = new Timer(OnCreatedItemTimerTick, null,
                                            parameters.CreateTimerDelay, parameters.CreateTimerInterval);
     _readyItemTimer = new Timer(OnReadyItemTimerTick, null,
                                 parameters.ReadyTimerDelay, parameters.ReadyTimerInterval);
 }