/// <summary> /// Message received. /// </summary> /// <param name="json"></param> private void OnMessage(string json) { var jsonOptions = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }; var baseMessage = JsonSerializer.Deserialize <BaseMessage>(json, jsonOptions); switch (baseMessage?.Type) { case "info": _waitForInfo?.Set(); var infoMessage = JsonSerializer.Deserialize <InfoMessage>(json, jsonOptions); //Can contain settings from 2.3... OnInfo?.Invoke(infoMessage); break; case "closePlugin": throw new IOException("Close Message Received"); case "listChange": var listChangeMessage = JsonSerializer.Deserialize <ListChangeMessage>(json, jsonOptions); OnListChange?.Invoke(listChangeMessage); break; case "broadcast": case "settings": case "down": case "up": //Not needed for this plugin. break; case "action": var actionMessage = JsonSerializer.Deserialize <ActionMessage>(json, jsonOptions); OnActionEvent?.Invoke(actionMessage); break; } }
private void ListValueChange() { OnListChange?.Invoke(); }