public FaultRuleItem(Wlst.client.FaultTypes.FaultSettingRuleOne rule, ObservableCollection <TmlFaultTypeViewModel> allfaults) { RuleId = rule.RuleId; Rule_name = rule.RuleName; target_equipment = rule.TargetEquipment; Op = rule.Op; Op_extend = rule.OpExtend; OpTimeSet = rule.AlarmTimeSet + 1; if (OpTimeSet == 2 || OpTimeSet == 3) { DtStart = rule.AlarmTimeStart + ""; DtEnd = rule.AlarmTimeEnd + ""; } if (OpTimeSet == 1) { DtStart = gettostr(rule.AlarmTimeStart); DtEnd = gettostr(rule.AlarmTimeEnd); } if (OpTimeSet == 4 || OpTimeSet == 5) { DtStart = rule.AlarmTimeStart + ""; DtEnd = rule.AlarmTimeEnd + ""; } for (int i = 0; i < 5; i++) { if (rule.ProperyContainKey.Count > i) { ProperyContainKey[i].Name = rule.ProperyContainKey[i]; } else { ProperyContainKey[i].Name = ""; } } ItemsAddto.Clear(); ItemsRemoveto.Clear(); var ntr = (from t in allfaults where t.IsEnable select t).ToList(); foreach (var f in ntr) { ItemsRemoveto.Add(new NameIntBool() { IsSelected = rule.FaultsRemoveOff.Contains(f.FaultId), Name = string.IsNullOrEmpty(f.FaultNameByDefine) ? f.FaultName : f.FaultNameByDefine, Value = f.FaultId }); } UpdateProCkey(); UpdateRemoveOffStr(); }
public FaultRuleItem(int id, ObservableCollection <TmlFaultTypeViewModel> allfaults) { RuleId = id; Rule_name = "屏蔽报警"; target_equipment = 1; Op = 1; Op_extend = 1; OpTimeSet = 1; //for (int i = 0; i < 5; i++) //{ // if (rule.ProperyContainKey.Count > i) // { // ProperyContainKey[i].Name = rule.ProperyContainKey[i]; // } // else // { // ProperyContainKey[i].Name = ""; // } //} ItemsAddto.Clear(); ItemsRemoveto.Clear(); var ntr = (from t in allfaults where t.IsEnable && (t.FaultId < 25 || t.FaultId > 80) select t).ToList(); foreach (var f in ntr) { ItemsRemoveto.Add(new NameIntBool() { IsSelected = false, Name = string.IsNullOrEmpty(f.FaultNameByDefine) ? f.FaultName : f.FaultNameByDefine, Value = f.FaultId }); } }