- 툴바 아이콘 지정

- 메뉴바 테마 적용
- 메뉴바 기능 연결
- 파일 로딩 후 기능들 연결
This commit is contained in:
2017-06-20 03:52:08 +09:00
parent 7be92b315a
commit 760ce6abc2
23 changed files with 6673 additions and 315 deletions

View File

@@ -158,6 +158,8 @@ namespace friction
m_ActiveColumns.Add(m_ColumnsNames[i]);
}
}
SetSelectedMaterial("", "");
}
public void SetSelectedMaterial(string strSpring, string strTable)

43
MainForm.Designer.cs generated
View File

@@ -41,7 +41,6 @@
this.toolStripButtonTrendGraph = new System.Windows.Forms.ToolStripButton();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openDBToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -55,6 +54,7 @@
this.trendGraphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
this.toolStripMain.SuspendLayout();
this.statusStrip.SuspendLayout();
this.menuStrip.SuspendLayout();
@@ -177,17 +177,9 @@
this.toolStripStatusLabel.Size = new System.Drawing.Size(122, 17);
this.toolStripStatusLabel.Text = "Please open database";
//
// dockPanel
//
this.dockPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.dockPanel.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.DockingWindow;
this.dockPanel.Location = new System.Drawing.Point(0, 49);
this.dockPanel.Name = "dockPanel";
this.dockPanel.Size = new System.Drawing.Size(947, 574);
this.dockPanel.TabIndex = 2;
//
// menuStrip
//
this.menuStrip.BackColor = System.Drawing.SystemColors.Control;
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.tableToolStripMenuItem,
@@ -212,20 +204,22 @@
// openDBToolStripMenuItem
//
this.openDBToolStripMenuItem.Name = "openDBToolStripMenuItem";
this.openDBToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.openDBToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openDBToolStripMenuItem.Text = "Open DB";
this.openDBToolStripMenuItem.Click += new System.EventHandler(this.openDBToolStripMenuItem_Click);
//
// recentToolStripMenuItem
//
this.recentToolStripMenuItem.Name = "recentToolStripMenuItem";
this.recentToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.recentToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.recentToolStripMenuItem.Text = "Recent";
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// tableToolStripMenuItem
//
@@ -239,14 +233,16 @@
// resultTableToolStripMenuItem
//
this.resultTableToolStripMenuItem.Name = "resultTableToolStripMenuItem";
this.resultTableToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.resultTableToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.resultTableToolStripMenuItem.Text = "Result Table";
this.resultTableToolStripMenuItem.Click += new System.EventHandler(this.resultTableToolStripMenuItem_Click);
//
// analysisTableToolStripMenuItem
//
this.analysisTableToolStripMenuItem.Name = "analysisTableToolStripMenuItem";
this.analysisTableToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.analysisTableToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.analysisTableToolStripMenuItem.Text = "Analysis Table";
this.analysisTableToolStripMenuItem.Click += new System.EventHandler(this.analysisTableToolStripMenuItem_Click);
//
// graphToolStripMenuItem
//
@@ -260,14 +256,17 @@
// radarGraphToolStripMenuItem
//
this.radarGraphToolStripMenuItem.Name = "radarGraphToolStripMenuItem";
this.radarGraphToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.radarGraphToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.radarGraphToolStripMenuItem.Text = "Radar Graph";
this.radarGraphToolStripMenuItem.Click += new System.EventHandler(this.radarGraphToolStripMenuItem_Click);
//
// trendGraphToolStripMenuItem
//
this.trendGraphToolStripMenuItem.Enabled = false;
this.trendGraphToolStripMenuItem.Name = "trendGraphToolStripMenuItem";
this.trendGraphToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.trendGraphToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.trendGraphToolStripMenuItem.Text = "Trend Graph";
this.trendGraphToolStripMenuItem.Click += new System.EventHandler(this.trendGraphToolStripMenuItem_Click);
//
// reportToolStripMenuItem
//
@@ -283,6 +282,15 @@
this.allToolStripMenuItem.Size = new System.Drawing.Size(88, 22);
this.allToolStripMenuItem.Text = "All";
//
// dockPanel
//
this.dockPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.dockPanel.DocumentStyle = WeifenLuo.WinFormsUI.Docking.DocumentStyle.DockingWindow;
this.dockPanel.Location = new System.Drawing.Point(0, 49);
this.dockPanel.Name = "dockPanel";
this.dockPanel.Size = new System.Drawing.Size(947, 574);
this.dockPanel.TabIndex = 2;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -292,6 +300,7 @@
this.Controls.Add(this.statusStrip);
this.Controls.Add(this.toolStripMain);
this.Controls.Add(this.menuStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip;
this.Name = "MainForm";
this.Text = "Material Stick-Slip Analysis";

View File

@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -31,6 +32,11 @@ namespace friction
m_AnalysisPanel = new PanelAnalysis(this);
m_RadarGraphPanel = new PanelRadarGraph(this);
m_TrendGraphPanel = new PanelTrendGraph(this, m_DataHandler);
Theme.Apply(this);
Theme.Apply(menuStrip);
Theme.Apply(toolStripMain);
Theme.Apply(statusStrip);
}
private void OpenPanel(DockContent panel)
@@ -49,6 +55,39 @@ namespace friction
}
}
#region Events from menu
private void openDBToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void resultTableToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenPanel(m_ResultPanel);
}
private void analysisTableToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenPanel(m_AnalysisPanel);
}
private void radarGraphToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenPanel(m_RadarGraphPanel);
}
private void trendGraphToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenPanel(m_TrendGraphPanel);
m_TrendGraphPanel.UpdateGraph();
}
#endregion
#region Events from toolbox
private void toolStripButtonOpen_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
@@ -59,12 +98,19 @@ namespace friction
m_DBFileName = ofd.FileName;
m_DataHandler.LoadData(m_DBFileName);
toolStripButtonTrendGraph.Enabled = false;
toolStripButtonRadarGraph.Enabled = true;
m_MaterialPanel.UpdateData(m_DataHandler);
OpenPanel(m_MaterialPanel);
m_ResultPanel.UpdateData(m_DataHandler);
OpenPanel(m_ResultPanel);
m_AnalysisPanel.Reset();
m_AnalysisPanel.UpdateData(m_DataHandler);
OpenPanel(m_AnalysisPanel);
toolStripStatusLabel.Text = m_DBFileName;
}
}
@@ -92,21 +138,31 @@ namespace friction
private void toolStripButtonTrendGraph_Click(object sender, EventArgs e)
{
OpenPanel(m_TrendGraphPanel);
m_TrendGraphPanel.UpdateGraph();
}
#endregion
#region Events from panels
public void OnApplyData(string strSpring, string strTable)
{
if (strTable == "All")
{
trendGraphToolStripMenuItem.Enabled = toolStripButtonTrendGraph.Enabled = false;
radarGraphToolStripMenuItem.Enabled = toolStripButtonRadarGraph.Enabled = true;
}
else
{
trendGraphToolStripMenuItem.Enabled = toolStripButtonTrendGraph.Enabled = true;
radarGraphToolStripMenuItem.Enabled = toolStripButtonRadarGraph.Enabled = false;
if (m_TrendGraphPanel.Visible == true)
m_TrendGraphPanel.UpdateGraph();
}
m_DataHandler.SetSelectedMaterial(strSpring, strTable);
m_AnalysisPanel.UpdateData(m_DataHandler);
OpenPanel(m_AnalysisPanel);
}
public void OnColumnChecked(string strColumn, bool bChecked)
{
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -32,14 +32,14 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.lbInfo11 = new System.Windows.Forms.Label();
this.lbInfo12 = new System.Windows.Forms.Label();
this.lbInfo13 = new System.Windows.Forms.Label();
this.lbInfo21 = new System.Windows.Forms.Label();
this.lbInfo22 = new System.Windows.Forms.Label();
this.lbInfo23 = new System.Windows.Forms.Label();
this.lbInfo24 = new System.Windows.Forms.Label();
this.lbInfo25 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dgvAnalysis)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
@@ -71,14 +71,14 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label4, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.label5, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.label6, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.label7, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.label8, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.label9, 3, 3);
this.tableLayoutPanel1.Controls.Add(this.label10, 3, 4);
this.tableLayoutPanel1.Controls.Add(this.lbInfo11, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.lbInfo12, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.lbInfo13, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.lbInfo21, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.lbInfo22, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.lbInfo23, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.lbInfo24, 3, 3);
this.tableLayoutPanel1.Controls.Add(this.lbInfo25, 3, 4);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 561);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 5;
@@ -113,93 +113,93 @@
this.label2.Text = "For large standard deviations indicating a possible change of Stick-Slip Risk Cla" +
"ss (marked red)";
//
// label3
// lbInfo11
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.YellowGreen;
this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
this.label3.Location = new System.Drawing.Point(174, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(250, 12);
this.label3.TabIndex = 2;
this.label3.Text = "No Stick-Slip Risk";
this.lbInfo11.AutoSize = true;
this.lbInfo11.BackColor = System.Drawing.Color.YellowGreen;
this.lbInfo11.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo11.Location = new System.Drawing.Point(174, 0);
this.lbInfo11.Name = "lbInfo11";
this.lbInfo11.Size = new System.Drawing.Size(250, 12);
this.lbInfo11.TabIndex = 2;
this.lbInfo11.Text = "No Stick-Slip Risk";
//
// label4
// lbInfo12
//
this.label4.AutoSize = true;
this.label4.BackColor = System.Drawing.Color.Gold;
this.label4.Dock = System.Windows.Forms.DockStyle.Fill;
this.label4.Location = new System.Drawing.Point(174, 12);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(250, 12);
this.label4.TabIndex = 2;
this.label4.Text = "Potential S-Slip Risk";
this.lbInfo12.AutoSize = true;
this.lbInfo12.BackColor = System.Drawing.Color.Gold;
this.lbInfo12.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo12.Location = new System.Drawing.Point(174, 12);
this.lbInfo12.Name = "lbInfo12";
this.lbInfo12.Size = new System.Drawing.Size(250, 12);
this.lbInfo12.TabIndex = 2;
this.lbInfo12.Text = "Potential S-Slip Risk";
//
// label5
// lbInfo13
//
this.label5.AutoSize = true;
this.label5.BackColor = System.Drawing.Color.DarkOrange;
this.label5.Dock = System.Windows.Forms.DockStyle.Fill;
this.label5.Location = new System.Drawing.Point(174, 24);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(250, 12);
this.label5.TabIndex = 2;
this.label5.Text = "High Stick-Slip Risk";
this.lbInfo13.AutoSize = true;
this.lbInfo13.BackColor = System.Drawing.Color.DarkOrange;
this.lbInfo13.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo13.Location = new System.Drawing.Point(174, 24);
this.lbInfo13.Name = "lbInfo13";
this.lbInfo13.Size = new System.Drawing.Size(250, 12);
this.lbInfo13.TabIndex = 2;
this.lbInfo13.Text = "High Stick-Slip Risk";
//
// label6
// lbInfo21
//
this.label6.AutoSize = true;
this.label6.BackColor = System.Drawing.Color.YellowGreen;
this.label6.Dock = System.Windows.Forms.DockStyle.Fill;
this.label6.Location = new System.Drawing.Point(601, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(252, 12);
this.label6.TabIndex = 2;
this.label6.Text = "No Dependancy";
this.lbInfo21.AutoSize = true;
this.lbInfo21.BackColor = System.Drawing.Color.YellowGreen;
this.lbInfo21.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo21.Location = new System.Drawing.Point(601, 0);
this.lbInfo21.Name = "lbInfo21";
this.lbInfo21.Size = new System.Drawing.Size(252, 12);
this.lbInfo21.TabIndex = 2;
this.lbInfo21.Text = "No Dependancy";
//
// label7
// lbInfo22
//
this.label7.AutoSize = true;
this.label7.BackColor = System.Drawing.Color.Gold;
this.label7.Dock = System.Windows.Forms.DockStyle.Fill;
this.label7.Location = new System.Drawing.Point(601, 12);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(252, 12);
this.label7.TabIndex = 2;
this.label7.Text = "Potential Dependancy";
this.lbInfo22.AutoSize = true;
this.lbInfo22.BackColor = System.Drawing.Color.Gold;
this.lbInfo22.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo22.Location = new System.Drawing.Point(601, 12);
this.lbInfo22.Name = "lbInfo22";
this.lbInfo22.Size = new System.Drawing.Size(252, 12);
this.lbInfo22.TabIndex = 2;
this.lbInfo22.Text = "Potential Dependancy";
//
// label8
// lbInfo23
//
this.label8.AutoSize = true;
this.label8.BackColor = System.Drawing.Color.DarkOrange;
this.label8.Dock = System.Windows.Forms.DockStyle.Fill;
this.label8.Location = new System.Drawing.Point(601, 24);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(252, 12);
this.label8.TabIndex = 2;
this.label8.Text = "Obvious Dependancy";
this.lbInfo23.AutoSize = true;
this.lbInfo23.BackColor = System.Drawing.Color.DarkOrange;
this.lbInfo23.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo23.Location = new System.Drawing.Point(601, 24);
this.lbInfo23.Name = "lbInfo23";
this.lbInfo23.Size = new System.Drawing.Size(252, 12);
this.lbInfo23.TabIndex = 2;
this.lbInfo23.Text = "Obvious Dependancy";
//
// label9
// lbInfo24
//
this.label9.AutoSize = true;
this.label9.BackColor = System.Drawing.Color.DarkGray;
this.label9.Dock = System.Windows.Forms.DockStyle.Fill;
this.label9.Location = new System.Drawing.Point(601, 36);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(252, 12);
this.label9.TabIndex = 2;
this.label9.Text = "Not Enough Data";
this.lbInfo24.AutoSize = true;
this.lbInfo24.BackColor = System.Drawing.Color.DarkGray;
this.lbInfo24.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo24.Location = new System.Drawing.Point(601, 36);
this.lbInfo24.Name = "lbInfo24";
this.lbInfo24.Size = new System.Drawing.Size(252, 12);
this.lbInfo24.TabIndex = 2;
this.lbInfo24.Text = "Not Enough Data";
//
// label10
// lbInfo25
//
this.label10.AutoSize = true;
this.label10.BackColor = System.Drawing.Color.Snow;
this.label10.Dock = System.Windows.Forms.DockStyle.Fill;
this.label10.Location = new System.Drawing.Point(601, 48);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(252, 38);
this.label10.TabIndex = 2;
this.label10.Text = "Not Enough Data";
this.lbInfo25.AutoSize = true;
this.lbInfo25.BackColor = System.Drawing.Color.Snow;
this.lbInfo25.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbInfo25.Location = new System.Drawing.Point(601, 48);
this.lbInfo25.Name = "lbInfo25";
this.lbInfo25.Size = new System.Drawing.Size(252, 38);
this.lbInfo25.TabIndex = 2;
this.lbInfo25.Text = "Not Enough Data";
//
// PanelAnalysis
//
@@ -227,13 +227,13 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label lbInfo11;
private System.Windows.Forms.Label lbInfo12;
private System.Windows.Forms.Label lbInfo13;
private System.Windows.Forms.Label lbInfo21;
private System.Windows.Forms.Label lbInfo22;
private System.Windows.Forms.Label lbInfo23;
private System.Windows.Forms.Label lbInfo24;
private System.Windows.Forms.Label lbInfo25;
}
}

