private static async Task FireEvent(string ip, string eventData) { eventData = eventData.Remove(0, 4); byte id = byte.Parse(eventData.First().ToString()); eventData = eventData.Remove(0, 8).Replace("\n", ""); switch (id) { case 1: StateEvents stateEvents = JsonConvert.DeserializeObject <StateEvents>(eventData); StaticOnStateEvent?.Invoke(null, new StateEventArgs(ip, stateEvents)); break; case 2: LayoutEvent layoutEvent = JsonConvert.DeserializeObject <LayoutEvent>(eventData, LayoutEventConverter.Instance); StaticOnLayoutEvent?.Invoke(null, new LayoutEventArgs(ip, layoutEvent)); break; case 3: EffectEvents effectEvent = JsonConvert.DeserializeObject <EffectEvents>(eventData); StaticOnEffectEvent?.Invoke(null, new EffectEventArgs(ip, effectEvent)); break; case 4: GestureEvents gestureEvents = JsonConvert.DeserializeObject <GestureEvents>(eventData); StaticOnGestureEvent?.Invoke(null, new GestureEventArgs(ip, gestureEvents)); break; } }
public GestureEventArgs(string ip, GestureEvents gestureEvents) { IP = ip; GestureEvents = gestureEvents; }