public void Trigger(object sender_) { var sender = (InputChannel)sender_; var power = CurrentChannel.GetPower(); var val = CurrentChannel.GetValue(); // Invoke from main thread Action <object> TriggerDele = Trigger; if (ui.InvokeRequired) { ui.Invoke(TriggerDele, new object[] { sender_ }); return; } if (sender.InputConfig.ContinuousControl == false && power == 0.0) { return; } ui.velocityMapControl1.SetTrigger(val); ui.textBoxVelocity.Text = Math.Round(power, 3).ToString(); int hits = 0; Int32.TryParse(ui.textBoxHits.Text, out hits); ui.textBoxHits.Text = (hits + 1).ToString(); }