コード例 #1
0
        public string GetModelKey()
        {
            SensorModel sm = ConfigData.SensorModelRoot.SensorModels.Find(s => s.Fields.Exists(f => f.Name == this.Name));

            if (sm != null)
            {
                return(sm.Name);
            }
            else
            {
                return("");
            }
        }
コード例 #2
0
        public SensorModel Copy()
        {
            MemoryStream  ms  = new MemoryStream();
            SensorModel   sm  = null;
            XmlSerializer xsl = new XmlSerializer(typeof(SensorModel));

            xsl.Serialize(ms, this);
            ms.Seek(0, SeekOrigin.Begin);
            sm = (SensorModel)xsl.Deserialize(ms);
            ms.Close();

            //for (int i = 0; i < Fields.Count; i++)
            //{
            //    if (Fields[i].Alarm != null)
            //    {
            //        sm.Fields[i].Alarm = Fields[i].Alarm;
            //    }
            //}

            return(sm);
        }