/// <summary> /// CAN /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCan_Click(object sender, EventArgs e) { try { CSystemDat.GetInstance().m_listCommStr.Add("CAN"); TxtBx_Send.Text += "(CAN)" + "\r\n"; } catch (CExcept_ excp) { MessageBox.Show(excp.Message); } }
/// <summary> /// 全行削除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSendDatDelete_Click(object sender, EventArgs e) { try { TxtBx_Send.Clear(); CSystemDat.GetInstance().m_listCommStr.Clear(); } catch (CExcept_ excp) { MessageBox.Show(excp.Message); } }
/// <summary> /// 送信する文字列をして、txt1RowSendDatを追加する /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSendDatAdd_Click(object sender, EventArgs e) { try { if (strSendDat_1Row != null) { TxtBx_Send.Text += SprSgm.CUtility.ChgUnicodeToAscii_ForRecvDat(strSendDat_1Row) + "\r\n"; // TxtBx_Send.Text += SprSgm.CUtility.ChgUnicodeToAscii_ForRecvDat(strSendDat) + "\r\n"; CSystemDat.GetInstance().m_listCommStr.Add(strSendDat_1Row); } } catch (CExcept_ excp) { MessageBox.Show(excp.Message); } }
/// <summary> /// 文字列を送信 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void btnSend_Click(object sender, EventArgs e) { try { CCommGeneralPurposeApi.bCommEndFlg = false; // 通信中断フラグ初期化 SetEnableCtrl(enRunStatus.en_autorun); await Task.Run(() => { // 一時コメント化 //// ASCII //m_serialPort1.Async_Protocol_Send_AllDat( // CSystemDat.GetInstance().m_listCommStr, // ref m_serialPort1.m_serialPort, // int.Parse(txtbxIntvalTm.Text) // ); // BYTE m_serialPort1.Async_Protocol_Send_AllDat_BYTE( CSystemDat.GetInstance().m_listCommStr, ref m_serialPort1.m_serialPort, int.Parse(txtbxIntvalTm.Text) ); // enSendType.en_SendType_Ascii); // enSendType.en_SendType_Hex); }); } catch (Exception excp) { MessageBox.Show(excp.Message); } finally { // prgbarSendRecv.Value = 0; // プログレスバー if (m_serialPort1.m_serialPort.Encoding == Encoding.ASCII) { SetEnableCtrl(enRunStatus.en_idle_ascii); } else { SetEnableCtrl(enRunStatus.en_idle_uni); } //SetEnableCtrl ( enRunStatus.en_idle ); CCommGeneralPurposeApi.bCommEndFlg = false; // bflgRun = false; //} } }