private void CreateGroup(object sender, RoutedEventArgs e) { if (textBoxGroupID.Text.Length < 1) { MessageBox.Show("Please enter a unique group id"); textBoxGroupID.Focus(); return; } if (comboBoxFunction.SelectedItem == null) { MessageBox.Show("Please select a function for the group."); comboBoxFunction.Focus(); return; } // Create group //LEDGroup g = new LEDGroup(); //g.ID = textBoxGroupID.Text; //g.Function = (IlluminatorFunction)comboBoxFunction.SelectedValue; //// Add group to manager //Illuminator.Instance.LEDManager.LEDGroups.Add(g); //// Set combobox groups on assign tab //comboBoxGroups.ItemsSource = Illuminator.Instance.LEDManager.LEDGroups; //comboBoxGroups.DataContext = Illuminator.Instance.LEDManager.LEDGroups; //comboBoxGroups.DisplayMemberPath = "ID"; //comboBoxGroups.SelectedItem = 0; // Add group button to wrap panel GazeGUIVelocity.Button btn = new GazeGUIVelocity.Button(); //btn.Label = g.ID; try { btn.Icon = new BitmapImage(GazeTrackerUI.TrackerViewer.GPU.Global.MakePackUri("Graphics/lightbulbWhite.png")); } catch (Exception ex) { } btn.ActivationMethod = "Mouse"; btn.Margin = new Thickness(15, 0, 0, 0); btn.Action += new RoutedEventHandler(btnGroup_Action); WrapPanelGroups.Children.Add(btn); }
private void btnGroup_Action(object sender, RoutedEventArgs e) { foreach (GazeGUIVelocity.Button b in WrapPanelGroups.Children) { b.SelectedGlow = false; } GazeGUIVelocity.Button selectedBtn = (GazeGUIVelocity.Button)sender; selectedBtn.SelectedGlow = true; //selectedGroup = Illuminator.Instance.LEDManager.GetLEDGroup(selectedBtn.Label); //if (selectedGroup.Channels.Count == 0) //{ // MessageBox.Show("The group has no LED channels assigned to it, click tab \"Assign LEDs\" to add assign channels"); // return; //} //Illuminator.Instance.LEDManager.SetBrightness(selectedGroup, Convert.ToInt32(SliderBrightness.Value)); e.Handled = true; }