View File

@@ -15,15 +15,35 @@ namespace friction
{
MainForm m_Owner = null;
string m_CurSpring = "";
public PanelAnalysis(MainForm owner)
{
InitializeComponent();
m_Owner = owner;
Theme.Apply(this);
Theme.Apply(dgvAnalysis);
lbInfo25.ForeColor = Theme.Backcolor;
}
public void Reset()
{
m_CurSpring = "";
}
public void UpdateData(DataHandler data)
{
string strSpring = data.GetCurSpring();
if (strSpring == m_CurSpring)
return;
dgvAnalysis.Columns.Clear();
dgvAnalysis.Rows.Clear();
dgvAnalysis.Columns.Add("chTable", "Table");
dgvAnalysis.Columns.Add("chNoTest", "No. of Tests");
dgvAnalysis.Columns.Add("chAvg", "Average RPN");
@@ -33,51 +53,48 @@ namespace friction
dgvAnalysis.Columns.Add("chHumi", "Rel. Humidity");
dgvAnalysis.Columns.Add("chVel", "Velocity");
Color green = Color.YellowGreen;
Color yellow = Color.Gold;
Color red = Color.DarkOrange;
Color gray = Color.DarkGray;
Color white = Color.Snow;
string strSpring = data.GetCurSpring();
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_fAvgRPN <= 4)
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = green;
else if(result.m_fAvgRPN <= 7)
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = yellow;
else
dgvAnalysis.Rows[iIdx].Cells[2].Style.BackColor = red;
if(result.m_iCnt <= 5)
{
dgvAnalysis.Rows[iIdx].Cells[3].Style.BackColor = white;
dgvAnalysis.Rows[iIdx].Cells[4].Style.BackColor = white;
dgvAnalysis.Rows[iIdx].Cells[5].Style.BackColor = white;
dgvAnalysis.Rows[iIdx].Cells[6].Style.BackColor = white;
dgvAnalysis.Rows[iIdx].Cells[7].Style.BackColor = white;
for (int i = 2; i <= 7; i++)
{
dgvAnalysis.Rows[iIdx].Cells[i].Style.BackColor = Theme.White;
dgvAnalysis.Rows[iIdx].Cells[i].Style.ForeColor = Theme.Backcolor;
}
}
else if(result.m_iCnt <= 10)
{
dgvAnalysis.Rows[iIdx].Cells[3].Style.BackColor = gray;
dgvAnalysis.Rows[iIdx].Cells[4].Style.BackColor = gray;
dgvAnalysis.Rows[iIdx].Cells[5].Style.BackColor = gray;
dgvAnalysis.Rows[iIdx].Cells[6].Style.BackColor = gray;
dgvAnalysis.Rows[iIdx].Cells[7].Style.BackColor = gray;
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
{
dgvAnalysis.Rows[iIdx].Cells[3].Style.BackColor = (result.m_fStdRPN <= 1.5) ? green : red;
dgvAnalysis.Rows[iIdx].Cells[4].Style.BackColor = (result.m_fDiffByForce <= 1.5) ? green : red;
dgvAnalysis.Rows[iIdx].Cells[5].Style.BackColor = (result.m_fDiffByTemp <= 1.5) ? green : red;
dgvAnalysis.Rows[iIdx].Cells[6].Style.BackColor = (result.m_fDiffByHumid <= 1.5) ? green : red;
dgvAnalysis.Rows[iIdx].Cells[7].Style.BackColor = (result.m_fDiffByVel <= 1.5) ? green : red;
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;
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;
}
}
m_CurSpring = strSpring;
}
}
}

