Beispiel #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            DoubleBuffered = true;
            _stateManager.Init();
            _tempFileManager.Init();
            _tcpIpFileManager.Init();

            _tcpIpTcpServer = TcpServer.GetInstance();
            _udpReceiver    = UdpReceiver.GetInstance();
            BroadcastService.GetInstance();
        }
Beispiel #2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            DoubleBuffered = true;
            _stateManager.Init();
            _tempFileManager.Init();
            _tcpIpFileManager.Init();

            _tcpIpServer = Server.GetInstance();
            _tcpIpServer.StartListen();

            BroadcastService.GetInstance().StartBroadcast();
        }
Beispiel #3
0
        private void buttonSend_Click(object sender, EventArgs e)
        {
            int speedA, speedB, time;

            try
            {
                speedA = Convert.ToInt32(textBoxSpeedMotorA.Text);
                speedB = Convert.ToInt32(textBoxSpeedMotorB.Text);
                time   = Convert.ToInt32(textBoxMotorTime.Text);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                return;
            }
            if (speedA > MaxSpeed || speedA < MinSpeed)
            {
                MessageBox.Show("Please check your input - motor A!");
                return;
            }
            if (speedB > MaxSpeed || speedB < MinSpeed)
            {
                MessageBox.Show("Please check your input - motor B!");
                return;
            }
            if (time < 0)
            {
                MessageBox.Show("Please check your input - time!");
                return;
            }
            string data = "Motor" + BroadcastService.Separator + comboBoxMotorA.SelectedIndex + BroadcastService.Separator +
                          speedA + BroadcastService.Separator + comboBoxMotorB.SelectedIndex + BroadcastService.Separator +
                          speedB + BroadcastService.Separator + time + BroadcastService.Separator + Environment.NewLine;
            BroadcastService broadcastService = BroadcastService.GetInstance();

            broadcastService.BroadcastToInterNetwork(Encoding.Default.GetBytes(data));
        }
Beispiel #4
0
        private void SendTask(object arg)
        {
            SendArguements realArg = (SendArguements)arg;

            while (true)
            {
                if (!BusySign)
                {
                    break;
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
            string data = "Motor" + BroadcastService.Separator + (int)realArg.DirA + BroadcastService.Separator + realArg.SpeedA +
                          BroadcastService.Separator + (int)realArg.DirB + BroadcastService.Separator + realArg.SpeedB +
                          BroadcastService.Separator + realArg.Time + BroadcastService.Separator + Environment.NewLine;
            BroadcastService broadcastService = BroadcastService.GetInstance();

            broadcastService.BroadcastToInterNetwork(data);

            BusySign = true;
        }
Beispiel #5
0
 public void Init()
 {
     BroadcastService.GetInstance().Init();
     TcpServer.GetInstance().Init();
 }