コード例 #1
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);
            }
        }