Beispiel #1
0
        public UdpClass(int i, MainFrom mf)
        {
            string[] arr1, arr2;

            if (i == 0)
            {
                VibrationData = VibrationData_HF;
            }
            else
            {
                VibrationData = VibrationData_LF;
            }
            mFrm      = mf;
            ClientNum = i;

            StreamReader srz   = new StreamReader("statezero.txt", System.Text.Encoding.Default);
            string       tempz = srz.ReadToEnd();

            srz.Close();
            arr1     = tempz.Split(' ');
            ZeroLine = double.Parse(arr1[ClientNum]);

            StreamReader srm   = new StreamReader("statemodulus.txt", System.Text.Encoding.Default);
            string       tempm = srm.ReadToEnd();

            srm.Close();
            arr2    = tempm.Split(' ');
            Modulus = double.Parse(arr2[ClientNum]);

            pack_num    = 1;
            pack_lose   = 0;
            bQueueCount = 0;

            time = 0;
        }
Beispiel #2
0
        public void CreateForm_btnSleepClick(object sender, EventArgs e)
        {
            Button btn    = sender as Button;
            string idName = btn.Name.Remove(0, 8);
            int    id     = int.Parse(idName);

            netAdd      = Record.netAdd;
            comadd      = Record.comadd;
            path        = Record.path;
            projectname = Record.projectName;
            sr          = Record.sr;
            if (sr.IsOpen)
            {
                if (!comadd[id - 1])
                {
                    MainFrom mrm = new MainFrom(projectname, path);
                    for (int i = 0; i < 8; i++)
                    {
                        netAdd[id - 1, i] = mrm.GetAdd(id)[i];
                    }
                }
                SendData sd = new SendData();
                sr.Write(sd.SleepLine(netAdd, Record.modulename[id - 1], id), 0, 35);
            }
            else
            {
                MessageBox.Show("串口未打开!");
            }
            // MessageBox.Show(btn.Name + "," + btn.Text + btn.Size);
        }
Beispiel #3
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            MainFrom mFrm = new MainFrom();

            mFrm.Show();
            this.Hide();
        }
Beispiel #4
0
 public Form5(MainFrom mf)
 {
     InitializeComponent();
     mFrm         = mf;
     txt_HF1.Text = mFrm.UdpSvr[0].ZeroLine.ToString();
     txt_LF1.Text = mFrm.UdpSvr[1].ZeroLine.ToString();
     txt_LF2.Text = mFrm.UdpSvr[2].ZeroLine.ToString();
     txt_LF3.Text = mFrm.UdpSvr[3].ZeroLine.ToString();
     txt_LF4.Text = mFrm.UdpSvr[4].ZeroLine.ToString();
 }