- Congig 추가

- friction.exe -> squeak.exe
- 색상 변경
- analysis 기준 변경
This commit is contained in:
2017-06-21 02:41:29 +09:00
parent 9bf6a38f6d
commit 44841453e9
7 changed files with 271 additions and 77 deletions

View File

@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -26,7 +27,17 @@ namespace friction
Theme.Apply(this);
Theme.Apply(dgvAnalysis);
lbInfo25.ForeColor = Theme.Backcolor;
typeof(DataGridView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, dgvAnalysis, new object[] { true });
lbInfo11.BackColor = Theme.Green;
lbInfo12.BackColor = Theme.Yellow;
lbInfo13.BackColor = Theme.Red;
lbInfo21.BackColor = Theme.Green;
lbInfo22.BackColor = Theme.Yellow;
lbInfo23.BackColor = Theme.Red;
lbInfo24.BackColor = Theme.Gray;
}
public void Reset()
@@ -34,6 +45,27 @@ namespace friction
m_CurSpring = "";
}
private Color GetDependancyColor(float fValue, int iCnt)
{
Config.ANALYSIS.DEPENDANCY Type = Config.ANALYSIS.GetDependancy(fValue, iCnt);
switch(Type)
{
case Config.ANALYSIS.DEPENDANCY.NO:
return Theme.Green;
case Config.ANALYSIS.DEPENDANCY.POTENTIAL:
return Theme.Yellow;
case Config.ANALYSIS.DEPENDANCY.HIGH:
return Theme.Red;
case Config.ANALYSIS.DEPENDANCY.NOT_ENNOUGH_DATA:
return Theme.Gray;
}
return Theme.White;
}
public void UpdateData(DataHandler data)
{
string strSpring = data.GetCurSpring();
@@ -44,53 +76,57 @@ namespace friction
dgvAnalysis.Columns.Clear();
dgvAnalysis.Rows.Clear();
dgvAnalysis.DefaultCellStyle.Format = "N2";
dgvAnalysis.Columns.Add("chTable", "Table");
dgvAnalysis.Columns.Add("chNoTest", "No. of Tests");
dgvAnalysis.Columns.Add("chAvg", "Average RPN");
dgvAnalysis.Columns.Add("chSTD", "stdev RPN");
dgvAnalysis.Columns.Add("chSTD", "Standard Deviation");
dgvAnalysis.Columns.Add("chForce", "Normal Force");
dgvAnalysis.Columns.Add("chTemp", "Temperature");
dgvAnalysis.Columns.Add("chHumi", "Rel. Humidity");
dgvAnalysis.Columns.Add("chVel", "Velocity");
foreach(string strTable in data.GetTableList())
foreach (string strTable in data.GetTableList())
{
DataHandler.CalcResult result = data.GetCalc(strSpring, strTable);
int iIdx = dgvAnalysis.Rows.Add(strTable, result.m_iCnt, result.m_fAvgRPN, result.m_fStdRPN, result.m_fDiffByForce, result.m_fDiffByTemp, result.m_fDiffByHumid, result.m_fDiffByVel);
if(result.m_iCnt <= 5)
Config.ANALYSIS.RISK RiskType = Config.ANALYSIS.GetRisk(result.m_fAvgRPN);
Config.ANALYSIS.DEPENDANCY DependancyType = Config.ANALYSIS.GetDependancy(result.m_fStdRPN, result.m_iCnt);
if(DependancyType == Config.ANALYSIS.DEPENDANCY.NOT_ENNOUGH_DATA)
{
for (int i = 2; i <= 7; i++)
{
dgvAnalysis.Rows[iIdx].Cells[i].Style.BackColor = Theme.White;
dgvAnalysis.Rows[iIdx].Cells[i].Style.BackColor = Theme.Gray;
dgvAnalysis.Rows[iIdx].Cells[i].Style.ForeColor = Theme.Backcolor;
}
}
else if(result.m_iCnt <= 10)
{
for (int i = 2; i <= 7; i++)
{
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = Theme.Gray;
dgvAnalysis.Rows[iIdx].Cells[2].Style.ForeColor = Theme.Backcolor;
}
}
else
{
if (result.m_fAvgRPN <= 3)
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = Theme.Green;
else if (result.m_fAvgRPN <= 5)
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = Theme.Yellow;
else
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = Theme.Red;
switch (RiskType)
{
case Config.ANALYSIS.RISK.NO:
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = Theme.Green;
break;
dgvAnalysis.Rows[iIdx].Cells[3].Style.BackColor = (result.m_fStdRPN <= 1.5) ? Theme.Green : Theme.Red;
dgvAnalysis.Rows[iIdx].Cells[4].Style.BackColor = (result.m_fDiffByForce <= 1.5) ? Theme.Green : Theme.Red;
dgvAnalysis.Rows[iIdx].Cells[5].Style.BackColor = (result.m_fDiffByTemp <= 1.5) ? Theme.Green : Theme.Red;
dgvAnalysis.Rows[iIdx].Cells[6].Style.BackColor = (result.m_fDiffByHumid <= 1.5) ? Theme.Green : Theme.Red;
dgvAnalysis.Rows[iIdx].Cells[7].Style.BackColor = (result.m_fDiffByVel <= 1.5) ? Theme.Green : Theme.Red;
case Config.ANALYSIS.RISK.POTENTIAL:
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = Theme.Yellow;
break;
case Config.ANALYSIS.RISK.HIGH:
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = Theme.Red;
break;
}
dgvAnalysis.Rows[iIdx].Cells[3].Style.BackColor = GetDependancyColor(result.m_fStdRPN, result.m_iCnt);
dgvAnalysis.Rows[iIdx].Cells[4].Style.BackColor = GetDependancyColor(result.m_fDiffByForce, result.m_iCnt);
dgvAnalysis.Rows[iIdx].Cells[5].Style.BackColor = GetDependancyColor(result.m_fDiffByTemp, result.m_iCnt);
dgvAnalysis.Rows[iIdx].Cells[6].Style.BackColor = GetDependancyColor(result.m_fDiffByHumid, result.m_iCnt);
dgvAnalysis.Rows[iIdx].Cells[7].Style.BackColor = GetDependancyColor(result.m_fDiffByVel, result.m_iCnt);
}
}