Exemplo n.º 1
0
        private async void InitializeSessions()
        {
            this.vrConnected = await InitializeConnection();

            if (this.vrConnected)
            {
                Tuple <string, JObject> sessionResponse = serverConnectionVR.TransferSendableResponse(jsonPacketBuilder.BuildSessionPacket().Item1);

                JArray data = sessionResponse.Item2.SelectToken("data") as JArray;
                foreach (JObject j in data)
                {
                    if (!users.Keys.Contains(j.SelectToken("clientinfo.user").ToString()))
                    {
                        users.Add(j.SelectToken("clientinfo.user").ToString(), j.SelectToken("id").ToString());
                        lstbSessions.Items.Add($"{j.SelectToken("id").ToString()}: {j.SelectToken("clientinfo.user").ToString()}");
                    }
                }
                btnSelectSession.Enabled = true;
            }
            else
            {
                if (MessageBox.Show("Kan niet verbinden met de VR server", "Waarschuwing", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Retry)
                {
                    InitializeSessions();
                }
            }
        }
Exemplo n.º 2
0
        // hier kijkt hij wat voor data er binnenkomt.

        private void Button1_Click(object sender, EventArgs e)
        {
            Tuple <string, JObject> sessionResponse = serverConnection.TransferSendableResponse(jsonPacketBuilder.BuildSessionPacket().Item1);

            JArray data = sessionResponse.Item2.SelectToken("data") as JArray;

            foreach (JObject j in data)
            {
                if (!users.Keys.Contains(j.SelectToken("clientinfo.user").ToString()))
                {
                    users.Add(j.SelectToken("clientinfo.user").ToString(), j.SelectToken("id").ToString());
                }
            }
            btnLoadSessions.Enabled = false;
        }
 private Tuple <string, JObject> SendToTunnel(string packet)
 {
     return(serverConnectionVR.TransferSendableResponse(jsonPacketBuilder.BuildSendTunnelPacket(this.runningVrData.currentTunnelId, packet).Item1));
 }