private void kryptonButtonAdd_Click(object sender, EventArgs e) { try { FlagModule flag = new FlagModule(); if (manager.plcs.Count > 0) { flag.PlcId = manager.plcs.First().Id; } binding.Add(flag); } catch (Exception ex) { UiHelper.ShowException(ex); } }
private async void dgv_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 & e.ColumnIndex >= 0) { if (dgv.Columns[e.ColumnIndex].Name == "Write") { int writeValue = Convert.ToInt32(dgv.Rows[e.RowIndex].Cells[writeValueColumn].Value); FlagModule flag = binding[e.RowIndex]; await Task.Run(() => { FlagBusiness.Write(flag.Id, writeValue); }); } } }