private void websocket_MessageReceived(object skrewer, MessageReceivedEventArgs eventargs) { JObject message = JObject.Parse(eventargs.Message); if (!message.ContainsKey("type")) return; JToken typeToken = message["type"]; if (!"EVENT".Equals(typeToken) return; if (!message.ContainsKey("action")) return; JToken actionToken = message["action"]; if (!"rates/all".Equals(actionToken)) return; if (!message.ContainsKey("body")) return; JToken body = message["body"]; if (body==null) return; RatesAll rates = body.ToObject<RatesAll>(); if (rates==null || rates.Data==null) return; Invoke(new Action(() => { displayData(rates); } }
//------------------------------------------- private void displayData(RatesAll rates) { dataGridView.Rows.Clear(); for (int i=0;i<rates.Data.length;i++) { dataGridView.Rows.Add(rates.Data[i][0], rates.Data[i][1]); } }