private void btnOk_Click(object sender, EventArgs e) { dtCheckedTags = m_viewTagValue.Table.GetChanges(); List <DataRow> lstDeleteRows = new List <DataRow>(); if (dtCheckedTags != null) { foreach (DataRow row in dtCheckedTags.Rows) { if (row["CheckRow"].ToString() == "1") { sExcelCells += row["ExcelCell"] + ","; } else { lstDeleteRows.Add(row); } } sExcelCells = sExcelCells.Trim(','); if (lstDeleteRows.Count > 0) { foreach (DataRow row in lstDeleteRows) { dtCheckedTags.Rows.Remove(row); } } } //this.Close(); //else //{ // MessageBox.Show("请选择测点!"); //} //SelectTagDate在生成对象调用时,由ShowDialog()改成了Show(); //因为用ShowDialog()时也会造成窗口无反应的假死现象,所以加了下面的语句。add by hlt 2017-1-18 HistoryLines historyLines = new HistoryLines(UnitNO); if (sExcelCells.Length > 0) { historyLines.SetBeginTime(BeginTime); historyLines.SetEndTime(EndTime); historyLines.SetExcelCells(sExcelCells); historyLines.SetCheckedTags(dtCheckedTags); } else { historyLines.seriesCollection = chartParent.Series; } historyLines.Show(); //this.Hide(); this.Close(); }
private void btnHis_Click(object sender, EventArgs e) { SelectTagDate selectTagDate = new SelectTagDate(); HistoryLines historyLines = new HistoryLines(); selectTagDate.ShowDialog(); if (selectTagDate.bIsClose == false) { if (selectTagDate.sExcelCells.Length > 0) { historyLines.SetBeginTime(selectTagDate.BeginTime); historyLines.SetEndTime(selectTagDate.EndTime); historyLines.SetExcelCells(selectTagDate.sExcelCells); historyLines.SetCheckedTags(selectTagDate.dtCheckedTags); } else { historyLines.seriesCollection = (chart1).Series; } historyLines.ShowDialog(); } }