private void CreateAreaCommands()
        {
            if (_commands.Count <= 0)
            {
                return;
            }

            FastRingAreaInfoCommands.Clear();
            NormalRingAreaInfoCommands.Clear();
            SlowRingAreaInfoCommands.Clear();

            foreach (var command in _commands)
            {
                if (command.AreaId == -1)
                {
                    SetAllAreas(command.NewColor);
                    continue;
                }

                var patternCombItem = new CommUI.Pattern_Comb_Item
                {
                    Bg_Brush_Solid = { Color = command.NewColor },
                    Sel_Item       = { Style = null }
                };

                patternCombItem.Sel_Item.Background = patternCombItem.Bg_Brush_Solid;
                patternCombItem.Sel_Item.Content    = string.Empty;
                patternCombItem.But_Args            = CommUI.Get_Color_Sceenes_class_From_Brush(patternCombItem.Bg_Brush_Solid);

                patternCombItem.Bri   = command.Bright;
                patternCombItem.Speed = command.Speed;

                patternCombItem.Type = command.NewMode;
                var area = new CommUI.Area_class(patternCombItem, command.AreaId, null);

                foreach (var extAreaInfo in _allExtAreaInfo.Where(extAreaInfo => extAreaInfo.Area_index == area.Area_index))
                {
                    area.Ext_Area_id = extAreaInfo.Ext_Area_id;
                }

                if (area.Ext_Area_id == LedLib2.ExtLedDev.None)
                {
                    FastRingAreaInfoCommands.Add(area);
                }
                else if (area.Ext_Area_id == LedLib2.ExtLedDev.Kingston_RAM)
                {
                    NormalRingAreaInfoCommands.Add(area);
                }
                else
                {
                    SlowRingAreaInfoCommands.Add(area);
                }
            }
        }
        private void CreateAreaCommands()
        {
            if (_commands.Count <= 0)
            {
                return;
            }

            MainboardCommandsCommands.Clear();
            foreach (var command in _commands)
            {
                if (command.AreaId == -1)
                {
                    foreach (CommUI.Area_class setAllArea in _allAreaInfo.Values)
                    {
                        setAllArea.Pattern_info.Bg_Brush_Solid.Color = command.NewColor;
                        setAllArea.Pattern_info.Type     = command.NewMode;
                        setAllArea.Pattern_info.Bri      = command.Bright;
                        setAllArea.Pattern_info.Speed    = command.Speed;
                        setAllArea.Pattern_info.But_Args = CommUI.Get_Color_Sceenes_class_From_Brush(setAllArea.Pattern_info.Bg_Brush_Solid);
                        MainboardCommandsCommands.Add(setAllArea);
                    }
                    continue;
                }

                CommUI.Area_class area = _allAreaInfo[command.AreaId];
                area.Pattern_info.Bg_Brush_Solid.Color = command.NewColor;
                area.Pattern_info.Type     = command.NewMode;
                area.Pattern_info.Bri      = command.Bright;
                area.Pattern_info.Speed    = command.Speed;
                area.Pattern_info.But_Args = CommUI.Get_Color_Sceenes_class_From_Brush(area.Pattern_info.Bg_Brush_Solid);

                if (area.Ext_Area_id == ExtLedDev.None) //Mainboard
                {
                    //TODO: Find lower level call and use it
                    MainboardCommandsCommands.Add(area);
                }
                else if (area.Ext_Area_id == ExtLedDev.Kingston_RAM && _ledObject.MB_Id == MBIdentify.I_Z390)
                {
                    _RAMNewColor = command.NewColor;
                    new Task(() => { SetRamColor(command.NewColor); }).Start();                                                                                      //Direct using MCU. Faster than using RGBFusion HAL.
                }
                else if (area.Ext_Area_id == ExtLedDev.GB_VGACard && _gb_led_periphs.GraphicsType == GB_LED_PERIPHERALS.DEVICE_VGA)                                  //KinstoM RAM by Nvidia i2C. A lot faster than setting ram but still slow using rgbfusion methods.
                {
                    new Task(() => { AorusVGA.SetDirect(System.Drawing.Color.FromArgb(255, command.NewColor.R, command.NewColor.G, command.NewColor.B)); }).Start(); //Direct GvLedLib lib. A lot faster than RGBFusion HAL.
                }
                else
                {
                    MainboardCommandsCommands.Add(area); // Left devices, for now i left this just for compatibility but it may be slow on some rigs.
                }
                _allAreaInfo[command.AreaId] = area;
            }
        }
        private void FillAllAreaInfo()
        {
            _allAreaInfo.Clear();
            foreach (CommUI.Area_class area in GetAllAreaInfo())
            {
                var patternCombItem = new CommUI.Pattern_Comb_Item
                {
                    Bg_Brush_Solid = { Color = area.Pattern_info.Bg_Brush_Solid.Color },
                    Sel_Item       = { Style = null }
                };

                patternCombItem.Sel_Item.Background = patternCombItem.Bg_Brush_Solid;
                patternCombItem.Sel_Item.Content    = string.Empty;
                patternCombItem.But_Args            = CommUI.Get_Color_Sceenes_class_From_Brush(patternCombItem.Bg_Brush_Solid);
                patternCombItem.Bri   = area.Pattern_info.Bri;
                patternCombItem.Speed = area.Pattern_info.Speed;
                patternCombItem.Type  = area.Pattern_info.Type;
                CommUI.Area_class newArea = new CommUI.Area_class(patternCombItem, area.Area_index, null);
                _allAreaInfo.Add(area.Area_index, newArea);
            }

            var y = GetAllExtAreaInfo();

            foreach (CommUI.Area_class extArea in GetAllExtAreaInfo())
            {
                var patternCombItem = new CommUI.Pattern_Comb_Item
                {
                    Bg_Brush_Solid = { Color = extArea.Pattern_info.Bg_Brush_Solid.Color },
                    Sel_Item       = { Style = null }
                };

                patternCombItem.Sel_Item.Background = patternCombItem.Bg_Brush_Solid;
                patternCombItem.Sel_Item.Content    = string.Empty;
                patternCombItem.But_Args            = CommUI.Get_Color_Sceenes_class_From_Brush(patternCombItem.Bg_Brush_Solid);
                patternCombItem.Bri   = extArea.Pattern_info.Bri;
                patternCombItem.Speed = extArea.Pattern_info.Speed;
                patternCombItem.Type  = extArea.Pattern_info.Type;
                CommUI.Area_class newExtArea = new CommUI.Area_class(patternCombItem, extArea.Area_index, null);
                newExtArea.Ext_Area_id = extArea.Ext_Area_id;
                _allAreaInfo.Add(newExtArea.Area_index, newExtArea);
            }
        }
        public static void Creative_Profile_Ext(string proXmlFilePath, List <Comm_LED_Fun.Ext_Led_class> extAreaInfo, Color defaultColor, string profileName = "")
        {
            var areaClasses = new List <CommUI.Area_class>();

            foreach (var areaInfo in extAreaInfo)
            {
                var patternCombItem = new CommUI.Pattern_Comb_Item
                {
                    Type           = 0,
                    Bg_Brush_Solid = { Color = defaultColor },
                    Sel_Item       = { Style = null }
                };
                patternCombItem.Sel_Item.Background = patternCombItem.Bg_Brush_Solid;
                patternCombItem.Sel_Item.Content    = string.Empty;
                patternCombItem.But_Args            = CommUI.Get_Color_Sceenes_class_From_Brush(patternCombItem.Bg_Brush_Solid);
                var areaClass = new CommUI.Area_class(patternCombItem, areaInfo.DivsNum, null)
                {
                    Ext_Area_id = areaInfo.extLDev
                };
                areaClasses.Add(areaClass);
            }
            CommUI.Export_to_xml(areaClasses, proXmlFilePath, profileName);
        }
