Пример #1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (e.Source is Button)
         {
             if (!isfirstrun)
             {
                 int id = Convert.ToInt32(cbb_id.SelectedItem);
                 //MessageBox.Show(cbb_zlgn.Text);
                 if (cbb_zlgn.Text.Equals("重启"))
                 {
                     byte[] aaa = new byte[1];
                     UCHR[] _id = new UCHR[3];
                     _id[0] = Convert.ToByte((id >> 16) & 0xff);
                     _id[1] = Convert.ToByte((id >> 8) & 0xff);
                     _id[2] = Convert.ToByte(id & 0xff);
                     aaa[0] = 1;
                     bdxx.BD_send(ref aaa, (UINT)(1), _id);
                 }
                 if (cbb_zlgn.Text.Equals("蜂鸣一秒"))
                 {
                     byte[] aaa = new byte[1];
                     UCHR[] _id = new UCHR[3];
                     _id[0] = Convert.ToByte((id >> 16) & 0xff);
                     _id[1] = Convert.ToByte((id >> 8) & 0xff);
                     _id[2] = Convert.ToByte(id & 0xff);
                     aaa[0] = 2;
                     bdxx.BD_send(ref aaa, (UINT)(1), _id);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         WriteLog.WriteError(ex);
     }
 }