public MainWindow() { InitializeComponent(); child = new LightStrip(this); child.Show(); child.ContentChanged(); Type cType = typeof(Controller); foreach (MethodInfo inf in cType.GetMethods()) { if (inf.ReturnType == typeof(void) && inf.GetParameters().Length == 0 && inf.Name != "Stop" && inf.Name != "ThreadMain") { wombocombo.Items.Add(new ComboBoxItem() { Content = inf.Name }); } } wombocombo.SelectedIndex = 0; c = new Controller(child); Closed += MainWindow_Closing; }
//Constructor, just sets up the necessary thread. //This actually needs to run separate from the UI thread for immediate updates in display //Not a problem that needs to be worried about on the robot public Controller(LightStrip strip) { this.strip = strip; runningThread = new Thread(() => ThreadMain()); runningThread.Start(); }