From 36776bfbff6f15f7239924777651392945ebb2a0 Mon Sep 17 00:00:00 2001 From: James Barnett Date: Thu, 27 Jul 2017 13:02:31 +0100 Subject: Rejig folder structure --- NucLedController/MainWindow.xaml.cs | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 NucLedController/MainWindow.xaml.cs (limited to 'NucLedController/MainWindow.xaml.cs') 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 +{ + /// + /// Interaction logic for MainWindow.xaml + /// + 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); + } + + } + } +} -- cgit v1.2.3