Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 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);
         }
     }
 }
Beispiel #3
0
 /// <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();
     }
 }
Beispiel #4
0
 /// <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;
     }
 }