123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- 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);
- }
- }
- }
- }
|