public SceneSelector(VRConnector vr, Bike bike)
 {
     this.bike = bike;
     InitializeComponent();
     string[] stringSeparators = new string[] { "bin" };
     string[] dir = System.Environment.CurrentDirectory.Split(stringSeparators, StringSplitOptions.None);
     path          = dir[0] + @"scenes\";
     minButtonSize = new Size(50, 25);
     //this.vr = vr;
 }
        //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;
        }
        /// <summary>
        ///     a PatientClient
        /// </summary>
        /// <param name="client">TcpClient client</param>
        /// <param name="bike">Bike bike</param>
        /// <param name="vr">VRConnector vr</param>
        /// <
        /// >
        /// #BlameCode
        public PatientClient(TcpClient client, Bike bike, VRConnector vr = null)
            : base(client)
        {
            this.bike      = bike;
            bike.newStats += updateStat;
            this.vr        = vr;
            timer          = new Timer
            {
                Interval = 500
            };
            timer.Tick += requestDataBike;

            timer.Enabled = true;
            timer.Start();
        }
示例#4
0
        /// <summary>
        ///     creata a new client with the specfied unique ID
        /// </summary>
        /// <param name="id"></param>
        public static void createClient(string username = null, string password = null, TcpClient tcpclient = null,
                                        bool signed     = false)
        {
            if (tcpclient == null)
            {
                tcpclient = connectSavely();
            }

            if (tcpclient == null)
            {
                return;
            }


            var vr = connectSavely("145.48.6.10", 6666);

            if (vr == null)
            {
                return;
            }
            var connector = new VRConnector(vr);

            var bikem = new BikeManager(false, true, false);

            new Thread(bikem.construct).Start();
            while (bikem.bike == null)
            {
            }


            var client = new PatientClient(tcpclient, bikem.bike, connector);

            new Thread(client.checkForResponse).Start();

            if (signed || ((username != null) && (password != null)) || login(client))
            {
                if ((username != null) && (password != null))
                {
                    client.sendData(new Authentication(username, password, Authentication.Rights.PATIENT));
                }
                var GUI = new Patient_GUI(client);
                Application.Run(GUI);
            }
        }
示例#5
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();
        }
示例#6
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();
        }