예제 #1
0
        private void RadioButtonChanged(object sender, RoutedEventArgs e)
        {
            RadioButton li = (sender as RadioButton);

            switch (li.Name)
            {
            case "RunningDot":
                _selectedMisc = _runningDot;
                break;

            case "Rainbow":
                _selectedMisc = _rainbow;
                break;

            case "ColorChanger":
                _selectedMisc = _colorchanger;
                break;

            case "RunningColors":
                _selectedMisc = _runningColors;
                break;

            default:
                System.Diagnostics.Debug.Print("Weird radio button selected");
                break;
            }
            SetNewRGBCreator(_selectedMisc);
        }
예제 #2
0
        private void SetNewRGBCreator(RGBCreator.IRGBCreator new_rgb_creator)
        {
            if (_current_rgb_creator != null)
            {
                _current_rgb_creator.Pause(); // pause current rgbCreator
            }

            if (new_rgb_creator != null && _current_rgb_output != null)
            {
                try
                {
                    new_rgb_creator.SetRGBOutput(_current_rgb_output);
                    new_rgb_creator.Start(); // start new rgbCreator
                }
                catch (RGBCreator.RGBCreatorException ex)
                {
                    MessageBox.Show(ex.Message, $"Error setting RGB-Creator {new_rgb_creator.GetType().Name}");
                }
            }
            _current_rgb_creator = new_rgb_creator;
        }