// Set the substitution rule data private void SubSet_Click(object sender, EventArgs e) { Src src = (Src)cbSource.SelectedIndex; if (Subs[(int)src] != null) { ModbusPkt res = new ModbusPkt(AsyncIO.TaskType.Substitutions) { substitution = Subs[(int)src] }; parent.asyncIO.AsyncIOTasks.Add(res); } SetButtonEnables(); }
// Request the substitution rules and wait for the response private void SubGet_Click(object sender, EventArgs e) { if (MB.IsConnected) { getInProgress = true; // Avoid multiple concurrent requests parent.asyncIO.Complete += SubGet_Complete; // Register for completion ModbusPkt res = new ModbusPkt(AsyncIO.TaskType.Substitutions) { substitution = null }; parent.asyncIO.AsyncIOTasks.Add(res); SetButtonEnables(); } }