// override object.Equals public override bool Equals(object obj) { // // See the full list of guidelines at // http://go.microsoft.com/fwlink/?LinkID=85237 // and also the guidance for operator== at // http://go.microsoft.com/fwlink/?LinkId=85238 // if (obj == null || GetType() != obj.GetType()) { return(false); } TrainMes mes = obj as TrainMes; if (mes != null) { return(mes.CBIPos == CBIPos && mes.RunMode == RunMode && mes.Speed == Speed && mes.Destnation == Destnation && mes.IsPlanTrain == IsPlanTrain && mes.TrainPos == TrainPos); } return(base.Equals(obj)); }
TrainMes TrainMesFactory(GraphicElement ge, ZC2ATS info) { TrainMes mes = new TrainMes(); if (ge is Section) { Section sc = ge as Section; mes.CBIPos = sc == null ? null : sc.StationID.ToString(); } else { RailSwitch rs = ge as RailSwitch; mes.CBIPos = rs == null ? null : rs.StationID.ToString(); } mes.RunMode = "AM"; mes.Speed = "80"; mes.Destnation = "无"; mes.IsPlanTrain = "否"; mes.TrainPos = ge == null ? "无" : ge.Name + " " + info.Offset.ToString(); return(mes); }