HandlerSettingsBox.xaml.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Handler Settings Box
  2. //
  3. // Douglas Thrift
  4. //
  5. // HandlerSettingsBox.xaml.cs
  6. /* Copyright 2014 Douglas Thrift
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. using System.Windows.Controls;
  21. public partial class HandlerSettingsBox : GroupBox
  22. {
  23. private Handler handler;
  24. public HandlerSettingsBox(Handler handler)
  25. {
  26. InitializeComponent();
  27. this.handler = handler;
  28. HandlerRadioButton.Content = handler.Setting.usage;
  29. foreach (Setting setting in handler.Settings)
  30. switch (setting.type)
  31. {
  32. case SettingType.OptionalExecutable:
  33. SettingsPanel.Children.Add(new OptionalExecutablePanel(setting));
  34. break;
  35. case SettingType.OptionalYesNoExecutable:
  36. SettingsPanel.Children.Add(new OptionalYesNoExecutablePanel(setting));
  37. break;
  38. case SettingType.OptionalYesNoDirectory:
  39. SettingsPanel.Children.Add(new OptionalYesNoDirectoryPanel(setting));
  40. break;
  41. }
  42. }
  43. private void HandlerRadioButton_Checked(object sender, System.Windows.RoutedEventArgs e)
  44. {
  45. SettingsPanel.IsEnabled = true;
  46. }
  47. private void HandlerRadioButton_Unchecked(object sender, System.Windows.RoutedEventArgs e)
  48. {
  49. SettingsPanel.IsEnabled = false;
  50. }
  51. }