View File

@@ -56,6 +56,7 @@
//
// btApply
//
this.btApply.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btApply.Location = new System.Drawing.Point(32, 179);
this.btApply.Name = "btApply";
this.btApply.Size = new System.Drawing.Size(75, 23);

View File

@@ -21,6 +21,11 @@ namespace friction
m_Owner = owner;
this.ApplyTheme();
Theme.Apply(this);
Theme.Apply(cbMaterialSpring);
Theme.Apply(cbMaterialTable);
Theme.Apply(btApply);
}
public void UpdateData(DataHandler data)
@@ -40,6 +45,8 @@ namespace friction
cbMaterialTable.SelectedIndex = 0;
lbFileName.Text = data.GetFileName();
m_Owner.OnApplyData((string)cbMaterialSpring.SelectedItem, (string)cbMaterialTable.SelectedItem);
}
private void btApply_Click(object sender, EventArgs e)

View File

@@ -32,8 +32,7 @@
System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Nonactive Columns", System.Windows.Forms.HorizontalAlignment.Left);
this.dgvData = new System.Windows.Forms.DataGridView();
this.lvColumn = new System.Windows.Forms.ListView();
this.lvchCheck = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvchColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvchColumns = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
((System.ComponentModel.ISupportInitialize)(this.dgvData)).BeginInit();
this.SuspendLayout();
//
@@ -59,8 +58,7 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.lvColumn.CheckBoxes = true;
this.lvColumn.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchCheck,
this.lvchColumn});
this.lvchColumns});
this.lvColumn.FullRowSelect = true;
listViewGroup1.Header = "Active Columns";
listViewGroup1.Name = "lvgActiveColumn";
@@ -79,15 +77,10 @@
this.lvColumn.View = System.Windows.Forms.View.Details;
this.lvColumn.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvColumn_ItemChecked);
//
// lvchCheck
// lvchColumns
//
this.lvchCheck.Text = "";
this.lvchCheck.Width = 25;
//
// lvchColumn
//
this.lvchColumn.Text = "Columns";
this.lvchColumn.Width = 200;
this.lvchColumns.Text = "Columns";
this.lvchColumns.Width = 175;
//
// PanelResult
//
@@ -111,7 +104,6 @@
private System.Windows.Forms.DataGridView dgvData;
private System.Windows.Forms.ListView lvColumn;
private System.Windows.Forms.ColumnHeader lvchColumn;
private System.Windows.Forms.ColumnHeader lvchCheck;
private System.Windows.Forms.ColumnHeader lvchColumns;
}
}

