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; using IntelligentControlForsx.Service.WindturbineInfo; namespace IntelligentControlForsx.MyControls.windturbine { public partial class PointValueDI : UserControl { public PointValueDI() { InitializeComponent(); } private string nameString; public string NameString { set { nameString = value; lblName.Text = value; } get { return nameString; } } private string statusString; public string StatusString { set { statusString = value; int pointValue=0; if (Int32.TryParse(value, out pointValue)) { if (pointValue == 0) lblStatus.BackColor = Color.Lime; else lblStatus.BackColor = Color.Red; } else { lblStatus.BackColor = Color.Red; } } get { return statusString; } } public void BindData(UniformCodeInfo data) { lblName.Text = data.Name; double pointValue = 0; if (data.Name == "" ||String.IsNullOrEmpty(data.PointValue)) { lblStatus.BackColor = Color.FromArgb(10,25,47); } else { if (Double.TryParse(data.PointValue, out pointValue)) { if (pointValue > 0) lblStatus.BackColor = Color.Red; else lblStatus.BackColor = Color.Lime; } else { lblStatus.BackColor = Color.Red; } } } } }