diff options
| author | James Barnett <james.barnett@fivium.co.uk> | 2017-07-27 13:02:31 +0100 |
|---|---|---|
| committer | James Barnett <james.barnett@fivium.co.uk> | 2017-07-27 13:02:31 +0100 |
| commit | 36776bfbff6f15f7239924777651392945ebb2a0 (patch) | |
| tree | 8e4c75b40bc45b888773cac33c9bbbf165da6fd9 /NucLedController/MainWindow.xaml.cs | |
| parent | b9c3039f0787c9ede5abf0da750615e4eced8f60 (diff) | |
| download | intel-nuc-led-controller-0.1.tar.xz intel-nuc-led-controller-0.1.zip | |
Rejig folder structurev0.1
Diffstat (limited to 'NucLedController/MainWindow.xaml.cs')
| -rw-r--r-- | NucLedController/MainWindow.xaml.cs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/NucLedController/MainWindow.xaml.cs b/NucLedController/MainWindow.xaml.cs new file mode 100644 index 0000000..2c26c7e --- /dev/null +++ b/NucLedController/MainWindow.xaml.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace NucLedController +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + //comboBoxColour.ItemsSource = Enum.GetValues(typeof(LEDController.Colour)); + comboBoxColour.ItemsSource = LEDColour.AvailableColours; + comboBoxColour.DisplayMemberPath = "DisplayName"; + comboBoxColour.SelectedIndex = 0; + //comboBoxColour.SelectedValuePath = "ByteValue"; + comboBoxTransition.ItemsSource = LEDTransition.AvailableTransitions; + comboBoxTransition.DisplayMemberPath = "DisplayName"; + comboBoxTransition.SelectedIndex = 0; + } + + private void button_Click(object sender, RoutedEventArgs e) + { + Console.WriteLine("clicked! " + (LEDColour)comboBoxColour.SelectedItem); + try + { + LEDController.SetLEDState((LEDTransition)comboBoxTransition.SelectedItem, (LEDColour)comboBoxColour.SelectedItem); + } + catch (Exception ex) + { + MessageBox.Show($"Error setting LED: {ex.Message.ToString()}", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); + } + + } + } +} |