1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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;
- }
- }
-
-
- }
- }
- }
|