using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; //Add code using System.IO; using System.IO.Ports; namespace RF_TRIO_PLL_ZIG { public partial class Main_Form : Form { Serial serial = new Serial(); // Uart Open Update_Serial file = new Update_Serial(); public Main_Form() { InitializeComponent(); serial.Serial_Initialize(ref comboBox_Port); } private void Firmware_Update_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); //FileDownload file = new FileDownload(); if (Ascii_checkBox.Checked == true) Ascii_checkBox.Checked = false; file.ShowFileOpenDialog(ref serial, ofd); } private void Crc16_Check_Click(object sender, EventArgs e) { #if false Crc16 crc16 = new Crc16(); byte[] tempdata = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,0x0A }; label1.Text = crc16.CRC16_Generate(tempdata, 11).ToString(); #endif this.serial.Test_Serial(); } private void Button_PortOpen_Click(object sender, EventArgs e) { Serial_connectiondisable(serial.Serial_PortOpen(ref button_PortOpen,ref comboBox_Port)); } private void ComboBox_Port_SelectedIndexChanged(object sender, EventArgs e) { serial.Serial_Name = comboBox_Port.SelectedItem.ToString(); } private void Button_terminal_Click(object sender, EventArgs e) { serial.Serial_TerminalOpen(serial); } public void Serial_connectiondisable(Boolean on_off) { comboBox_Port.Enabled = on_off; comboBox_baudrate.Enabled = on_off; } } }