Beispiel #5
0
        public void SetAreas()
        {
            while (_newChangeThread.IsAlive)
            {
                _commandEvent.WaitOne();
                _commandEvent.Reset();

                var areaInfo = new List <CommUI.Area_class>();

                foreach (var command in _commands)
                {
                    if (command.AreaId == -1)
                    {
                        SetAllAreas(command.NewColor);
                        continue;
                    }

                    var patternCombItem = new CommUI.Pattern_Comb_Item
                    {
                        Bg_Brush_Solid = { Color = command.NewColor },
                        Sel_Item       = { Style = null }
                    };
                    patternCombItem.Sel_Item.Background = patternCombItem.Bg_Brush_Solid;
                    patternCombItem.Sel_Item.Content    = string.Empty;
                    patternCombItem.But_Args            = CommUI.Get_Color_Sceenes_class_From_Brush(patternCombItem.Bg_Brush_Solid);

                    patternCombItem.Bri   = command.Bright;
                    patternCombItem.Speed = command.Speed;

                    patternCombItem.Type = command.NewMode;
                    var area = new CommUI.Area_class(patternCombItem, command.AreaId, null);

                    foreach (var extAreaInfo in _allExtAreaInfo.Where(extAreaInfo => extAreaInfo.Area_index == area.Area_index))
                    {
                        area.Ext_Area_id = extAreaInfo.Ext_Area_id;
                    }

                    areaInfo.Add(area);
                }

                if (_commands.Count > 0)
                {
                    //_ledFun.Set_Sync(false);
                    _ledFun.Set_Adv_mode(areaInfo, true);
                    //Not required anymore

                    /*
                     * var requireNonDirectModeAreaInfo = areaInfo.FindAll(i => i.Pattern_info.Type > 0);
                     * if (requireNonDirectModeAreaInfo.Count > 0)
                     * {
                     *
                     *  _ledFun.Set_Adv_mode(requireNonDirectModeAreaInfo);
                     *  do
                     *  {
                     *      Thread.Sleep( 10);
                     *  }
                     *  while (!_areaChangeApplySuccess);
                     * }
                     */
                }
            }
        }