123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using IntelligentControlForsx.Service.WindturbineInfo;
- using log4net;
- using WisdomClient;
- using WisdomClient.data;
- namespace IntelligentControlForsx.MyControls.windturbine
- {
- /// <summary>
- /// 发电机
- /// </summary>
- public partial class AlternatorInfo : BaseControl
- {
- private static ILog logger = LogManager.GetLogger("AppInfoLog");
- public AlternatorInfo()
- {
- InitializeComponent();
- }
- public override void Active(string stationId, string windturbineId, string modelId)
- {
- STATIONID = stationId;
- WINDTURBINEID = windturbineId;
- timer1.Enabled = true;
- Refresh();
- }
- public override void DeActive()
- {
- timer1.Enabled = false;
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- if (isRefreshOver)
- {
- isRefreshOver = false;
- //刷新数据线程
- Thread refreshThread = new Thread(Refresh);
- refreshThread.Start();
- isRefreshOver = true;
- }
- //绑定数据线程
- Thread bindDataThread = new Thread(BindData);
- bindDataThread.Start();
- }
- //private delegate void UpdateFormInfoDelegate();
- //private void BindData()
- //{
- // UpdateFormInfoDelegate del = new UpdateFormInfoDelegate(PointInfoBind);
- // if (this.InvokeRequired)
- // {
- // this.BeginInvoke(del, new object[] { });
- // }
- // else
- // {
- // PointInfoBind();
- // }
- //}
- //private void PointInfoBind()
- //{
- // IList<UniformCodeInfo> list = WindturbineInfoSvc.Instance.GetPointData();
- // foreach (var data in list)
- // {
- // string controlName = "P" + data.PartIndex.Replace("part", "") + "_PointValue" + data.Index;
- // try
- // {
- // object obj = this.GetType().GetField(controlName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance
- // | System.Reflection.BindingFlags.IgnoreCase).GetValue(this);
- // if (obj is PointValueAI)
- // {
- // PointValueAI ai = (PointValueAI)obj;
- // ai.BindData(data);
- // }
- // else if (obj is PointValueDI)
- // {
- // PointValueDI di = (PointValueDI)obj;
- // di.BindData(data);
- // }
- // }
- // catch (Exception ex)
- // {
- // logger.Error("绑定数据时,找不到控件:" + ex);
- // }
- // }
- //}
- //private void Refresh()
- //{
- // WindturbineInfoSvc infoSvc = WindturbineInfoSvc.Instance;
- // infoSvc.RefreshPointValue(STATIONID, WINDTURBINEID, MODELID, this.GetType().Name);
- //}
-
- }
- }
|