ActionVisualizer.MainWindow.channelSelector_SelectionChanged C# (CSharp) Method

channelSelector_SelectionChanged() private method

private channelSelector_SelectionChanged ( object sender, System.Windows.Controls.SelectionChangedEventArgs e ) : void
sender object
e System.Windows.Controls.SelectionChangedEventArgs
return void
        private void channelSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (waveOut != null)
                StartStopSineWave();

            selectedChannels = (sender as ComboBox).SelectedIndex + 1;

            if (selectedChannels == 2)
            {
                _ink.Visibility = Visibility.Visible;
            }

            history.Clear();
            inverse_history.Clear();

            channelLabel = new int[selectedChannels];
            velocity = new int[selectedChannels];
            displacement = new int[selectedChannels];

            instant_displacement = new int[selectedChannels];
            prev_displacement = new int[selectedChannels];
            towards_displacement = new int[selectedChannels];

            for (int i = 0; i < selectedChannels; i++)
            {
                history.Add(new List<int> { 0 });
                inverse_history.Add(new List<int> { 0 });
                channelLabel[i] = i + 1;
                velocity[i] = 0;

                instant_displacement[i] = 0;
                prev_displacement[i] = 0;
                towards_displacement[i] = 1;

                displacement[i] = 0;
            }
        }