public static string GetButtonName(bool isPrimaryPage, RegionSetting regionSetting) { string name = "Button" + (isPrimaryPage ? Enum.GetName(typeof(Constants.Colors), regionSetting.PrimaryColor) : Enum.GetName(typeof(Constants.Colors), regionSetting.SecondaryColor)) + Enum.GetName(typeof(Constants.Intensities), regionSetting.Intensity); switch (regionSetting.Region) { case Constants.Regions.Left: name += "Left"; break; case Constants.Regions.Middle: name += "Middle"; break; case Constants.Regions.Right: name += "Right"; break; } if (name.Contains("Off") || name.Contains(("White"))) { name = name.Replace( Enum.GetName(typeof(Constants.Intensities), regionSetting.Intensity), ""); } return(name); }
public void SetMode(Constants.Modes mode, RegionSetting left, RegionSetting middle, RegionSetting right, int speed) { switch (mode) { case Constants.Modes.Normal: SendCommand(66, (byte)left.Region, (byte)left.PrimaryColor, (byte)left.Intensity); SendCommand(66, (byte)middle.Region, (byte)middle.PrimaryColor, (byte)middle.Intensity); SendCommand(66, (byte)right.Region, (byte)right.PrimaryColor, (byte)right.Intensity); break; case Constants.Modes.Gaming: SendCommand(66, (byte)left.Region, (byte)left.PrimaryColor, (byte)left.Intensity); break; case Constants.Modes.Wave: case Constants.Modes.DualColor: case Constants.Modes.Breathe: SendCommandForDualModeRegion(Constants.Regions.Left, (byte)left.PrimaryColor, (byte)left.SecondaryColor, (byte)left.Intensity, (byte)speed); SendCommandForDualModeRegion(Constants.Regions.Middle, (byte)middle.PrimaryColor, (byte)middle.SecondaryColor, (byte)middle.Intensity, (byte)speed); SendCommandForDualModeRegion(Constants.Regions.Right, (byte)right.PrimaryColor, (byte)right.SecondaryColor, (byte)right.Intensity, (byte)speed); break; } SendCommand(65, (byte)mode, 0, 0); }
private void MainWindow_OnInitialized(object sender, EventArgs e) { //Setup the comboBox with the modes from the enum foreach (string mode in Enum.GetNames(typeof(Constants.Modes))) { ComboBoxMode.Items.Add(mode); } ComboBoxMode.SelectedIndex = 0; ComboBoxMode.SelectionChanged += OnModeChanged; _leftRegionSetting = new RegionSetting(Constants.Regions.Left, Constants.Intensities.High, Constants.Colors.Blue, Constants.Colors.Red); _middleRegionSetting = new RegionSetting(Constants.Regions.Middle, Constants.Intensities.High, Constants.Colors.Blue, Constants.Colors.Red); _rightRegionSetting = new RegionSetting(Constants.Regions.Right, Constants.Intensities.High, Constants.Colors.Blue, Constants.Colors.Red); _hidManager = new HidManager(); }