Пример #1
0
        private void startTraining(object sender, EventArgs e)
        {
            if (_inTraining)
                return;
            _inTraining = true;

            if (isSpecialist)
            {
                TCPController.Send(new NotifyPacket(NotifyPacket.Subject.StartTraining, client.NonNullId.ToString(), Settings.GetInstance().authToken));
                _spController = new Specialist_Controller();
                _spController.UpdatedList += UpdateGUI;

            }
            else
            {
                var port = getCOMPort();
                if (port == null)
                {
                    MessageBox.Show("No COM port found. Please connect your pc to a Kettler x7");
                    return;
                }
                _controller = new RH_Controller(new COM_Bike(port), true);

                //_controller = new RH_Controller(new STUB_Bike(), true);
                _controller.UpdatedList += UpdateGUI;
            }
            startTrainingButton.Enabled = false;
            _quitButton.Enabled = true;

        }
Пример #2
0
        public TrainingScreen(User client)
        {
            this.client = client;
            _spController = new Specialist_Controller();
            _spController.UpdatedList += UpdateGUI;

            InitializeComponent();
            isSpecialist = true;
            SubscribePacket subbie = new SubscribePacket(client.Username, true, Settings.GetInstance().authToken);

            ListPacket p = new ListPacket("connected_clients", Settings.GetInstance().authToken);
            TCPController.OnPacketReceived += HandleIncomingPackets;
            TCPController.Send(p.ToString());

            TCPController.Send(subbie.ToString());

            // updateGraph();
        }