private void InitGui(byte colorNb) { EVOLedColor tmp = (EVOLedColor)_EVOLedColorMgt.m_EVOLedColorList.First(c => c.ColorNB == colorNb); sld_r.Value = tmp.Color.RED; sld_g.Value = tmp.Color.GREEN; sld_b.Value = tmp.Color.BLUE; }
private void comunication_EVOEvent(object sender, EVOData e) { if (e._cmdType == CmdType.B2M_CMD_COLOR_SET) { B2MColorSet cmd = new B2MColorSet(e.datain, 0); if (cmd.Result == 1) { MessageBox.Show("Set Color Ok"); System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() => { EVOLedColor tmp = (EVOLedColor)_EVOLedColorMgt.m_EVOLedColorList.First(c => c.ColorNB == this.cb_Led.SelectedIndex); tmp.Color.RED = (byte)sld_r.Value; tmp.Color.GREEN = (byte)sld_g.Value; tmp.Color.BLUE = (byte)sld_b.Value; Function.XmlSerializer.SaveToXml("EVO.LedSetting.xml", _EVOLedColorMgt, typeof(EVOLedColorMgt), null); } )); } } }