private void _rpc_OnUpdateEvent(RPCController sender, string id, EventType type, long peerId, long channelIndex, string variable) { if (type == EventType.Timed) { if (!TimedEvents.ContainsKey(id)) { return; } Event currentEvent = TimedEvents[id]; _rpc.GetEvent(currentEvent); EventUpdated?.Invoke(this, currentEvent); } else { if (!Devices.ContainsKey(peerId)) { return; } Device device = Devices[peerId]; if (!device.Events.ContainsKey(id)) { return; } Event currentEvent = device.Events[id]; _rpc.GetEvent(currentEvent); EventUpdated?.Invoke(this, currentEvent); } }
private void _rpc_OnUpdateEvent(RPCController sender, String id, EventType type, Int32 peerID, Int32 channelIndex, String variable) { if (type == EventType.Timed) { if (!TimedEvents.ContainsKey(id)) { return; } Event currentEvent = TimedEvents[id]; _rpc.GetEvent(currentEvent); if (EventUpdated != null) { EventUpdated(this, currentEvent); } } else { if (!Devices.ContainsKey(peerID)) { return; } Device device = Devices[peerID]; if (!device.Events.ContainsKey(id)) { return; } Event currentEvent = device.Events[id]; _rpc.GetEvent(currentEvent); if (EventUpdated != null) { EventUpdated(this, currentEvent); } } }
/// <summary> /// Begin timing of an event, but only if the event has not already been registered as a timed event. /// Useful if you want to know the duration from the point in time the event was first registered. /// </summary> /// <param name="eventName">the name of the event to track with timing</param> public static void StartTimedEventOnce(string eventName) { if (!TimedEvents.ContainsKey(eventName)) { TimedEvents[eventName] = CurrentTime(); } }
/// <summary> /// Begin timing of an event, but only if the event has not already been registered as a timed event. /// Useful if you want to know the duration from the point in time the event was first registered. /// </summary> /// <param name="eventName">the name of the event to track with timing</param> public static void StartTimedEventOnce(string eventName) { if (!TimedEvents.ContainsKey(eventName)) { Value properties = TimedEvents; properties[eventName] = CurrentTime(); TimedEvents = properties; } }