Пример #1
0
        public SystemTrayViewModel()
        {
            ActiveIcon = "Resources/octopode_icon.ico";
            device     = new KrakenDevice(DeviceEnumerator.EnumerateKrakenX62Devices().First());
            Task.Run(() => RefreshControllerState());
            device.StartReading();


            var key = Registry.CurrentUser.OpenSubKey("Software", true);

            if (key == null)
            {
                Console.Error.WriteLine("Could not open Registry Key");
                return;
            }

            appKey = key.OpenSubKey("Octopode", true);
            if (appKey == null)
            {
                appKey = key.CreateSubKey("Octopode", true, RegistryOptions.None);
            }

            LoadProfile();

            logoManager = new LightningManager(LightChannel.Logo);
            rimManager  = new LightningManager(LightChannel.Rim);

            logoManager.OnNewLightSetting += LightingManagerCallback;
            rimManager.OnNewLightSetting  += LightingManagerCallback;

            commander = new CommandController(device.usbDevice);
        }
Пример #2
0
        public void SetPumpSpeedPerformance()
        {
            var messages = KrakenDevice.GenerateCoolingMessage(true, true, 70, 70, 70, 70, 70, 70, 70, 70, 80, 85, 90,
                                                               95, 100, 100, 100, 100, 100, 100, 100, 100, 100);

            foreach (var message in messages)
            {
                commander.AddCommand(message);
            }
        }
Пример #3
0
        public void SetFanSpeedPerformance()
        {
            var messages = KrakenDevice.GenerateCoolingMessage(false, true, 50, 50, 50, 50, 50, 50, 50, 50, 60, 70, 80,
                                                               90, 100, 100, 100, 100, 100, 100, 100, 100, 100);

            foreach (var message in messages)
            {
                commander.AddCommand(message);
            }
        }
Пример #4
0
        public void SetFanSpeedSilent()
        {
            var messages = KrakenDevice.GenerateCoolingMessage(false, true, 25, 25, 25, 25, 25, 25, 25, 25, 35, 45, 55,
                                                               75, 100, 100, 100, 100, 100, 100, 100, 100, 100);

            foreach (var message in messages)
            {
                commander.AddCommand(message);
            }
        }
Пример #5
0
 private void LightingManagerCallback(LightningManager sender, LightSetting setting)
 {
     commander.AddCommand(KrakenDevice.GenerateLightMessage(setting.mode,
                                                            new ControlBlock(false, false, sender.lightChannel),
                                                            new LEDConfiguration(0, 0, AnimationSpeed.Normal),
                                                            new[] {
         0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF,
         0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF
     }));
 }
Пример #6
0
        static void Main(string[] args)
        {
            var devices = new List <HidDevice>(DeviceEnumerator.EnumerateKrakenX62Devices());
            var tasks   = new List <Task>();

            var deviceList = new List <HidDevice>(DeviceEnumerator.EnumerateKrakenX62Devices());

            if (deviceList.Count < 1)
            {
                Console.WriteLine("No Kraken X62 device found!");
                return;
            }
            var device = new KrakenDevice(deviceList[0]);

            var messages = KrakenDevice.GenerateCoolingMessage(false, true, 25,
                                                               25,
                                                               25,
                                                               25,
                                                               25,
                                                               25,
                                                               25,
                                                               25,
                                                               35,
                                                               45,
                                                               55,
                                                               75,
                                                               100,
                                                               100,
                                                               100,
                                                               100,
                                                               100,
                                                               100,
                                                               100,
                                                               100,
                                                               100);
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            foreach (var message in messages)
            {
                device.Write(message);
            }
            stopwatch.Start();
            Console.WriteLine($"Time taken: {stopwatch.ElapsedMilliseconds}ms - Avg: {stopwatch.ElapsedMilliseconds / (float) messages.Length}ms");
        }
Пример #7
0
        private void UpdateBenchmark()
        {
            System.Console.WriteLine("Starting staged Performance Benchmark:");
            Console.WriteLine("- Stage 1: Slow");
            for (var i = 0; i < 10; i++)
            {
                commander.AddCommand(KrakenDevice.GenerateCoolingMessage(true, false, 35));
                commander.AddCommand(KrakenDevice.GenerateCoolingMessage(false, false, 35));
                Thread.Sleep(1000);
            }

            Console.WriteLine("- Stage 2: Full");
            for (var i = 0; i < 10; i++)
            {
                commander.AddCommand(KrakenDevice.GenerateCoolingMessage(true, false, 100));
                commander.AddCommand(KrakenDevice.GenerateCoolingMessage(false, false, 100));
                Thread.Sleep(1000);
            }

            Console.WriteLine("- Stage 3: Reset");
            commander.AddCommand(KrakenDevice.GenerateCoolingMessage(true, false, 40));
            commander.AddCommand(KrakenDevice.GenerateCoolingMessage(false, false, 40));
        }
Пример #8
0
        public void SetAnimationSpeed(AnimationSpeed speedSetting, MenuItem sender)
        {
            if (previousSpeedBox != null)
            {
                previousSpeedBox.IsChecked = false;
            }

            sender.IsChecked           = true;
            previousSpeedBox           = sender;
            logoManager.animationSpeed = speedSetting;
            rimManager.animationSpeed  = speedSetting;
            commander.AddCommand(KrakenDevice.GenerateLightMessage(logoManager.selectedSetting.mode,
                                                                   new ControlBlock(false, false, logoManager.lightChannel),
                                                                   new LEDConfiguration(0, 0, speedSetting), new[] {
                0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF,
                0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF
            }));
            commander.AddCommand(KrakenDevice.GenerateLightMessage(rimManager.selectedSetting.mode,
                                                                   new ControlBlock(false, false, rimManager.lightChannel),
                                                                   new LEDConfiguration(0, 0, speedSetting), new[] {
                0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF,
                0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF
            }));
        }