Ejemplo n.º 1
0
 /// <summary>
 /// //发送数据
 /// </summary>
 private bool Senddata(String str)
 {
     if (cSerial != null)
     {
         //byte[] bytes = Encoding.Unicode.GetBytes(str);
         //cSerial.Write(bytes, 0, bytes.Length);
         String trmp = str + "\r\n";
         cSerial.Write(trmp);
         if (MsgShow.Text.Length > 2000)
         {
             MsgShow.Clear();
         }
         MsgShow.AppendText(trmp);
         return(true);
     }
     else
     {
         MsgShow.Text += "请先打开串口";
         MsgShow.Text += "\r\n";
         if (this.frequencyTimer.Enabled == true)
         {
             this.frequencyTimer.Enabled = false;
         }
         return(false);
     }
 }
Ejemplo n.º 2
0
Archivo: main.cs Proyecto: tebbic/SMO
        private void btnServerState_Click(object sender, EventArgs e)
        {
            if (svr == null)
            {
                MessageBox.Show("数据库未连接");
                return;
            }
            DataSet ds   = svr.Databases["master"].ExecuteWithResults("exec master..xp_fixeddrives");
            MsgShow show = new MsgShow();

            show.DataSource = ds;
            show.ShowDialog();
        }