コード例 #1
0
 private void HandleIsEnabledStateChanged(IHomeAutomationTimer timer, INotificationHandler notificationHandler)
 {
     if (!IsEnabled)
     {
         notificationHandler.PublishFrom(this, NotificationType.Info, "'{0}' disabled for 1 hour.", Id);
         _autoEnableAction = timer.In(TimeSpan.FromHours(1)).Do(() => IsEnabled = true);
     }
     else
     {
         _autoEnableAction?.Cancel();
     }
 }