private void RefreshConnectionsBT_Click(object sender, EventArgs e)
        {
            ConnectCB.Items.Clear();
            vrConnector.getClientInfo();
            IEnumerator <JToken> enumerator = data.GetEnumerator();

            enumerator.MoveNext();
            for (int i = 0; i < data.Count; i++)
            {
                ConnectCB.Items.Add(enumerator.Current.SelectToken("clientinfo").SelectToken("user").ToString());
                enumerator.MoveNext();
            }
        }
        //string routeUuid, treeUuid, paneUuid, headUuid;
        //SerialPortProgram spp;



        public VRForm2(VRConnector vr)
        {
            vrConnector = vr;
            InitializeComponent();
            vrConnector.getClientInfo();
            refreshConnection(vrConnector.readObject());

            for (int i = 0; i < 24; i++)
            {
                TimeCB.Items.Add(i);
            }
            SceneLV.MultiSelect = false;
        }
示例#3
0
        public Client()
        {
            message = new string[4] {
                " ", " ", " ", " "
            };

            vr       = new VRConnector();
            commands = new VRCommands(vr);
            vr.getClientInfo();

            sessionList = commands.refreshConnection(vr.readObject());
            commands.connectClient(sessionList);
            vr.Destination = vr.readObject().SelectToken("data").SelectToken("id").ToString();
            Thread readerThread = new Thread(reading);

            readerThread.Start();
            commands.route();
            commands.createPanel("hud");
            commands.find("Camera");
            commands.createPanel("chat");

            spp = new FakeData();


            Thread serverConnection = new Thread(serverReader);

            serverConnection.Start();


            Thread.Sleep(200);

            commands.addRoad(routeUuid);
            commands.follow(routeUuid, HUDUuid);
            commands.update(HUDUuid, cameraUuid);
            commands.update(HUDUuid, chatUuid);

            clientStart();
        }
示例#4
0
        public Client(NetworkStream stream)
        {
            this.stream = stream;
            message     = new string[4] {
                " ", " ", " ", " "
            };

            vr       = new VRConnector();
            commands = new VRCommands(vr);
            vr.getClientInfo();

            sessionList = commands.refreshConnection(vr.readObject());
            commands.connectClient(sessionList);
            vr.Destination = vr.readObject().SelectToken("data").SelectToken("id").ToString();
            Thread readerThread = new Thread(reading);

            readerThread.Start();
            commands.route();
            commands.bike();
            commands.createPanel("hud");
            commands.find("Camera");
            commands.createPanel("chat");
            //string[] ports = SerialPort.GetPortNames();
            //for (int i = 0; i < ports.Length; i++)
            //{
            //    try
            //    {
            //        spp = new SerialPortProgram(ports[i]);

            //    }
            //    catch (Exception e){
            //        Console.WriteLine(e.StackTrace);
            //    }
            //}
            spp = new FakeData();


            Thread serverConnection = new Thread(serverReader);

            serverConnection.Start();


            Thread.Sleep(400);


            commands.addRoad(routeUuid);
            commands.follow(routeUuid, bikeUuid);
            float[] offset = new float[3] {
                0, 5.75f, -1.5f
            };
            commands.update(bikeUuid, HUDUuid, offset);
            offset = new float[3] {
                1, 4.9f, -3f
            };
            commands.update(bikeUuid, cameraUuid, offset);
            offset = new float[3] {
                2, 5.75f, -1.5f
            };
            commands.update(bikeUuid, chatUuid, offset);
            commands.chat(message, chatUuid);
            clientStart();
        }