public MainForm() { InitializeComponent(); // Initialize Tab { string[] files = System.IO.Directory.GetFiles( System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetEntryAssembly().Location ) + "/def", "*", System.IO.SearchOption.TopDirectoryOnly ); this.builders_ = new List <ERP2DataBuilder>(); foreach (string file in files) { string[] lines = System.IO.File.ReadAllLines(file, Encoding.Default); ERP2DataBuilder builder = new ERP2DataBuilder(); builder.InitializeTabControl(ref tabControl1, System.IO.Path.GetFileName(file)); builder.Parse(lines); this.builders_.Add(builder); } } // COM port list first update UpdateSerialPortList(); // Update GUI updateUi(); // Serial port data receive handler serial_.DataReceived += serial_DataReceived; }
private async void buttonSend_Click(object sender, EventArgs e) { int sel_tab_idx = tabControl1.SelectedIndex; ERP2DataBuilder builder = this.builders_[sel_tab_idx]; // build data and send buildAndSend(builder); if (false) // for test { for (int i = 0; i < 10000; i++) { await Task.Delay(100); buildAndSend(builder); } } if (false) // for test { ERP2DataDL erp2data_dl = null; // EEP erp2data_dl = new EEPF60204(0); // build data and send buildAndSend(erp2data_dl); } }