public void RemoveProperty(string propertyName) { try { _log.DebugFormat("{0} is set to false", propertyName); EventFromIftttType value = EnumHelper.GetEventNameEnum(propertyName); if (value == EventFromIftttType.Unknown) { _log.DebugFormat("Unknow type '{0}' received in RemoveProperty"); return; } lock (EventDictionary.Current) { if (EventDictionary.Current[value] != false) { EventDictionary.Current[value] = false; WorkflowManager.NewEventReceived(value, false); } } } catch (Exception ex) { _log.Error(ex); } }
public static void NewEventReceived(EventFromIftttType eventName, bool value) { lock (_lockQueue) { _queue.Enqueue(new Tuple <EventFromIftttType, bool>(eventName, value)); _manualResetEvent.Set(); } }
public static EventFromIftttType GetEventNameEnum(string enumString) { EventFromIftttType enumValue = EventFromIftttType.Unknown; if (!System.Enum.TryParse(enumString, out enumValue)) { return(EventFromIftttType.Unknown); } return(enumValue); }
public void Process(EventFromIftttType eventNameChanged, bool newValue) { _log.DebugFormat("Event '{0}' is processing in '{1}'", eventNameChanged, System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); PushoverClient client = new PushoverClient(); if (newValue) { client.SendNotification(PushoverRequest.CreateRequest("Sotfluent arrive au travail", "Presence", PushoverPriorityNotificationType.NormalPriority, PushoverSoundType.pushover)); } else { client.SendNotification(PushoverRequest.CreateRequest("Sotfluent part du travail", "Presence", PushoverPriorityNotificationType.NormalPriority, PushoverSoundType.pushover)); } }