View File

@@ -20,17 +20,36 @@ namespace friction
InitializeComponent();
m_Owner = owner;
Theme.Apply(this);
Theme.Apply(dgvData);
Theme.Apply(lvColumn);
dgvData.CellFormatting += DgvData_CellFormatting;
}
private void DgvData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
DataGridViewRow row = dgvData.Rows[e.RowIndex];
if(e.ColumnIndex == row.Cells["Risk priority number"].ColumnIndex)
{
if ((float)e.Value <= 3)
e.CellStyle.BackColor = Theme.Green;
else if ((float)e.Value <= 5)
e.CellStyle.BackColor = Theme.Yellow;
else
e.CellStyle.BackColor = Theme.Red;
}
}
public void UpdateData(DataHandler data)
{
dgvData.DataSource = data.GetData();
Dictionary<string, bool> CacheChecked = new Dictionary<string, bool>();
foreach (ListViewItem item in lvColumn.Items)
{
string key = item.SubItems[1].Text;
string key = item.SubItems[0].Text;
bool bChecked = item.Checked;
CacheChecked.Add(key, bChecked);
}
@@ -44,7 +63,7 @@ namespace friction
{
foreach(string col in Columns[iGroup])
{
ListViewItem item = new ListViewItem(new string[] { "", col });
ListViewItem item = new ListViewItem(new string[] { col });
item.Text = col;
if (CacheChecked.ContainsKey(col) == true)
item.Checked = CacheChecked[col];
@@ -60,7 +79,7 @@ namespace friction
private void lvColumn_ItemChecked(object sender, ItemCheckedEventArgs e)
{
string strColName = e.Item.SubItems[1].Text;
string strColName = e.Item.SubItems[0].Text;
bool bShow = e.Item.Checked;
dgvData.Columns[strColName].Visible = bShow;

View File

@@ -51,9 +51,10 @@
this.rbHumidity.Appearance = System.Windows.Forms.Appearance.Button;
this.rbHumidity.AutoSize = true;
this.rbHumidity.Checked = true;
this.rbHumidity.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rbHumidity.Location = new System.Drawing.Point(6, 19);
this.rbHumidity.Name = "rbHumidity";
this.rbHumidity.Size = new System.Drawing.Size(64, 22);
this.rbHumidity.Size = new System.Drawing.Size(66, 24);
this.rbHumidity.TabIndex = 1;
this.rbHumidity.TabStop = true;
this.rbHumidity.Text = "Humidity";
@@ -64,9 +65,10 @@
//
this.rbTemp.Appearance = System.Windows.Forms.Appearance.Button;
this.rbTemp.AutoSize = true;
this.rbTemp.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rbTemp.Location = new System.Drawing.Point(76, 20);
this.rbTemp.Name = "rbTemp";
this.rbTemp.Size = new System.Drawing.Size(87, 22);
this.rbTemp.Size = new System.Drawing.Size(89, 24);
this.rbTemp.TabIndex = 1;
this.rbTemp.Text = "Temperature";
this.rbTemp.UseVisualStyleBackColor = true;
@@ -79,9 +81,10 @@
this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlText;
this.groupBox1.Location = new System.Drawing.Point(8, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(322, 50);
this.groupBox1.Size = new System.Drawing.Size(171, 50);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Data";
//
// PanelTrendGraph
//

View File

@@ -20,6 +20,10 @@ namespace friction
MainForm m_Owner = null;
DataHandler m_DataHandler = null;
string m_CurSpring = "";
string m_CurTable = "";
bool m_bHumidity = false;
public PanelTrendGraph(MainForm owner, DataHandler data)
{
InitializeComponent();
@@ -27,7 +31,13 @@ namespace friction
m_Owner = owner;
m_DataHandler = data;
Theme.Apply(this);
Theme.Apply(trendChart);
Theme.Apply(groupBox1);
Theme.Apply(rbHumidity);
Theme.Apply(rbTemp);
trendChart.AxisX.Add(new Axis
{
@@ -42,19 +52,33 @@ namespace friction
});
trendChart.LegendLocation = LegendLocation.Right;
trendChart.DataClick += TrendChart_DataClick;
}
public void Reset()
{
m_CurSpring = "";
m_CurTable = "";
m_bHumidity = false;
}
private void TrendChart_DataClick(object sender, ChartPoint chartPoint)
{
}
private void UpdateGraph()
public void UpdateGraph()
{
var Chart = m_DataHandler.GetHumidityChart(m_DataHandler.GetCurSpring(), m_DataHandler.GetCurTable());
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
if (m_CurSpring == strSpring && m_CurTable == strTable && rbHumidity.Checked == m_bHumidity)
return;
var Chart = m_DataHandler.GetHumidityChart(strSpring, strTable);
if (Chart.Count <= 0)
return;
//ChartValues<ScatterPoint> Points = new ChartValues<ScatterPoint>();
string strTitle = "";
double dMin = 0;
double dMax = 0;
@@ -93,6 +117,7 @@ namespace friction
Title = "~ 0℃",
Values = Points[0],
Fill = brushes[0],
Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255)),
},
new ScatterSeries
{
@@ -153,6 +178,10 @@ namespace friction
trendChart.AxisX[0].MinValue = dMin;
trendChart.AxisX[0].MaxValue = dMax;
m_CurSpring = strSpring;
m_CurTable = strTable;
m_bHumidity = rbHumidity.Checked;
}
private void rbHumidity_CheckedChanged(object sender, EventArgs e)

150
Theme.cs Normal file
View File

@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace friction
{
public static class Theme
{
public static Color Backcolor = Color.FromArgb(255, 45, 45, 48);
public static Color BackColorTrans = Color.FromArgb(230, 45, 45, 48);
public static Color Forecolor = Color.FromArgb(255, 241, 241, 241);
public static Color Green = Color.YellowGreen;
public static Color Yellow = Color.Gold;
public static Color Red = Color.DarkOrange;
public static Color Gray = Color.DarkGray;
public static Color White = Color.Snow;
public static void Apply(Control ctrl)
{
ctrl.BackColor = Backcolor;
ctrl.ForeColor = Forecolor;
}
public static void Apply(DataGridView ctrl)
{
ctrl.DefaultCellStyle.BackColor = Backcolor;
ctrl.DefaultCellStyle.ForeColor = Forecolor;
ctrl.EnableHeadersVisualStyles = false;
ctrl.ColumnHeadersDefaultCellStyle.BackColor = Backcolor;
ctrl.ColumnHeadersDefaultCellStyle.ForeColor = Forecolor;
ctrl.RowHeadersDefaultCellStyle.BackColor = Backcolor;
ctrl.RowHeadersDefaultCellStyle.ForeColor = Forecolor;
}
public static void Apply(ListView ctrl)
{
ctrl.BackColor = Backcolor;
ctrl.ForeColor = Forecolor;
ctrl.OwnerDraw = true;
ctrl.DrawColumnHeader +=
new DrawListViewColumnHeaderEventHandler
(
(sender, e) => ListViewHeaderDraw(sender, e, Backcolor, Forecolor)
);
ctrl.DrawItem += new DrawListViewItemEventHandler(ListViewBodyDraw);
}
private static void ListViewHeaderDraw(object sender, DrawListViewColumnHeaderEventArgs e, Color backColor, Color foreColor)
{
e.Graphics.FillRectangle(new SolidBrush(backColor), e.Bounds);
e.Graphics.DrawString(e.Header.Text, e.Font, new SolidBrush(foreColor), e.Bounds);
}
private static void ListViewBodyDraw(object sender, DrawListViewItemEventArgs e)
{
e.DrawDefault = true;
}
public class MenustripColor : ProfessionalColorTable
{
public override Color MenuItemSelected { get { return BackColorTrans; } }
public override Color MenuItemSelectedGradientBegin { get { return BackColorTrans; } }
public override Color MenuItemSelectedGradientEnd { get { return BackColorTrans; } }
public override Color MenuItemPressedGradientBegin { get { return Backcolor; } }
public override Color MenuItemPressedGradientEnd { get { return Backcolor; } }
public override Color MenuItemBorder { get { return BackColorTrans; } }
public override Color MenuBorder { get { return Backcolor; } }
}
class MenustripRenderer : ToolStripProfessionalRenderer
{
public MenustripRenderer() : base(new MenustripColor())
{
}
protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
{
if (e.Item.Enabled)
base.OnRenderMenuItemBackground(e);
else
{
e.Item.BackColor = Backcolor;
base.OnRenderMenuItemBackground(e);
if (e.Item.Selected == true)
{
e.Item.ImageTransparentColor = Backcolor;
base.OnRenderMenuItemBackground(e);
}
}
}
protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
{
if (e.Item.Enabled)
base.OnRenderMenuItemBackground(e);
}
}
public static void Apply(MenuStrip ctrl)
{
ctrl.BackColor = Backcolor;
ctrl.ForeColor = Forecolor;
foreach (ToolStripMenuItem item in ctrl.Items)
{
foreach (ToolStripMenuItem subitem in item.DropDownItems)
{
subitem.BackColor = Backcolor;
subitem.ForeColor = Forecolor;
subitem.MouseEnter += Ctrl_MouseEnter;
subitem.MouseLeave += Ctrl_MouseLeave;
}
item.BackColor = Backcolor;
item.ForeColor = Forecolor;
item.MouseEnter += Ctrl_MouseEnter;
item.MouseLeave += Ctrl_MouseLeave;
}
ctrl.Renderer = new MenustripRenderer();
}
private static void Ctrl_MouseEnter(object sender, EventArgs e)
{
if(sender is ToolStripMenuItem)
{
((ToolStripMenuItem)sender).ForeColor = Color.Orange;
}
}
private static void Ctrl_MouseLeave(object sender, EventArgs e)
{
if (sender is ToolStripMenuItem)
{
((ToolStripMenuItem)sender).ForeColor = Forecolor;
}
}
}
}

View File

@@ -32,6 +32,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>main_icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="EPPlus, Version=4.1.0.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
<HintPath>packages\EPPlus.4.1.0\lib\net40\EPPlus.dll</HintPath>
@@ -106,6 +109,7 @@
<Compile Include="PanelMaterial.Designer.cs">
<DependentUpon>PanelMaterial.cs</DependentUpon>
</Compile>
<Compile Include="Theme.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
@@ -157,6 +161,9 @@
<Name>WinFormsUI</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="main_icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

BIN
main_icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
resource/anaylisys3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
resource/main_icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

BIN
resource/open3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
resource/pair3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
resource/radar3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
resource/result3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

BIN
resource/trend3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB