public Wlst.client.FaultTypes.FaultTypeItem GetTmlFaultType() { var tmlfaule = new Wlst.client.FaultTypes.FaultTypeItem() { Color = this.color, FaultId = this.FaultId, FaultCheckKey = this.FaultCheckKey, FaultName = this.FaultName, FaultNameByDefine = this.FaultNameByDefine, FaultRemak = this.FaultRemak, IsEnable = this.IsEnable, PriorityLevel = (int)this.PriorityLevel, AlarmTimeSet = AlarmTimeType, AlarmTimeEnd = HourEndAlarm * 60 + MinuteEndAlarm, AlarmTimeStart = HourStartAlarm * 60 + MinuteStartAlarm, }; return(tmlfaule); }
public TmlFaultTypeViewModel(Wlst.client.FaultTypes.FaultTypeItem tmlFaultType) { this.AlarmTimeType = tmlFaultType.AlarmTimeSet; if (AlarmTimeType == 3) { this.IsTimeEnable = true; this.HourStartAlarm = tmlFaultType.AlarmTimeStart / 60; this.MinuteStartAlarm = tmlFaultType.AlarmTimeStart - HourStartAlarm * 60; this.HourEndAlarm = tmlFaultType.AlarmTimeEnd / 60; this.MinuteEndAlarm = tmlFaultType.AlarmTimeEnd - HourEndAlarm * 60; } else { this.IsTimeEnable = false; } foreach (var ff in CollectionAlarmTimeType) { if (ff.Value == this.AlarmTimeType) { SelectAlarmTimeTypeIndex = ff; break; } } this.IsSelfDefineFault = Visibility.Collapsed; this.FaultId = tmlFaultType.FaultId; if (FaultId == 0) { IsSelfDefineFault = Visibility.Visible; } this.FaultName = tmlFaultType.FaultName; this.FaultNameByDefine = tmlFaultType.FaultNameByDefine; this.FaultRemak = tmlFaultType.FaultRemak; this.IsEnable = tmlFaultType.IsEnable; this.PriorityLevel = tmlFaultType.PriorityLevel; if (tmlFaultType.Color != "#00FFFFFF") { this.Color = tmlFaultType.Color; } else { this.Color = "#FFFFFFFF"; } this.FaultCheckKey = tmlFaultType.FaultCheckKey; //if (this.FaultId < 6) //{ // // CheckBoxIsEnable = false; // IsEnable = true; //} // else CheckBoxIsEnable = true; CheckBoxIsEnable = true; // IsEnableEnable = tmlFaultType.IsEnable; if (this.FaultId == 9 || this.FaultId == 10 || this.FaultId == 11 || this.FaultId == 15 || this.FaultId == 16 || this.FaultId == 17 || this.FaultId == 20) { CollectionAlarmTimeType.RemoveAt(2); } if (this.FaultId == 12 || this.FaultId == 13 || this.FaultId == 14 || this.FaultId == 21) { CollectionAlarmTimeType.RemoveAt(1); } }