private async void Receive(object sender, MessageEventArgs e) { FSX.Aircraft traffic = JsonConvert.DeserializeObject <FSX.Aircraft>( e.Data); FSX.Traffic.Set(traffic); }
private async Task Send() { while (webSocket.IsAlive) { FSX.Aircraft player = await FSX.Player.Get(); string data = JsonConvert.SerializeObject(player); webSocket.Send(data); int millisecondDelay = 1500; await Task.Delay(millisecondDelay); } }
private async void btnGetPositionAsync_Click(object sender, EventArgs e) { FSX.Aircraft player = await FSX.Player.Get(); displayText(JsonConvert.SerializeObject(player)); }