public bool OnCmdSaveConfig() { OpticalProbeConfig optical = new OpticalProbeConfig(); optical.SN = _sn; optical.ConfigInfo = new List <UseablePeripheral>(); foreach (CheckUseablePeripheral checkusea in _checkUseable) { if (checkusea.IsChecked) { optical.ConfigInfo.Add(checkusea.UseablePer); } } return(MonitorAllConfig.Instance().SaveOpticalProbeInfoCofig(_sn, optical)); }
private void OnCmdInitialize(string sn) { _sn = sn; _checkUseable.Clear(); if (MonitorAllConfig.Instance().AllOpticalProbeInfo == null || MonitorAllConfig.Instance().AllOpticalProbeInfo.UseablePeripheralList == null) { return; } foreach (UseablePeripheral useable in MonitorAllConfig.Instance().AllOpticalProbeInfo.UseablePeripheralList) { CheckUseablePeripheral checkuseable = new CheckUseablePeripheral(); checkuseable.UseablePer = useable; if (sn == MonitorAllConfig.Instance().ALLScreenName) { checkuseable.IsChecked = false; } else { OpticalProbeConfig optical = MonitorAllConfig.Instance().LedOpticalProbeConfigs.Find(a => a.SN == sn); checkuseable.IsChecked = false; if (optical == null || optical.ConfigInfo == null || optical.ConfigInfo.Count == 0) { checkuseable.IsChecked = false; } else { if (optical.ConfigInfo.FindIndex(a => a.Equals(useable)) >= 0) { checkuseable.IsChecked = true; } } } _checkUseable.Add(checkuseable); } }