示例#1
0
        public HHDeviceProperty Bind(string bindName)
        {
            HHDeviceProperty prop = new HHDeviceProperty();

            prop.DataSrc     = this.DataSrc;
            prop.DisplayName = this.DisplayName;
            prop.Name        = this.Name;
            prop.Type        = this.Type;
            prop.GroupIndex  = this.GroupIndex;
            prop.GroupCount  = this.GroupCount;

            if (string.IsNullOrEmpty(bindName) == false)
            {
                switch (this.Type)
                {
                case "模拟量":
                    prop.Analog = AnalogManager.GetInstance().GetAnalog(this.DataSrc, bindName);
                    if (prop.Analog != null)
                    {
                        prop.IsBind = true;
                    }
                    break;

                case "曲线":
                    prop.Curves = CurveManager.GetInstance().GetCurves(this.DataSrc, bindName);
                    if (prop.Curves != null)
                    {
                        prop.IsBind = true;
                    }
                    break;
                }
            }

            return(prop);
        }
示例#2
0
        public HHDeviceGrp(IniDocument ini, int index)
        {
            string name = ini.GetString("设备", (index + 1).ToString());
            if (string.IsNullOrEmpty(name)) return;

            this.DevType = ini.GetInt(name, "设备类型", 0);
            if (this.DevType <= 0) return;

            this.Name = name;

            int propNum = ini.GetInt(name, "属性数目", 0);
            if (propNum <= 0) return;

            int devNum = ini.GetInt(name, "设备数目", 0);
            if (devNum <= 0) return;

            for (int i = 0; i < propNum; i++)
            {

                HHDeviceProperty prop = new HHDeviceProperty(ini, this, i);
                if (prop.IsValid)
                {
                    listProperty.Add(prop);
                    if (prop.Type == "模拟量")
                    {
                        listAnalogProperty.Add(prop);
                    }
                    else if (prop.Type == "曲线")
                    {
                        listCurveProperty.Add(prop);
                    }
                }
            }
            if (this.DevType != 4 && this.DevType != 8)
            {
                if (listProperty.Count <= 0) return;
            }
            if (listAnalogProperty.Count > 0)
            {
                SelectProperty(0, true);
            }
            for (int i = 0; i < devNum; i++)
            {
                HHDevice device = new HHDevice(ini, i, this);

                if (device.IsValid)
                {
                    listDevice.Add(device);
                }

            }

            this.BuildGroup();
            this.Level = 1;
            this.IsValid = true;
        }
示例#3
0
        public HHDeviceProperty GetProperty(HHDeviceProperty prop)
        {
            HHDeviceProperty devProp = null;
            for (int i = 0; i < listProp.Count; i++)
            {
                if (listProp[i].Name == prop.Name)
                {
                    devProp = listProp[i];
                    break;
                }
            }

            return devProp;
        }
示例#4
0
        public HHDeviceProperty GetProperty(HHDeviceProperty prop)
        {
            HHDeviceProperty devProp = null;

            for (int i = 0; i < listProp.Count; i++)
            {
                if (listProp[i].Name == prop.Name)
                {
                    devProp = listProp[i];
                    break;
                }
            }

            return(devProp);
        }
示例#5
0
 public void AddProperty(HHDeviceProperty prop)
 {
     listProp.Add(prop);
 }
示例#6
0
 public void AddProperty(HHDeviceProperty prop)
 {
     listProp.Add(prop);
 }
示例#7
0
        public HHDeviceGrp(IniDocument ini, int index)
        {
            string name = ini.GetString("设备", (index + 1).ToString());

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            this.DevType = ini.GetInt(name, "设备类型", 0);
            if (this.DevType <= 0)
            {
                return;
            }

            this.Name = name;

            int propNum = ini.GetInt(name, "属性数目", 0);

            if (propNum <= 0)
            {
                return;
            }

            int devNum = ini.GetInt(name, "设备数目", 0);

            if (devNum <= 0)
            {
                return;
            }

            for (int i = 0; i < propNum; i++)
            {
                HHDeviceProperty prop = new HHDeviceProperty(ini, this, i);
                if (prop.IsValid)
                {
                    listProperty.Add(prop);
                    if (prop.Type == "模拟量")
                    {
                        listAnalogProperty.Add(prop);
                    }
                    else if (prop.Type == "曲线")
                    {
                        listCurveProperty.Add(prop);
                    }
                }
            }
            if (this.DevType != 4 && this.DevType != 8)
            {
                if (listProperty.Count <= 0)
                {
                    return;
                }
            }
            if (listAnalogProperty.Count > 0)
            {
                SelectProperty(0, true);
            }
            for (int i = 0; i < devNum; i++)
            {
                HHDevice device = new HHDevice(ini, i, this);

                if (device.IsValid)
                {
                    listDevice.Add(device);
                }
            }

            this.BuildGroup();
            this.Level   = 1;
            this.IsValid = true;
        }
        public HHDeviceProperty Bind(string bindName)
        {
            HHDeviceProperty prop = new HHDeviceProperty();
            prop.DataSrc = this.DataSrc;
            prop.DisplayName = this.DisplayName;
            prop.Name = this.Name;
            prop.Type = this.Type;
            prop.GroupIndex = this.GroupIndex;
            prop.GroupCount = this.GroupCount;

            if (string.IsNullOrEmpty(bindName) == false)
            {
                switch (this.Type)
                {
                    case "模拟量":
                        prop.Analog = AnalogManager.GetInstance().GetAnalog(this.DataSrc, bindName);
                        if (prop.Analog != null)
                        {
                            prop.IsBind = true;
                        }
                        break;
                    case "曲线":
                        prop.Curves = CurveManager.GetInstance().GetCurves(this.DataSrc, bindName);
                        if (prop.Curves != null)
                        {
                            prop.IsBind = true;
                        }
                        break;
                }
            }

            return prop;
        }