private async void timer1_Tick(object sender, EventArgs e) { // Dont check if write is in process if ((WriteInProcess == false) && connected) { /* create new programming interface object */ using (var uc = new STBoot()) { /* get port name */ string pName = (string)cbPorts.SelectedItem; try { //UpdateStatus(false, "Poll ID..."); /* open device */ uc.Open(portName, baudRate); /* try to handshake */ if (await uc.GetID()) { UpdateStatus(false, "Unit Detected"); connected = true; bOpenFile.Enabled = true; } else { UpdateStatus(false, "No Unit Detected"); connected = false; bOpenFile.Enabled = false; bWrite.Enabled = false; } } catch (Exception ex) { /* set message */ // UpdateStatus(true, ex.Message); UpdateStatus(false, "Port Error Occured"); connected = false; } finally { uc.Close(); } // On Screen ID lbUnitId.Text = uc.ProductID; } } else { if (WriteInProcess) { lbUnitId.Text = "Write In Process"; } } }