Ejemplo n.º 1
0
        /// <summary>
        /// 错误操作产生工厂
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="IsError"></param>
        /// <returns></returns>
        HandleMes HandleFactory(object obj, bool IsError)
        {
            HandleMes mes = new HandleMes();

            if (obj is string)
            {
                mes.CBIName      = "";
                mes.HandleButton = obj as string;
            }
            else
            {
                if (obj is Signal)
                {
                    Signal s = obj as Signal;
                    mes.CBIName      = s == null ? null : s.StationID.ToString();
                    mes.HandleButton = s == null ? null : s.Name;
                }
                else
                {
                    RailSwitch rs = obj as RailSwitch;
                    mes.CBIName      = rs == null ? null : rs.StationID.ToString();
                    mes.HandleButton = rs == null ? null : rs.Name;
                }
                if (IsError)
                {
                    mes.ErrorMes1 = "操作有误";
                }
            }
            return(mes);
        }
Ejemplo n.º 2
0
        // 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);
            }

            HandleMes mes = obj as HandleMes;

            if (mes != null)
            {
                return(mes.CBIName == CBIName &&
                       mes.ErrorMes1 == ErrorMes1 &&
                       mes.ErrorMes2 == ErrorMes2 &&
                       mes.HandleButton == HandleButton);
            }

            return(base.Equals(obj));
        }