Exemplo n.º 1
0
        /*
         * Helpers
         */

        public async Task <HeadSetErrorCode> setStaticColor(Color color)
        {
            if (color.Name == "ff000000" || color.Name == "Black")
            {
                colorModeBox.SelectedIndex = (int)HeadsetLightingEnum.OFF;
                return(HeadSetErrorCode.HID_WriteSuccess);
            }
            if (colorModeBox.SelectedIndex != (int)HeadsetLightingEnum.Static)
            {
                SetColorRegistry(color);
                colorModeBox.SelectedIndex = (int)HeadsetLightingEnum.Static;
                return(HeadSetErrorCode.HID_WriteSuccess);
            }
            HeadSetErrorCode error = await AccessoryHeadSetHelper.SetHeadsetStaticColorAsync(hidIndex, toHeadSetColor(color));

            if (checkErrors(error))
            {
                staticColorPanel.BackColor = color;
                if (color.Name != "ff000000" && color.Name != "Black")
                {
                    SetColorRegistry(color);
                }
            }
            return(error);
        }
Exemplo n.º 2
0
        private async void colorModeBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            HeadsetLightingEnum mode = (HeadsetLightingEnum)colorModeBox.SelectedIndex;

            SetLightModeRegistry(mode);
            switch (mode)
            {
            case HeadsetLightingEnum.ColorShift:
                btnStaticColor.Enabled = false;
                btnColorList.Enabled   = true;
                colorLengthBox.Enabled = true;
                await setBlinkingAnimation(GetColorListRegistry("BlinkingColors"));

                break;

            case HeadsetLightingEnum.Audio:
                btnStaticColor.Enabled = false;
                btnColorList.Enabled   = false;
                colorLengthBox.Enabled = false;
                await setAudioAnimation();

                break;

            case HeadsetLightingEnum.Static:
                btnStaticColor.Enabled = true;
                btnColorList.Enabled   = false;
                colorLengthBox.Enabled = false;
                await setStaticColor(GetColorRegistry());

                break;

            case HeadsetLightingEnum.OFF:
                btnStaticColor.Enabled = false;
                btnColorList.Enabled   = false;
                colorLengthBox.Enabled = false;
                HeadSetErrorCode error = await AccessoryHeadSetHelper.SetHeadsetStaticColorAsync(hidIndex, toHeadSetColor(Color.Black));

                if (checkErrors(error))
                {
                    staticColorPanel.BackColor = Color.Black;
                }
                break;
            }
        }