private void rgbControl_OnClosed(object sender, ByteEventArgs e) { Dispatcher.UIThread.InvokeAsync(new Action(() => { mainViewer.IsVisible = true; if (e.Index != -1) { hue[e.Index] = e.Value; rgbButton[e.Index].Content = e.Value.ToString(); rgbButton[e.Index].Background = new SolidColorBrush(HueToColor.Convert(e.Value)); } })); }
public void SetButtonColor(int index, byte hue) { if (index < 0 || index > 1) { return; } if (index == 0) { color1 = hue; } else { color2 = hue; } SetButtonColor(index, HueToColor.Convert(hue)); }
public void SetMapping(byte[] modeMap, byte[] typeMap, byte[] rgbMap) { for (int i = 0; i < buttonModeCombo.Count; i++) { buttonModeCombo[i].SelectedIndex = (modeMap[i / 2] >> ((i % 2) * 4)) & 0xF; buttonTypeCombo[i].SelectedIndex = (typeMap[i / 2] >> ((i % 2) * 4)) & 0xF; if (buttonTypeCombo[i].SelectedIndex == 0) { rgbButton[i].IsEnabled = false; } else { rgbButton[i].IsEnabled = true; } rgbButton[i].Content = rgbMap[i].ToString(); rgbButton[i].Background = new SolidColorBrush(HueToColor.Convert(rgbMap[i])); } fadeTimeNumeric.Value = modeMap[6] | modeMap[7] << 8; Array.Copy(modeMap, typeMapping, 8); Array.Copy(typeMap, 0, typeMapping, 8, 6); Array.Copy(rgbMap, 0, rgbMapping, 0, 12); }