/// <summary> /// Creates the power supply. /// </summary> /// <param name="model"> /// The model. /// </param> /// <returns> /// MPObject. /// </returns> private MPObject CreatePowerSupply(HWPSU model) { var propertys = this.PowerSupplyClass.PropertyCollection; // 获取到class的属性 var obj = new MPObject(MGroup.Instance, this.PowerSupplyClass); // 实例化一个class obj[propertys["UUID"]].Value = model.UUID; obj[propertys["Status"]].Value = model.HealthStateTxt; obj[propertys["Manufacturer"]].Value = model.Manufacturer; obj[propertys["InputMode"]].Value = model.InputMode; obj[propertys["Model"]].Value = model.Model; obj[propertys["PowerRating"]].Value = model.RatePower; obj[propertys["InputPower"]].Value = model.InputPower; obj[propertys["PresentState"]].Value = model.PresentState; obj[this.DisplayNameField].Value = model.Name; return(obj); }
/// <summary> /// Updates the power supply. /// </summary> /// <param name="model">The model.</param> /// <param name="oldObject">The old object.</param> /// <returns>MPObject.</returns> private void UpdatePowerSupply(HWPSU model, MonitoringObject oldObject) { var propertys = this.PowerSupplyClass.PropertyCollection; // 获取到class的属性 // oldObject[propertys["UUID"]].Value = model.UUID; if (model.HealthState != "-3") { oldObject[propertys["Status"]].Value = model.HealthStateTxt; } oldObject[propertys["Manufacturer"]].Value = model.Manufacturer; oldObject[propertys["InputMode"]].Value = model.InputMode; oldObject[propertys["Model"]].Value = model.Model; oldObject[propertys["PowerRating"]].Value = model.RatePower; oldObject[propertys["InputPower"]].Value = model.InputPower; oldObject[propertys["PresentState"]].Value = model.PresentState; oldObject[this.DisplayNameField].Value = model.Name; }
/// <summary> /// Updates the power supply. /// </summary> /// <param name="model"> /// The model. /// </param> /// <returns> /// MPObject. /// </returns> private MonitoringObject UpdatePowerSupply(HWPSU model) { var oldObject = this.GetObject($"UUID = '{model.UUID}'", this.PowerSupplyClass); if (oldObject == null) { return(null); } var propertys = this.PowerSupplyClass.PropertyCollection; // 获取到class的属性 // oldObject[propertys["UUID"]].Value = model.UUID; oldObject[propertys["Status"]].Value = model.HealthState; oldObject[propertys["Manufacturer"]].Value = model.Manufacturer; oldObject[propertys["InputMode"]].Value = model.InputMode; oldObject[propertys["Model"]].Value = model.Model; oldObject[propertys["PowerRating"]].Value = model.RatePower; oldObject[propertys["InputPower"]].Value = model.InputPower; oldObject[propertys["PresentState"]].Value = model.PresentState; oldObject[this.DisplayNameField].Value = model.Name; return(oldObject); }