using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace IntelligentControlForsx.MyControls { public partial class MatrixDevice : UserControl { public MatrixDevice() { InitializeComponent(); } string deviceId; string deviceModel; string stationId; double windSpeed; double power; double status; [Browsable(true), Category("Data")] public string DeviceId { get { return deviceId; } set { deviceId = value; lblDeviceId.Text = value; } } [Browsable(true), Category("Data")] public double WindSpeed { get { return windSpeed; } set { windSpeed = value; lblWindSpeed.Text = Convert.ToDouble(value).ToString("0.00") + "m/s"; } } [Browsable(true), Category("Data")] public double Power { get { return power; } set { power = value; lblPower.Text = Convert.ToDouble(value).ToString("0.00") + "KW"; } } [Browsable(true), Category("Data")] public double Status { get { return status; } set { status = value; this.BackColor = getBackColor(value); } } public string DeviceModel { get { return deviceModel; } set { deviceModel = value; } } public string StationId { get { return stationId; } set { stationId = value; } } private Color getBackColor(double status) { int st = Convert.ToInt32(status); switch(st) { //明细状态 //case 0: //启动状态 //case 7: //低温启动状态 // return Color.FromArgb(0, 51, 102); //case 1: //待机状态 // return Color.FromArgb(51, 153, 51); //case 2: //上电状态 // return Color.FromArgb(153, 0, 102); //case 3: //并网(发电)状态 // return Color.FromArgb(0, 153, 204); //case 4: //正常停机状态 // return Color.FromArgb(153, 153, 51); //case 5: //维护状态 // return Color.FromArgb(255, 102, 0); //case 6: //故障停机状态 // return Color.FromArgb(204, 51, 51); //case 8: //离线状态 // return Color.FromArgb(153, 153, 153); //default: // return Color.Black; //风机六种状态: 限电5》运行1》待机0》维护4》故障2》离线3 case 4: return Color.FromArgb(15, 135, 170); case 2: return Color.FromArgb(15, 141, 106); case 5: return Color.FromArgb(170, 15, 59); case 6: return Color.FromArgb(204, 83, 35); case 7: return Color.FromArgb(153, 153, 153); case 3: return Color.FromArgb(14, 72, 91); case 0: return Color.FromArgb(176, 151, 63); default: return Color.FromArgb(177, 14, 126); } } } }