private void YXYHMain3_Load(object sender, EventArgs e) { dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = CalTagValue.GetAllTagValues(); dataGridView1.Refresh(); timerLineBind.Interval = ConstYXYH.RefIntvel;; timerLineBind.Enabled = true; lblTemp.Tag = new LabelTag(false, 208, "环境温度"); lblTemp.DoubleClick += new EventHandler(Label_DoubleClick); //双击事件 lblTemp.MouseDown += new MouseEventHandler(control_MouseDown); //鼠标按下事件 //优化出水温度与实际出水温度 chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "HH:mm"; chart1.DataSource = m_dtLineData; //chart1.Series[0].LegendText = "优化出水温度"; chart1.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart1.Series[0].XValueMember = "ValueTime"; chart1.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart1.Series[0].YValueMembers = "F213"; //chart1.Series[1].LegendText = "实际出水温度"; chart1.Series[1].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart1.Series[1].XValueMember = "ValueTime"; chart1.Series[1].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart1.Series[1].YValueMembers = "F152"; //优化功率与实际功率,**********这里实际显示的是“热负荷” chart3.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "HH:mm"; chart3.DataSource = m_dtLineData; //chart1.Series[0].LegendText = "优化热负荷"; chart3.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart3.Series[0].XValueMember = "ValueTime"; chart3.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart3.Series[0].YValueMembers = "F219"; //chart1.Series[1].LegendText = "实际热负荷"; chart3.Series[1].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart3.Series[1].XValueMember = "ValueTime"; chart3.Series[1].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart3.Series[1].YValueMembers = "F202"; //优化抽汽量和实际抽汽量 chart2.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "HH:mm"; chart2.DataSource = m_dtLineData; //chart1.Series[0].LegendText = "优化抽汽量"; chart2.Series[0].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart2.Series[0].XValueMember = "ValueTime"; chart2.Series[0].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart2.Series[0].YValueMembers = "F161"; //chart1.Series[0].LegendText = "优化抽汽量"; chart2.Series[1].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart2.Series[1].XValueMember = "ValueTime"; chart2.Series[1].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; chart2.Series[1].YValueMembers = "F222"; timerLineBind_Tick(null, null); }
/// <summary> /// 设定绑定标签的Text(测点值+测点单位)。 /// </summary> void SetBindingLabelsText() { try { Control control, parent; parent = panel6; LabelTag labelTag = null; foreach (DataRow row in YXYHTagLabelBinding.getAllData().Rows) { try { //由父控件找到本Label control = parent.Controls.Find(row["LabelName"].ToString(), false)[0]; control.Text = CalTagValue.GetTagValueAndUnitByID(row["TagID"].ToString()); control.Refresh(); try { labelTag = (LabelTag)control.Tag; if (labelTag.IsSetToolTipText == false) { toolTip1.SetToolTip(control, row["TagDesc"].ToString()); labelTag.IsSetToolTipText = true; labelTag.TagID = int.Parse(row["TagID"].ToString()); labelTag.TagDesc = row["TagDesc"].ToString(); control.Tag = labelTag; } if (labelTag.TagID == 0) { labelTag.TagID = int.Parse(row["TagID"].ToString()); labelTag.TagDesc = row["TagDesc"].ToString(); control.Tag = labelTag; WriteLog.WriteLogs("id=0"); } } catch { control.Tag = new LabelTag(true, int.Parse(row["TagID"].ToString()), row["TagDesc"].ToString()); toolTip1.SetToolTip(control, row["TagDesc"].ToString()); } } catch (Exception ex) { //WriteLog.WriteLogs(ex.ToString()); } } lblRunOptimizePromptText.Text = RunOptimizePrompt.GetPromptText(); lblRunOptimizePromptText.ForeColor = RunOptimizePrompt.GetPromptTextForeColor(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } }
private void btnResetTotal_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要复位累计值吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { ResetTotalPassword password = new ResetTotalPassword(); password.ShowDialog(); if (password.Password == "fwljz") { CalTagValue.ResetTotal(); } else { MessageBox.Show("密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void timerLineBind_Tick(object sender, EventArgs e) { SetBindingLabelsText(); //SetLabelsForeColor(Color.Red); //SetLabelsForeColor(Color.Lime); lblDQY.Text = "大气压力:" + CalTagValue.GetTagValueAndUnitByID("4"); lblTemp.Text = "环境温度:" + CalTagValue.GetTagValueAndUnitByID("208"); m_dtLineData = CalTagValue.GetAllData(); try { chart1.DataSource = m_dtLineData; chart1.Series[0].LegendText = "优化出水温度:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F213"].ToString()), 2) + "℃"; chart1.Series[1].LegendText = "实际出水温度:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F152"].ToString()), 2) + "℃"; chart1.DataBind(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } try { chart3.DataSource = m_dtLineData; chart3.Series[0].LegendText = "优化热负荷:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F219"].ToString()), 2) + "瓦/平方米"; chart3.Series[1].LegendText = "实际热负荷:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F202"].ToString()), 2) + "瓦/平方米"; chart3.DataBind(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } try { chart2.DataSource = m_dtLineData; chart2.Series[0].LegendText = "实际循环水量:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F161"].ToString()), 2) + "t/h"; chart2.Series[1].LegendText = "优化循环水量:" + Math.Round(double.Parse(m_dtLineData.Rows[m_dtLineData.Rows.Count - 1]["F222"].ToString()), 2) + "t/h"; chart2.DataBind(); } catch (Exception ex) { WriteLog.WriteLogs(ex.ToString()); } viewShowList = CalTagValue.GetAllTagValues().DefaultView; viewShowList.RowFilter = "isShow=1 and TagValue>0"; dataGridView1.DataSource = viewShowList; //dataGridView1.Refresh(); }
private void btnGRSRJTXS_Click(object sender, EventArgs e) { CalTagValue.CalAllTagValue(); }