public void SetTrackbar(int channel, int measure) { TrackBar ctrl; switch (channel) { case 1: ctrl = trackBar1; break; case 2: ctrl = trackBar2; break; case 3: ctrl = trackBar3; break; case 4: ctrl = trackBar4; break; default: ctrl = null; Console.WriteLine("SetTrackbar: Channel does not exist: " + channel); break; } if (ctrl.InvokeRequired) { SetTrackbarCallback d = new SetTrackbarCallback(SetTrackbar); this.Invoke(d, new object[] { channel, measure }); } else { ctrl.Value = measure; } }
private void TrackBarSetEnable(bool ON) { if (InvokeRequired) { SetTrackbarCallback d = new SetTrackbarCallback(TrackBarSetEnable); this.Invoke(d, new object[] { ON }); } else { this.trackFan1.Enabled = ON; this.trackMoto1.Enabled = ON; } }