diff --git a/DataHandler.cs b/DataHandler.cs index cddce3d..070b446 100644 --- a/DataHandler.cs +++ b/DataHandler.cs @@ -58,6 +58,7 @@ namespace friction string m_strCurSpring = ""; string m_strCurTable = ""; + string m_strPrevTable = ""; List m_ColumnsNames = new List(); List m_ActiveColumns = new List(); @@ -144,6 +145,7 @@ namespace friction m_TableList = (from r in m_Data.AsEnumerable() select r[Config.COLUMN_NAME.TABLE]).Distinct().Cast().ToList(); + m_strPrevTable = m_TableList[0]; m_ColumnsNames = (from c in m_Data.Columns.Cast() select c.ColumnName).ToList(); @@ -172,6 +174,7 @@ namespace friction public void SetSelectedMaterial(string strSpring, string strTable) { m_strCurSpring = strSpring; + m_strPrevTable = m_strCurTable; m_strCurTable = strTable; } @@ -282,7 +285,7 @@ namespace friction string strQuery = string.Format("[{0}]='{1}' and [{2}]='{3}'", Config.COLUMN_NAME.SPRING, strSpring, Config.COLUMN_NAME.TABLE, strTable); DataRow[] rows = m_Data.Select(strQuery); - if(rows.Length > 0) + if (rows.Length > 0) { result.m_iCnt = rows.Length; result.m_fAvgRPN = rows.Average(r => (float)r[Config.COLUMN_NAME.RPN]); @@ -299,8 +302,6 @@ namespace friction } - - return result; } #endregion @@ -327,6 +328,11 @@ namespace friction return m_SpringList; } + public string GetPrevTable() + { + return m_strPrevTable; + } + public List GetTableList() { return m_TableList; diff --git a/MainForm.cs b/MainForm.cs index 38a044b..bd9d542 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -197,7 +197,7 @@ namespace friction private void trendGraphToolStripMenuItem_Click(object sender, EventArgs e) { if (m_DataHandler.GetCurTable() == "All") - OnApplyData(this, m_DataHandler.GetCurSpring(), m_DataHandler.GetTableList()[0]); + OnApplyData(this, m_DataHandler.GetCurSpring(), m_DataHandler.GetPrevTable()); OpenPanel(m_TrendGraphPanel); m_TrendGraphPanel.UpdateGraph(); @@ -232,7 +232,7 @@ namespace friction if(m_DataHandler.GetCurTable() != "" && m_DataHandler.GetCurTable() != "All") { if (m_DataHandler.GetCurTable() == "All") - OnApplyData(this, m_DataHandler.GetCurSpring(), m_DataHandler.GetTableList()[0]); + OnApplyData(this, m_DataHandler.GetCurSpring(), m_DataHandler.GetPrevTable()); OpenPanel(m_TrendGraphPanel); m_TrendGraphPanel.CopyChart(PanelTrendGraph.GRAPH_TYPE.HUMIDITY); @@ -323,10 +323,8 @@ namespace friction if (m_DataHandler.GetCurTable() == "All") { string strSpring = m_DataHandler.GetCurSpring(); - List tableList = m_DataHandler.GetTableList(); - - if(tableList.Count > 0) - OnApplyData(this, strSpring, tableList[0]); + string strTable = m_DataHandler.GetPrevTable(); + OnApplyData(this, strSpring, strTable); } OpenPanel(m_TrendGraphPanel); @@ -352,6 +350,12 @@ namespace friction { if (m_TrendGraphPanel != null) m_TrendGraphPanel.UpdateGraph(); + + if (m_RadarGraphPanel != null && m_RadarGraphPanel.Visible == true) + { + OnApplyData(this, strSpring, "All"); + return; + } } if (sender != m_MaterialPanel) @@ -550,11 +554,7 @@ namespace friction public void OnTrendGraphActivated() { if (m_DataHandler.GetCurTable() == "All") - { - List tableList = m_DataHandler.GetTableList(); - if(tableList.Count > 0) - OnApplyData(this, m_DataHandler.GetCurSpring(), tableList[1]); - } + OnApplyData(this, m_DataHandler.GetCurSpring(), m_DataHandler.GetPrevTable()); } } }