我有一些代码,可以从网络接收数据并移动一些跟踪栏。
每个跟踪栏都根据相应的通道移动。
为此,要有一个“ switch”语句:
private void OnChannelFade(object sender, OSCPacket packet)
{
this.BeginInvoke(new ThreadSafeOSC(ThreadSafeOnChannelFade), packet.ToParams());
}
private void ThreadSafeOnChannelFade(OSCPacket packet)
{
TrackBar trackBar = GetTrackBarFromChannel(Convert.ToInt32(packet.Nodes[2]));
trackBar.Tag = packet;
trackBar.Value = (int)(packet.Arguments[0].ToFloat() * 100);
}
private TrackBar GetTrackBarFromChannel(int channel)
{
pan2.Value = channel;
switch (channel)
{
case 1:
case 9:
case 17:
case 25:
return fader1;
如何隔离一种情况,换句话说,如何链接一个跟踪栏以仅从一个通道获取数据?