Esempio n. 1
0
        private static void PlayRandomEffect(AuraMethod method, SynchronousOptionInput syncOption, UpsOptionInput upsOption)
        {
            Console.Clear();
            PrintLine("Setting all colors...");
            if (method == AuraMethod.AuraDev)
            {
                if (syncOption == SynchronousOptionInput.Synchronous)
                {
                    AuraDev.PlayRandomEffectSync(GetUps(upsOption));
                }
                else
                {
                    AuraDev.PlayRandomEffectAsync(GetUps(upsOption));
                }
            }

            if (method == AuraMethod.AuraSdk)
            {
                if (syncOption == SynchronousOptionInput.Synchronous)
                {
                    AuraSync.PlayRandomEffectSync(GetUps(upsOption));
                }
                else
                {
                    AuraSync.PlayRandomEffectAsync(GetUps(upsOption));
                }
            }
        }
Esempio n. 2
0
        private static void SetAllColors(AuraMethod method, Color color)
        {
            Console.Clear();
            PrintLine("Setting all colors...");
            if (method == AuraMethod.AuraDev)
            {
                AuraDev.ChangeAllDevicesColor(color);
            }
            if (method == AuraMethod.AuraSdk)
            {
                AuraSync.ChangeAllDevicesColor(color);
            }

            ContinueLine();
        }
Esempio n. 3
0
 private static void GoToRgbTestingMenu(AuraMethod method)
 {
     Console.Clear();
     RgbTestingMenu(method);
 }
Esempio n. 4
0
        private static void RgbTestingMenu(AuraMethod method)
        {
            string input;

            PrintLine($@"
What effect would you like to run?

Options:
1 - All colors RED
2 - All colors BLUE
3 - All colors GREEN
4 - Rainbow across the device
5 - Random Colors per key

0 - Back
");
            do
            {
                ClearLine();
            } while (!IsValidEnum(typeof(RgbEffectOptionInput), input = Console.ReadLine()));
            Console.Clear();

            var effect = (RgbEffectOptionInput)int.Parse(input);

            switch (effect)
            {
            case RgbEffectOptionInput.AllRed:
                SetAllColors(method, Color.Red);
                GoToRgbTestingMenu(method);
                return;

            case RgbEffectOptionInput.AllBlue:
                SetAllColors(method, Color.Blue);
                GoToRgbTestingMenu(method);
                return;

            case RgbEffectOptionInput.AllGreen:
                SetAllColors(method, Color.Green);
                GoToRgbTestingMenu(method);
                return;

            case RgbEffectOptionInput.Back:
                GoToSdkSelectionMenu();
                break;

            case RgbEffectOptionInput.RainbowEffect:
            case RgbEffectOptionInput.RandomEffect:
                // play this effect later
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            PrintLine($@"
Would you like to do this synchronously or asynchronously?


Options:
1 - Synchronous (Light up the colours in order of device)
2 - Asynchronous (Light up the colours Asap)
");
            do
            {
                ClearLine();
            } while (!IsValidEnum(typeof(SynchronousOptionInput), input = Console.ReadLine()));
            Console.Clear();

            var syncOption = (SynchronousOptionInput)int.Parse(input);

            PrintLine($@"
What Update per second would you like this device to update at?

0 - Unlimited
1 -  1 UPS
2 -  2 UPS
3 -  5 UPS
4 - 10 UPS
5 - 20 UPS
6 - 30 UPS
7 - 60 UPS
");
            do
            {
                ClearLine();
            } while (!IsValidEnum(typeof(UpsOptionInput), input = Console.ReadLine()));

            var ups = (UpsOptionInput)int.Parse(input);

            switch (effect)
            {
            case RgbEffectOptionInput.RainbowEffect:
                PlayRainbowEffect(method, syncOption, ups);
                GoToRgbTestingMenu(method);
                return;

            case RgbEffectOptionInput.RandomEffect:
                PlayRandomEffect(method, syncOption, ups);
                GoToRgbTestingMenu(method);
                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }