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.Code; using IntelligentControlForsx.Service.AGC; using IntelligentControlForsx.Service.AGC.Domain; using WisdomClient; using WisdomClient.data; namespace IntelligentControlForsx.MyControls.agc { public partial class WindAGC : UserControl { private bool isUpdateDataOver = true; private bool isBindFormOver = true; private bool isUpdateLineDataOver = true; private bool isBindLineFormOver = true; public WindAGC() { InitializeComponent(); //Thread t = new Thread(LineInitThread); //t.IsBackground = true; //t.Start(); AgcInfoSvc.GetTagName(); AgcPoint agcMHS2 = AgcInfoSvc.pointTagNameList.Where(s => s.StationName == "MHS2").FirstOrDefault(); AgcPoint agcMHS6 = AgcInfoSvc.pointTagNameList.Where(s => s.StationName == "MHS6").FirstOrDefault(); AgcPoint agcNSS2 = AgcInfoSvc.pointTagNameList.Where(s => s.StationName == "NSS2").FirstOrDefault(); AgcPoint agcNSS5 = AgcInfoSvc.pointTagNameList.Where(s => s.StationName == "NSS5").FirstOrDefault(); AgcPoint agcXN6 = AgcInfoSvc.pointTagNameList.Where(s => s.StationName == "XN6").FirstOrDefault(); AgcPoint agcXS5 = AgcInfoSvc.pointTagNameList.Where(s => s.StationName == "XS5").FirstOrDefault(); if (agcMHS2 != null) lineChar_MHS2.BindPointAndTitle(agcMHS2.ActualPowerTagName, agcMHS2.PowerSetTagName, "麻黄山第二风电场"); if (agcMHS6 != null) lineChar_MHS6.BindPointAndTitle(agcMHS6.ActualPowerTagName, agcMHS6.PowerSetTagName, "麻黄山第六风电场"); if (agcNSS2 != null) lineChar_NSS2.BindPointAndTitle(agcNSS2.ActualPowerTagName, agcNSS2.PowerSetTagName, "牛首山第二风电场"); if (agcNSS5 != null) lineChar_NSS5.BindPointAndTitle(agcNSS5.ActualPowerTagName, agcNSS5.PowerSetTagName, "牛首山第五风电场"); if (agcXN6 != null) lineChar_XN6.BindPointAndTitle(agcXN6.ActualPowerTagName, agcXN6.PowerSetTagName, "星能第六风电场"); if (agcXS5 != null) lineChar_XS5.BindPointAndTitle(agcXS5.ActualPowerTagName, agcXS5.PowerSetTagName, "香山第五风电场"); //Thread t = new Thread(InitData); // t.IsBackground = true; // t.Start(); } private void InitData() { isUpdateLineDataOver = false; AgcInfoSvc.GetHistoryLineDataFirst(); isUpdateLineDataOver = true; } public void DeActive() { timer1.Stop(); timer2.Stop(); } public void Active() { this.Show(); timer1.Start(); timer2.Start(); } private void timer1_Tick(object sender, EventArgs e) { if (isBindFormOver)//绑定form { isBindFormOver = false; Thread bindDataThread = new Thread(BindFormInvoke); bindDataThread.Start(); } if (isUpdateDataOver)//更新数据 { Thread ayscThread = new Thread(new ParameterizedThreadStart(AgcInfoSvc.GetLatestAgcDataInfo)); ayscThread.IsBackground = true; ayscThread.Start(true); } } public delegate void UpdateFormInfoDelegate(); public void BindFormInvoke() { UpdateFormInfoDelegate del = new UpdateFormInfoDelegate(FormDataBind); if (this.InvokeRequired) { this.BeginInvoke(del, new object[] { }); } else { FormDataBind(); } } public void FormDataBind() { string path = UserTools.Path; string green_img_path = path + @"\images\green.png"; string red_img_path = path + @"\images\red.png"; #region 麻黄山2 AgcEntity mhs2 = AgcInfoSvc.agcDataList.Where(s => s.StationName == "MHS2").FirstOrDefault(); if (mhs2 != null) { lblPowerSet_MHS2.LableText = mhs2.PowerSetValue.ToString("f2"); lblPowerSet_MHS2.BindData(mhs2.PowerSetValue.ToString("f2"), "MHSDQ.NX_GD_MHSF_DQ_P1_L1_001_AI0296", "麻黄山2有功设定限值"); lblActualPower_MHS2.LableText = mhs2.ActualPowerValue.ToString("f2"); lblActualPower_MHS2.BindData(mhs2.ActualPowerValue.ToString("f2"), "MHSDQ.NX_GD_MHSF_DQ_P1_L1_001_AI0029", "麻黄山2实发有功"); lblAgcOn_MHS2.LableText = (mhs2.AgcUp / 10).ToString("f2"); lblAgcOn_MHS2.BindData((mhs2.AgcUp / 10).ToString("f2"), "MHSDQ.NX_GD_MHSF_DQ_P1_L1_001_AI0294", "麻黄山2AGC可调上限"); lblAgcUp_MHS2.LableText = (mhs2.AgcLower / 100).ToString("f2"); lblAgcUp_MHS2.BindData((mhs2.AgcLower / 100).ToString("f2"), "MHSDQ.NX_GD_MHSF_DQ_P1_L1_001_AI0295", "麻黄山2AGC可调下限"); lblTheoryPower_MHS2.LableText = (mhs2.TheoryPower / 1000).ToString("f2"); lblTheoryPower_MHS2.BindData((mhs2.TheoryPower / 1000).ToString("f2"), "MHSFCJSFW.NX_GD_MHSF_XX_XX_XXX_XXX_CI0192", "麻黄山2理论功率"); lblForecastPower_MHS2.LableText = mhs2.ForecastPower.ToString("f2"); lblForecastPower_MHS2.BindData(mhs2.ForecastPower.ToString("f2"), "MHSFGL.NX_GD_MHSF_YC_P1_L1_001_CDQ001", "麻黄山2预测功率"); if (mhs2.AgcIn) picAgcIn_MHS2.Image = Image.FromFile(red_img_path); else picAgcIn_MHS2.Image = Image.FromFile(green_img_path); if (mhs2.AgcFar) picAgcFar_MHS2.Image = Image.FromFile(red_img_path); else picAgcFar_MHS2.Image = Image.FromFile(green_img_path); if (mhs2.SumLock) picSumLock_MHS2.Image = Image.FromFile(red_img_path); else picSumLock_MHS2.Image = Image.FromFile(green_img_path); if (mhs2.SubLock) picSubLock_MHS2.Image = Image.FromFile(red_img_path); else picSubLock_MHS2.Image = Image.FromFile(green_img_path); } #endregion #region 牛首山2 AgcEntity nss2 = AgcInfoSvc.agcDataList.Where(s => s.StationName == "NSS2").FirstOrDefault(); if (nss2 != null) { lblPowerSet_NSS2.LableText = nss2.PowerSetValue.ToString("f2"); lblPowerSet_NSS2.BindData(nss2.PowerSetValue.ToString("f2"), "NSSDQ.NX_GD_NSSF_DQ_P1_L1_001_AI1019", "牛首山2有功设定限值"); lblActualPower_NSS2.LableText = nss2.ActualPowerValue.ToString("f2"); lblActualPower_NSS2.BindData(nss2.ActualPowerValue.ToString("f2"), "NSSDQ.NX_GD_NSSF_DQ_P1_L1_001_QCYGGL", "牛首山2实发有功"); lblAgcOn_NSS2.LableText = (nss2.AgcUp / 1000).ToString("f2"); lblAgcOn_NSS2.BindData((nss2.AgcUp / 1000).ToString("f2"), "NSSDQ.NX_GD_NSSF_DQ_P1_L1_001_AI1009", "牛首山2AGC可调上限"); lblAgcUp_NSS2.LableText = (nss2.AgcLower / 1000).ToString("f2"); lblAgcUp_NSS2.BindData((nss2.AgcLower / 1000).ToString("f2"), "NSSDQ.NX_GD_NSSF_DQ_P1_L1_001_AI1010", "牛首山2AGC可调下限"); lblTheoryPower_NSS2.LableText = (nss2.TheoryPower / 1000).ToString("f2"); lblTheoryPower_NSS2.BindData((nss2.TheoryPower / 1000).ToString("f2"), "NSSFCJSFW.NX_GD_NSSF_XX_XX_XXX_XXX_CI0192", "牛首山2理论功率"); lblForecastPower_NSS2.LableText = nss2.ForecastPower.ToString("f2"); lblForecastPower_NSS2.BindData(nss2.ForecastPower.ToString("f2"), "NSSFGL.NX_GD_NSSF_YC_P1_L1_001_CDQ001", "牛首山2预测功率"); if (nss2.AgcIn) picAgcIn_NSS2.Image = Image.FromFile(red_img_path); else picAgcIn_NSS2.Image = Image.FromFile(green_img_path); if (nss2.AgcFar) picAgcFar_NSS2.Image = Image.FromFile(red_img_path); else picAgcFar_NSS2.Image = Image.FromFile(green_img_path); if (nss2.SumLock) picSumLock_NSS2.Image = Image.FromFile(red_img_path); else picSumLock_NSS2.Image = Image.FromFile(green_img_path); if (nss2.SubLock) picSubLock_NSS2.Image = Image.FromFile(red_img_path); else picSubLock_NSS2.Image = Image.FromFile(green_img_path); } #endregion #region 麻黄山6 AgcEntity mhs6 = AgcInfoSvc.agcDataList.Where(s => s.StationName == "MHS6").FirstOrDefault(); if (mhs6 != null) { lblPowerSet_MHS6.LableText = mhs6.PowerSetValue.ToString("f2"); lblPowerSet_MHS6.BindData(mhs6.PowerSetValue.ToString("f2"), "QSDQ.NX_GD_QSF_DQ_P1_L1_001_AI1281", "麻黄山6有功设定限值"); lblActualPower_MHS6.LableText = mhs6.ActualPowerValue.ToString("f2"); lblActualPower_MHS6.BindData(mhs6.ActualPowerValue.ToString("f2"), "QSDQ.NX_GD_QSF_DQ_P1_L1_001_AI1282", "麻黄山6实发有功"); lblAgcOn_MHS6.LableText = mhs6.AgcUp.ToString("f2"); lblAgcOn_MHS6.BindData(mhs6.AgcUp.ToString("f2"), "QSDQ.NX_GD_QSF_DQ_P1_L1_001_AI1284", "麻黄山6AGC可调上限"); lblAgcUp_MHS6.LableText = mhs6.AgcLower.ToString("f2"); lblAgcUp_MHS6.BindData(mhs6.AgcLower.ToString("f2"), "QSDQ.NX_GD_QSF_DQ_P1_L1_001_AI1285", "麻黄山6AGC可调下限"); lblTheoryPower_MHS6.LableText = (mhs6.TheoryPower / 1000).ToString("f2"); lblTheoryPower_MHS6.BindData((mhs6.TheoryPower / 1000).ToString("f2"), "QSFCJSFW.NX_GD_QSF_XX_XX_XXX_XXX_CI0192", "麻黄山6理论功率"); lblForecastPower_MHS6.LableText = mhs6.ForecastPower.ToString("f2"); lblForecastPower_MHS6.BindData(mhs6.ForecastPower.ToString("f2"), "QSFGL.NX_GD_QSF_YC_P1_L1_001_CDQ001", "麻黄山6预测功率"); if (mhs6.AgcIn) picAgcIn_MHS6.Image = Image.FromFile(red_img_path); else picAgcIn_MHS6.Image = Image.FromFile(green_img_path); if (mhs6.AgcFar) picAgcFar_MHS6.Image = Image.FromFile(red_img_path); else picAgcFar_MHS6.Image = Image.FromFile(green_img_path); if (mhs6.SumLock) picSumLock_MHS6.Image = Image.FromFile(red_img_path); else picSumLock_MHS6.Image = Image.FromFile(green_img_path); if (mhs6.SubLock) picSubLock_MHS6.Image = Image.FromFile(red_img_path); else picSubLock_MHS6.Image = Image.FromFile(green_img_path); } #endregion #region 星能6 AgcEntity xn6 = AgcInfoSvc.agcDataList.Where(s => s.StationName == "XN6").FirstOrDefault(); if (xn6 != null) { lblPowerSet_XN6.LableText = xn6.PowerSetValue.ToString("f2"); lblPowerSet_XN6.BindData(xn6.PowerSetValue.ToString("f2"), "SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0818", "星能6有功设定限值"); lblActualPower_XN6.LableText = xn6.ActualPowerValue.ToString("f2"); lblActualPower_XN6.BindData(xn6.ActualPowerValue.ToString("f2"), "SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0817", "星能6实发有功"); lblAgcOn_XN6.LableText = (xn6.AgcUp / 10).ToString("f2"); lblAgcOn_XN6.BindData((xn6.AgcUp / 10).ToString("f2"), "SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0819", "星能6AGC可调上限"); lblAgcUp_XN6.LableText = (xn6.AgcLower / 10).ToString("f2"); lblAgcUp_XN6.BindData((xn6.AgcLower / 10).ToString("f2"), "SBQDQ.NX_GD_SBQF_DQ_P1_L1_001_AI0820", "星能6AGC可调下限"); lblTheoryPower_XN6.LableText = (xn6.TheoryPower / 1000).ToString("f2"); lblTheoryPower_XN6.BindData((xn6.TheoryPower / 1000).ToString("f2"), "SBQFCJSFW.NX_GD_SBQF_FJ_P1_XXX_XXX_CI0191", "星能6理论功率"); lblForecastPower_XN6.LableText = xn6.ForecastPower.ToString("f2"); lblForecastPower_XN6.BindData(xn6.ForecastPower.ToString("f2"), "SBQFGL.NX_GD_SBQF_YC_P1_L1_002_CDQ001", "星能6预测功率"); if (xn6.AgcIn) picAgcIn_XN6.Image = Image.FromFile(red_img_path); else picAgcIn_XN6.Image = Image.FromFile(green_img_path); if (xn6.AgcFar) picAgcFar_XN6.Image = Image.FromFile(red_img_path); else picAgcFar_XN6.Image = Image.FromFile(green_img_path); if (xn6.SumLock) picSumLock_XN6.Image = Image.FromFile(red_img_path); else picSumLock_XN6.Image = Image.FromFile(green_img_path); if (xn6.SubLock) picSubLock_XN6.Image = Image.FromFile(red_img_path); else picSubLock_XN6.Image = Image.FromFile(green_img_path); } #endregion #region 牛首山5 AgcEntity nss5 = AgcInfoSvc.agcDataList.Where(s => s.StationName == "NSS5").FirstOrDefault(); if (nss5 != null) { lblPowerSet_NSS5.LableText = nss5.PowerSetValue.ToString("f2"); lblActualPower_NSS5.LableText = nss5.ActualPowerValue.ToString("f2"); lblAgcOn_NSS5.LableText = nss5.AgcUp.ToString("f2"); lblAgcUp_NSS5.LableText = nss5.AgcLower.ToString("f2"); // SBQFCJSFW.NX_GD_SBQF_FJ_P2_XXX_XXX_CI0191/1000+SBQFCJSFW.NX_GD_SBQF_FJ_P3_XXX_XXX_CI0191/1000+SBQFCJSFW.NX_GD_SBQF_FJ_P4_XXX_XXX_CI0191/1000 string[] arr = new string[] { "SBQFCJSFW.NX_GD_SBQF_FJ_P2_XXX_XXX_CI0191", "SBQFCJSFW.NX_GD_SBQF_FJ_P3_XXX_XXX_CI0191", "SBQFCJSFW.NX_GD_SBQF_FJ_P4_XXX_XXX_CI0191" }; Dictionary dic = RestfulClient.findLatestByTagNames(arr); double pointValue = 0.0; foreach (var tsData in dic) { double pv = Convert.ToDouble(tsData.Value.getValue()); pointValue = pointValue + pv; } lblTheoryPower_NSS5.LableText = (pointValue / 1000).ToString("f2"); lblForecastPower_NSS5.LableText = nss5.ForecastPower.ToString("f2"); if (nss5.AgcIn) picAgcIn_NSS5.Image = Image.FromFile(red_img_path); else picAgcIn_NSS5.Image = Image.FromFile(green_img_path); if (nss5.AgcFar) picAgcFar_NSS5.Image = Image.FromFile(red_img_path); else picAgcFar_NSS5.Image = Image.FromFile(green_img_path); if (nss5.SumLock) picSumLock_NSS5.Image = Image.FromFile(red_img_path); else picSumLock_NSS5.Image = Image.FromFile(green_img_path); if (nss5.SubLock) picSubLock_NSS5.Image = Image.FromFile(red_img_path); else picSubLock_NSS5.Image = Image.FromFile(green_img_path); } #endregion #region 香山5 AgcEntity xs5 = AgcInfoSvc.agcDataList.Where(s => s.StationName == "XS5").FirstOrDefault(); if (xs5 != null) { lblPowerSet_XS5.LableText = xs5.PowerSetValue.ToString("f2"); lblPowerSet_XS5.BindData(xs5.PowerSetValue.ToString("f2"), "XSDQ.NX_GD_XSF_DQ_P1_L1_001_AI0411", "香山5有功设定限值"); lblActualPower_XS5.LableText = xs5.ActualPowerValue.ToString("f2"); lblActualPower_XS5.BindData(xs5.ActualPowerValue.ToString("f2"), "XSDQ.NX_GD_XSF_DQ_P1_L1_001_AI0415", "香山5实发有功"); lblAgcOn_XS5.LableText = xs5.AgcUp.ToString("f2"); lblAgcOn_XS5.BindData(xs5.AgcUp.ToString("f2"), "XSDQ.NX_GD_XSF_DQ_P1_L1_001_AI0412", "香山5AGC可调上限"); lblAgcUp_XS5.LableText = xs5.AgcLower.ToString("f2"); lblAgcUp_XS5.BindData(xs5.AgcLower.ToString("f2"), "XSDQ.NX_GD_XSF_DQ_P1_L1_001_AI0413", "香山5AGC可调下限"); lblTheoryPower_XS5.LableText = (xs5.TheoryPower / 1000).ToString("f2"); lblTheoryPower_XS5.BindData((xs5.TheoryPower / 1000).ToString("f2"), "XSFCJSFW.NX_GD_XSF_XX_XX_XXX_XXX_CI0192", "香山5理论功率"); lblForecastPower_XS5.LableText = xs5.ForecastPower.ToString("f2"); lblForecastPower_XS5.BindData(xs5.ForecastPower.ToString("f2"), "XSFGL.NX_GD_XSF_YC_P1_L1_001_CDQ001", "香山5预测功率"); if (xs5.AgcIn) picAgcIn_XS5.Image = Image.FromFile(red_img_path); else picAgcIn_XS5.Image = Image.FromFile(green_img_path); if (xs5.AgcFar) picAgcFar_XS5.Image = Image.FromFile(red_img_path); else picAgcFar_XS5.Image = Image.FromFile(green_img_path); if (xs5.SumLock) picSumLock_XS5.Image = Image.FromFile(red_img_path); else picSumLock_XS5.Image = Image.FromFile(green_img_path); if (xs5.SubLock) picSubLock_XS5.Image = Image.FromFile(red_img_path); else picSubLock_XS5.Image = Image.FromFile(green_img_path); } #endregion isBindFormOver = true; } private void timer2_Tick(object sender, EventArgs e) { if (isBindLineFormOver)//绑定form { isBindLineFormOver = false; Thread bindDataThread = new Thread(BindFormLineInvoke); bindDataThread.Start(); } if (isUpdateLineDataOver)//更新数据 { isUpdateLineDataOver = false; Thread ayscThread = new Thread(new ParameterizedThreadStart(UpdateHistoryLineData)); ayscThread.IsBackground = true; ayscThread.Start(true); } } private void UpdateHistoryLineData(Object isWind) { AgcInfoSvc.GetHistoryLineData(isWind); isUpdateLineDataOver = true; //AgcInfoSvc.UpdateHistoryLineData(isWind); //isUpdateLineDataOver = true; } public void BindFormLineInvoke() { UpdateFormInfoDelegate del = new UpdateFormInfoDelegate(FormLineDataBind); if (this.InvokeRequired) { this.BeginInvoke(del, new object[] { }); } else { FormLineDataBind(); } } public void FormLineDataBind() { PowerActual powerActual_mhs2 = AgcInfoSvc.powerActualList.Where(s => s.StationName == "MHS2").FirstOrDefault(); PowerSet powerSet_mhs2 = AgcInfoSvc.powerSetList.Where(s => s.StationName == "MHS2").FirstOrDefault(); if (powerActual_mhs2 != null && powerSet_mhs2 != null) { //IList pstList=new List(); //for (int i = 0; i < powerSet_mhs2.TsDataList.Count; i++) //{ // TsData tsData=new TsData(); // tsData.ts = powerSet_mhs2.TsDataList[i].ts; // double tValue = powerSet_mhs2.TsDataList[i].doubleValue.HasValue // ? powerSet_mhs2.TsDataList[i].doubleValue.Value/10 // : 0.0; // tsData.doubleValue = tValue; // pstList.Add(tsData); //} lineChar_MHS2.DataBind(powerActual_mhs2.TsDataList, powerSet_mhs2.TsDataList); } PowerActual powerActual_nss2 = AgcInfoSvc.powerActualList.Where(s => s.StationName == "NSS2").FirstOrDefault(); PowerSet powerSet_nss2 = AgcInfoSvc.powerSetList.Where(s => s.StationName == "NSS2").FirstOrDefault(); if (powerActual_nss2 != null && powerSet_nss2 != null) lineChar_NSS2.DataBind(powerActual_nss2.TsDataList, powerSet_nss2.TsDataList); PowerActual powerActual_mhs6 = AgcInfoSvc.powerActualList.Where(s => s.StationName == "MHS6").FirstOrDefault(); PowerSet powerSet_mhs6 = AgcInfoSvc.powerSetList.Where(s => s.StationName == "MHS6").FirstOrDefault(); if (powerActual_mhs6 != null && powerSet_mhs6 != null) { IList pstList = new List(); IList actlList = new List(); for (int i = 0; i < powerSet_mhs6.TsDataList.Count; i++) { TsData tsData = new TsData(); tsData.ts = powerSet_mhs6.TsDataList[i].ts; double tValue = powerSet_mhs6.TsDataList[i].doubleValue.HasValue ? powerSet_mhs6.TsDataList[i].doubleValue.Value : 0.0; tsData.doubleValue = tValue; pstList.Add(tsData); } for (int i = 0; i < powerActual_mhs6.TsDataList.Count; i++) { TsData tsData = new TsData(); tsData.ts = powerActual_mhs6.TsDataList[i].ts; double tValue = powerActual_mhs6.TsDataList[i].doubleValue.HasValue ? powerActual_mhs6.TsDataList[i].doubleValue.Value : 0.0; tsData.doubleValue = tValue; actlList.Add(tsData); } lineChar_MHS6.DataBind(actlList, pstList); } PowerActual powerActual_xn6 = AgcInfoSvc.powerActualList.Where(s => s.StationName == "XN6").FirstOrDefault(); PowerSet powerSet_xn6 = AgcInfoSvc.powerSetList.Where(s => s.StationName == "XN6").FirstOrDefault(); if (powerActual_xn6 != null && powerSet_xn6 != null) { IList pstList = new List(); IList actlList = new List(); for (int i = 0; i < powerSet_xn6.TsDataList.Count; i++) { TsData tsData = new TsData(); tsData.ts = powerSet_xn6.TsDataList[i].ts; double tValue = powerSet_xn6.TsDataList[i].doubleValue.HasValue ? powerSet_xn6.TsDataList[i].doubleValue.Value : 0.0; tsData.doubleValue = tValue; pstList.Add(tsData); } for (int i = 0; i < powerActual_xn6.TsDataList.Count; i++) { TsData tsData = new TsData(); tsData.ts = powerActual_xn6.TsDataList[i].ts; double tValue = powerActual_xn6.TsDataList[i].doubleValue.HasValue ? powerActual_xn6.TsDataList[i].doubleValue.Value : 0.0; tsData.doubleValue = tValue; actlList.Add(tsData); } lineChar_XN6.DataBind(actlList, pstList); } PowerActual powerActual_nss5 = AgcInfoSvc.powerActualList.Where(s => s.StationName == "NSS5").FirstOrDefault(); PowerSet powerSet_nss5 = AgcInfoSvc.powerSetList.Where(s => s.StationName == "NSS5").FirstOrDefault(); if (powerActual_nss5 != null && powerSet_nss5 != null) { IList pstList = new List(); IList actlList = new List(); for (int i = 0; i < powerSet_nss5.TsDataList.Count; i++) { TsData tsData = new TsData(); tsData.ts = powerSet_nss5.TsDataList[i].ts; double tValue = powerSet_nss5.TsDataList[i].doubleValue.HasValue ? powerSet_nss5.TsDataList[i].doubleValue.Value : 0.0; tsData.doubleValue = tValue; pstList.Add(tsData); } for (int i = 0; i < powerActual_nss5.TsDataList.Count; i++) { TsData tsData = new TsData(); tsData.ts = powerActual_nss5.TsDataList[i].ts; double tValue = powerActual_nss5.TsDataList[i].doubleValue.HasValue ? powerActual_nss5.TsDataList[i].doubleValue.Value : 0.0; tsData.doubleValue = tValue; actlList.Add(tsData); } lineChar_NSS5.DataBind(actlList, pstList); } PowerActual powerActual_xs5 = AgcInfoSvc.powerActualList.Where(s => s.StationName == "XS5").FirstOrDefault(); PowerSet powerSet_xs5 = AgcInfoSvc.powerSetList.Where(s => s.StationName == "XS5").FirstOrDefault(); if (powerSet_xs5 != null && powerActual_xs5 != null) lineChar_XS5.DataBind(powerActual_xs5.TsDataList, powerSet_xs5.TsDataList); isBindLineFormOver = true; } private void WindAGC_Load(object sender, EventArgs e) { Thread ayscThread1 = new Thread(new ParameterizedThreadStart(AgcInfoSvc.GetLatestAgcDataInfo)); ayscThread1.IsBackground = true; ayscThread1.Start(true); Thread t = new Thread(FirstFormLoad); t.IsBackground = true; t.Start(); } private void FirstFormLoad() { AgcInfoSvc.GetHistoryLineData(true); BindFormLineInvoke(); } private void LineInitThread() { isUpdateLineDataOver = false; AgcInfoSvc.GetHistoryLineData(true); isUpdateLineDataOver = true; isBindLineFormOver = false; BindFormLineInvoke(); isBindLineFormOver = true; } } }