Compare commits

..

5 Commits

Author SHA1 Message Date
fae1f8b7c9 - 리포트에서 Trend 그래프 정리 2017-06-24 17:32:17 +09:00
8c46481430 - 설정 업데이트 (창크기, Column 체크)
- 로딩 중 마우스 포인터
2017-06-24 15:34:18 +09:00
334c131e6e - 리포트 기능 추가(Trend Graph 제외)
- AboutBox 추가
2017-06-24 14:43:27 +09:00
4503bfc7a5 - Material Compatibility Map 추가 2017-06-23 15:53:56 +09:00
bc27de2ea5 - Material Pair에 layout 적용
- Trend Graph에 Force, Velocity 추가
2017-06-23 14:59:08 +09:00
24 changed files with 7879 additions and 217 deletions

109
AboutBox.Designer.cs generated Normal file
View File

@@ -0,0 +1,109 @@
namespace friction
{
partial class AboutBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox));
this.label1 = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(160, 12);
this.label1.TabIndex = 0;
this.label1.Text = "Material Stick-slip Analysis";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(233, 64);
this.tableLayoutPanel1.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 16);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 12);
this.label2.TabIndex = 0;
this.label2.Text = "Ver. 1.0";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 32);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(212, 12);
this.label3.TabIndex = 0;
this.label3.Text = "Copyright © 2016, General Utility Ltd.";
//
// AboutBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(255, 77);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
}
}

20
AboutBox.cs Normal file
View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace friction
{
public partial class AboutBox : Form
{
public AboutBox()
{
InitializeComponent();
}
}
}

6293
AboutBox.resx Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
@@ -13,6 +14,11 @@ namespace friction
static string m_strPath = "";
static Config()
{
}
public static void Init()
{
string strPrjName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
string strFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), strPrjName);
@@ -23,11 +29,6 @@ namespace friction
Load();
}
public static void Init()
{
}
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
@@ -44,13 +45,43 @@ namespace friction
foreach (string strFile in astrList)
OPTION.AddRecentFile(strFile);
}
iRes = GetPrivateProfileString("Option", "bound", "", temp, 10240, m_strPath);
if(temp.Length > 0)
{
string[] astrBound = temp.ToString().Split(',');
int iLeft, iWidth, iTop, iHeight;
int.TryParse(astrBound[0], out iLeft);
int.TryParse(astrBound[1], out iWidth);
int.TryParse(astrBound[2], out iTop);
int.TryParse(astrBound[3], out iHeight);
OPTION.WindowBound = new Rectangle(iLeft, iTop, iWidth, iHeight);
}
iRes = GetPrivateProfileString("Option", "checked-column", "", temp, 10240, m_strPath);
if (temp.Length > 0)
{
string[] astrBound = temp.ToString().Split(',');
OPTION.CheckedColumns = astrBound.ToList();
}
iRes = GetPrivateProfileString("Option", "unchecked-column", "", temp, 10240, m_strPath);
if (temp.Length > 0)
{
string[] astrBound = temp.ToString().Split(',');
OPTION.UncheckedColumns = astrBound.ToList();
}
}
private static void Save()
public static void Save()
{
WritePrivateProfileString("Option", "recent", OPTION.GetRecentAll(), m_strPath);
WritePrivateProfileString("Option", "bound", OPTION.WindowBoundStr(), m_strPath);
WritePrivateProfileString("Option", "checked-column", OPTION.CheckedColumnsStr(), m_strPath);
WritePrivateProfileString("Option", "unchecked-column", OPTION.UncheckedColumnsStr(), m_strPath);
}
@@ -69,6 +100,9 @@ namespace friction
public static class OPTION
{
public static List<string> m_RecentList = new List<string>();
public static Rectangle WindowBound { set; get; }
public static List<string> CheckedColumns { set; get; }
public static List<string> UncheckedColumns { set; get; }
public static void AddRecentFile(string strPath)
{
@@ -76,13 +110,50 @@ namespace friction
m_RecentList.Remove(strPath);
m_RecentList.Add(strPath);
Save();
}
public static string GetRecentAll()
{
return string.Join("//", m_RecentList);
}
public static string WindowBoundStr()
{
return string.Format("{0}, {1}, {2}, {3}", WindowBound.Left, WindowBound.Width, WindowBound.Top, WindowBound.Height);
}
public static string CheckedColumnsStr()
{
string strResult = "";
if(CheckedColumns != null)
{
foreach (var item in CheckedColumns)
{
if (strResult.Length > 0)
strResult += ",";
strResult += item;
}
}
return strResult;
}
public static string UncheckedColumnsStr()
{
string strResult = "";
if(UncheckedColumns != null)
{
foreach (var item in UncheckedColumns)
{
if (strResult.Length > 0)
strResult += ",";
strResult += item;
}
}
return strResult;
}
}

View File

@@ -40,6 +40,8 @@ namespace friction
{
public float HUMIDITY;
public float TEMPERATURE;
public float FORCE;
public float VELOCITY;
public float RPN;
override public string ToString()
@@ -207,7 +209,7 @@ namespace friction
return result;
}
public List<TREND_CHART> GetHumidityChart(string strSpring, string strTable)
public List<TREND_CHART> GetTrendChart(string strSpring, string strTable)
{
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);
@@ -219,6 +221,8 @@ namespace friction
{
HUMIDITY = (float)r[Config.COLUMN_NAME.HUMIDITY],
TEMPERATURE = (float)r[Config.COLUMN_NAME.TEMP],
FORCE = (float)r[Config.COLUMN_NAME.FORCE],
VELOCITY = (float)r[Config.COLUMN_NAME.VELOCITY],
RPN = (float)r[Config.COLUMN_NAME.RPN],
});
}
@@ -226,7 +230,6 @@ namespace friction
return result;
}
#region calculation
float CalcDependency(DataRow[] rows, string strColumn)
{

90
ExcelHelper.cs Normal file
View File

@@ -0,0 +1,90 @@
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace friction
{
public class ExcelHelper
{
//The correct method to convert width to pixel is:
//Pixel =Truncate(((256 * {width} + Truncate(128/{Maximum DigitWidth}))/256)*{Maximum Digit Width})
//The correct method to convert pixel to width is:
//1. use the formula =Truncate(({pixels}-5)/{Maximum Digit Width} * 100+0.5)/100
// to convert pixel to character number.
//2. use the formula width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256
// to convert the character number to width.
public const int MTU_PER_PIXEL = 9525;
public static int ColumnWidth2Pixel(ExcelWorksheet ws, double excelColumnWidth)
{
//The correct method to convert width to pixel is:
//Pixel =Truncate(((256 * {width} + Truncate(128/{Maximum DigitWidth}))/256)*{Maximum Digit Width})
//get the maximum digit width
decimal mdw = ws.Workbook.MaxFontWidth;
//convert width to pixel
decimal pixels = decimal.Truncate(((256 * (decimal)excelColumnWidth + decimal.Truncate(128 / mdw)) / 256) * mdw);
//double columnWidthInTwips = (double)(pixels * (1440f / 96f));
return Convert.ToInt32(pixels);
}
public static double Pixel2ColumnWidth(ExcelWorksheet ws, int pixels)
{
//The correct method to convert pixel to width is:
//1. use the formula =Truncate(({pixels}-5)/{Maximum Digit Width} * 100+0.5)/100
// to convert pixel to character number.
//2. use the formula width = Truncate([{Number of Characters} * {Maximum Digit Width} + {5 pixel padding}]/{Maximum Digit Width}*256)/256
// to convert the character number to width.
//get the maximum digit width
decimal mdw = ws.Workbook.MaxFontWidth;
//convert pixel to character number
decimal numChars = decimal.Truncate(decimal.Add((pixels - 5) / mdw * 100, (decimal)0.5)) / 100;
//convert the character number to width
decimal excelColumnWidth = decimal.Truncate((decimal.Add(numChars * mdw, 5)) / mdw * 256) / 256;
return Convert.ToDouble(excelColumnWidth);
}
public static int RowHeight2Pixel(double excelRowHeight)
{
//convert height to pixel
decimal pixels = decimal.Truncate((decimal)(excelRowHeight / 0.75));
return Convert.ToInt32(pixels);
}
public static double Pixel2RowHeight(int pixels)
{
//convert height to pixel
double excelRowHeight = pixels * 0.75;
return excelRowHeight;
}
public static int MTU2Pixel(int mtus)
{
//convert MTU to pixel
decimal pixels = decimal.Truncate(mtus / MTU_PER_PIXEL);
return Convert.ToInt32(pixels);
}
public static int Pixel2MTU(int pixels)
{
//convert pixel to MTU
int mtus = pixels * MTU_PER_PIXEL;
return mtus;
}
}
}

59
MainForm.Designer.cs generated
View File

@@ -36,6 +36,7 @@
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButtonResult = new System.Windows.Forms.ToolStripButton();
this.toolStripButtonAnalysis = new System.Windows.Forms.ToolStripButton();
this.toolStripButtonMap = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripButtonRadarGraph = new System.Windows.Forms.ToolStripButton();
this.toolStripButtonTrendGraph = new System.Windows.Forms.ToolStripButton();
@@ -49,11 +50,14 @@
this.tableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.resultTableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.analysisTableToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.materialCompatibilityMapToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.graphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.radarGraphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.trendGraphToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
this.toolStripMain.SuspendLayout();
this.statusStrip.SuspendLayout();
@@ -70,6 +74,7 @@
this.toolStripSeparator3,
this.toolStripButtonResult,
this.toolStripButtonAnalysis,
this.toolStripButtonMap,
this.toolStripSeparator2,
this.toolStripButtonRadarGraph,
this.toolStripButtonTrendGraph});
@@ -134,6 +139,17 @@
this.toolStripButtonAnalysis.ToolTipText = "Analysis Table (Ctrl+A)";
this.toolStripButtonAnalysis.Click += new System.EventHandler(this.toolStripButtonAnalysis_Click);
//
// toolStripButtonMap
//
this.toolStripButtonMap.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButtonMap.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonMap.Image")));
this.toolStripButtonMap.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButtonMap.Name = "toolStripButtonMap";
this.toolStripButtonMap.Size = new System.Drawing.Size(23, 22);
this.toolStripButtonMap.Text = "toolStripButton1";
this.toolStripButtonMap.ToolTipText = "Material Compatibility Map";
this.toolStripButtonMap.Click += new System.EventHandler(this.toolStripButtonMap_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
@@ -184,7 +200,8 @@
this.fileToolStripMenuItem,
this.tableToolStripMenuItem,
this.graphToolStripMenuItem,
this.reportToolStripMenuItem});
this.reportToolStripMenuItem,
this.aToolStripMenuItem});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.Name = "menuStrip";
this.menuStrip.Size = new System.Drawing.Size(1184, 24);
@@ -225,7 +242,8 @@
//
this.tableToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.resultTableToolStripMenuItem,
this.analysisTableToolStripMenuItem});
this.analysisTableToolStripMenuItem,
this.materialCompatibilityMapToolStripMenuItem});
this.tableToolStripMenuItem.Name = "tableToolStripMenuItem";
this.tableToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
this.tableToolStripMenuItem.Text = "Table";
@@ -233,17 +251,24 @@
// resultTableToolStripMenuItem
//
this.resultTableToolStripMenuItem.Name = "resultTableToolStripMenuItem";
this.resultTableToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
this.resultTableToolStripMenuItem.Size = new System.Drawing.Size(221, 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(221, 22);
this.analysisTableToolStripMenuItem.Text = "Analysis Table";
this.analysisTableToolStripMenuItem.Click += new System.EventHandler(this.analysisTableToolStripMenuItem_Click);
//
// materialCompatibilityMapToolStripMenuItem
//
this.materialCompatibilityMapToolStripMenuItem.Name = "materialCompatibilityMapToolStripMenuItem";
this.materialCompatibilityMapToolStripMenuItem.Size = new System.Drawing.Size(221, 22);
this.materialCompatibilityMapToolStripMenuItem.Text = "Material Compatibility Map";
this.materialCompatibilityMapToolStripMenuItem.Click += new System.EventHandler(this.materialCompatibilityMapToolStripMenuItem_Click);
//
// graphToolStripMenuItem
//
this.graphToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -279,8 +304,24 @@
// allToolStripMenuItem
//
this.allToolStripMenuItem.Name = "allToolStripMenuItem";
this.allToolStripMenuItem.Size = new System.Drawing.Size(88, 22);
this.allToolStripMenuItem.Text = "All";
this.allToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
this.allToolStripMenuItem.Text = "Export to Excel";
this.allToolStripMenuItem.Click += new System.EventHandler(this.allToolStripMenuItem_Click);
//
// aToolStripMenuItem
//
this.aToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aboutToolStripMenuItem});
this.aToolStripMenuItem.Name = "aToolStripMenuItem";
this.aToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.aToolStripMenuItem.Text = "Help";
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
// dockPanel
//
@@ -302,8 +343,10 @@
this.Controls.Add(this.menuStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip;
this.MinimumSize = new System.Drawing.Size(800, 600);
this.Name = "MainForm";
this.Text = "Material Stick-Slip Analysis";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.toolStripMain.ResumeLayout(false);
this.toolStripMain.PerformLayout();
this.statusStrip.ResumeLayout(false);
@@ -343,6 +386,10 @@
private System.Windows.Forms.ToolStripMenuItem allToolStripMenuItem;
private System.Windows.Forms.ToolStripButton toolStripButtonMaterial;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem aToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripButton toolStripButtonMap;
private System.Windows.Forms.ToolStripMenuItem materialCompatibilityMapToolStripMenuItem;
}
}

View File

@@ -19,9 +19,12 @@ namespace friction
PanelMaterial m_MaterialPanel = null;
PanelResult m_ResultPanel = null;
PanelAnalysis m_AnalysisPanel = null;
PanelCompatibility m_CompatibilityPanel = null;
PanelRadarGraph m_RadarGraphPanel = null;
PanelTrendGraph m_TrendGraphPanel = null;
Report m_Report = null;
public MainForm()
{
InitializeComponent();
@@ -30,6 +33,7 @@ namespace friction
m_MaterialPanel = new PanelMaterial(this);
m_ResultPanel = new PanelResult(this);
m_AnalysisPanel = new PanelAnalysis(this);
m_CompatibilityPanel = new PanelCompatibility(this);
m_RadarGraphPanel = new PanelRadarGraph(this, m_DataHandler);
m_TrendGraphPanel = new PanelTrendGraph(this, m_DataHandler);
@@ -40,6 +44,8 @@ namespace friction
Config.Init();
UpdateRecentFile();
if(Config.OPTION.WindowBound.Width > 0)
Bounds = Config.OPTION.WindowBound;
}
void UpdateRecentFile()
@@ -70,12 +76,15 @@ namespace friction
DialogResult result = ofd.ShowDialog();
if (result == DialogResult.OK)
m_DBFileName = ofd.FileName;
else
return;
}
else
{
m_DBFileName = strFile;
}
Cursor.Current = Cursors.WaitCursor;
m_DataHandler.LoadData(m_DBFileName);
@@ -96,9 +105,11 @@ namespace friction
Config.OPTION.AddRecentFile(m_DBFileName);
UpdateRecentFile();
Cursor.Current = Cursors.Default;
}
private void OpenPanel(DockContent panel)
public void OpenPanel(DockContent panel)
{
if (panel.Visible == false)
panel.Show(dockPanel);
@@ -122,7 +133,7 @@ namespace friction
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void resultTableToolStripMenuItem_Click(object sender, EventArgs e)
@@ -135,6 +146,12 @@ namespace friction
OpenPanel(m_AnalysisPanel);
}
private void materialCompatibilityMapToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenPanel(m_CompatibilityPanel);
m_CompatibilityPanel.UpdateData(m_DataHandler);
}
private void radarGraphToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenPanel(m_RadarGraphPanel);
@@ -146,8 +163,79 @@ namespace friction
OpenPanel(m_TrendGraphPanel);
m_TrendGraphPanel.UpdateGraph();
}
private void allToolStripMenuItem_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "엑셀 파일 (*.xlsx)|*.xlsx|엑셀 파일 (*.xls)|*.xls|전체|*";
DialogResult result = sfd.ShowDialog();
string strFilePath = "";
if (result == DialogResult.OK)
strFilePath = sfd.FileName;
else
return;
Cursor.Current = Cursors.WaitCursor;
m_Report = new Report();
m_Report.FilePath = strFilePath;
m_Report.MaterialSpring = m_DataHandler.GetCurSpring();
m_Report.MaterialTable = m_DataHandler.GetCurTable();
m_Report.AnalysisData = m_AnalysisPanel.GetData();
m_Report.RadarChart = m_RadarGraphPanel.CopyChart();
if(m_DataHandler.GetCurTable() != "" && m_DataHandler.GetCurTable() != "All")
{
OpenPanel(m_TrendGraphPanel);
m_TrendGraphPanel.CopyChart(PanelTrendGraph.GRAPH_TYPE.HUMIDITY);
}
else
{
m_Report.Export();
m_Report = null;
Cursor.Current = Cursors.Default;
}
}
public void OnChartUpdate(Bitmap bm, PanelTrendGraph.GRAPH_TYPE Type)
{
switch(Type)
{
case PanelTrendGraph.GRAPH_TYPE.HUMIDITY:
m_Report.TrendChartByHumidity = bm;
m_TrendGraphPanel.CopyChart(PanelTrendGraph.GRAPH_TYPE.TEMPERATURE);
break;
case PanelTrendGraph.GRAPH_TYPE.TEMPERATURE:
m_Report.TrendChartByTemperature = bm;
m_TrendGraphPanel.CopyChart(PanelTrendGraph.GRAPH_TYPE.FORCE);
break;
case PanelTrendGraph.GRAPH_TYPE.FORCE:
m_Report.TrendChartByForce = bm;
m_TrendGraphPanel.CopyChart(PanelTrendGraph.GRAPH_TYPE.VELOCITY);
break;
case PanelTrendGraph.GRAPH_TYPE.VELOCITY:
m_Report.TrendChartByVelocity = bm;
m_Report.Export();
m_Report = null;
Cursor.Current = Cursors.Default;
break;
}
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox aboutWindow = new AboutBox();
aboutWindow.ShowDialog();
}
#endregion
#region Events from toolbox
private void toolStripButtonOpen_Click(object sender, EventArgs e)
{
@@ -169,6 +257,12 @@ namespace friction
OpenPanel(m_AnalysisPanel);
}
private void toolStripButtonMap_Click(object sender, EventArgs e)
{
OpenPanel(m_CompatibilityPanel);
m_CompatibilityPanel.UpdateData(m_DataHandler);
}
private void toolStripButtonRadarGraph_Click(object sender, EventArgs e)
{
OpenPanel(m_RadarGraphPanel);
@@ -185,7 +279,7 @@ namespace friction
#region Events from panels
public void OnApplyData(string strSpring, string strTable)
{
Console.WriteLine(string.Format("[start] MainForm::OnApplyData({0}, {1})", strSpring, strTable));
Console.WriteLine("[MainForm::OnApply] start");
m_DataHandler.SetSelectedMaterial(strSpring, strTable);
@@ -209,28 +303,50 @@ namespace friction
}
m_AnalysisPanel.UpdateData(m_DataHandler);
Console.WriteLine(string.Format("[end ] MainForm::OnApplyData({0}, {1})", strSpring, strTable));
}
public void OnRadarSelectTable(string strTable)
{
if (m_AnalysisPanel != null)
m_AnalysisPanel.SelectRow(strTable);
OpenPanel(m_AnalysisPanel);
}
public void OnTrendSelectByHumidity(string strSpring, string strTable, float fHumidity, float fRPN)
{
if (m_ResultPanel != null)
m_ResultPanel.SelectRowByHumidity(strSpring, strTable, fHumidity, fRPN);
OpenPanel(m_ResultPanel);
}
public void OnTrendSelectByTemperature(string strSpring, string strTable, float fTemperature, float fRPN)
{
if (m_ResultPanel != null)
m_ResultPanel.SelectRowByTemperature(strSpring, strTable, fTemperature, fRPN);
OpenPanel(m_ResultPanel);
}
public void OnTrendSelectByForce(string strSpring, string strTable, float fTemperature, float fRPN)
{
if (m_ResultPanel != null)
m_ResultPanel.SelectRowByForce(strSpring, strTable, fTemperature, fRPN);
OpenPanel(m_ResultPanel);
}
public void OnTrendSelectByVelocity(string strSpring, string strTable, float fTemperature, float fRPN)
{
if (m_ResultPanel != null)
m_ResultPanel.SelectRowByVelocity(strSpring, strTable, fTemperature, fRPN);
OpenPanel(m_ResultPanel);
}
#endregion
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
Config.OPTION.WindowBound = this.Bounds;
Config.OPTION.CheckedColumns = m_ResultPanel.GetCheckedColumns();
Config.OPTION.UncheckedColumns = m_ResultPanel.GetUncheckedColumns();
Config.Save();
}
}
}

View File

@@ -161,29 +161,40 @@
0odP/0+5cRtuwPRbd/9nHT/6f+adu8QZ0HH5yv+SUyfBBoA0Vp87B6an36bYgDvEe2Em0DaQQSDnz7p9
H0xPvXWbsAFVF07/r7xw6n/ZuVP/S8+d/F989sT/ojPH/heeBuIzx/EbMACAgQEAoVdw+F58Mj4AAAAA
SUVORK5CYII=
</value>
</data>
<data name="toolStripButtonMap.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAELSURBVDhPYxhcwH/7dgXv3ZsdoFwMAJIDqYFyMYHvzs0N
vru2/IdyMQBIDqQGykUFKYuPvY9ffPBr/Pyjv0FsbDhu8cFfyfMPfgOxodoQwHfi7v+kYKg2BGjff+N/
274b/1uBuBmIm/Ze/98IxPVAXLfn+v+aPdf+V+++9r8SiqHaEODw26//97z6+H/rs7f/QWwQDeJjEzvw
9gt2AxovXv4PCqgtLz+D6aKzF7GKgdRCtSEASHD5wxf/W67cAtry5X/n1dv/Z917hlUMpwEzb9//n3vq
FFhxwenT//tv3MMqhtOA9qvX/4fs2w12bhiQLrtwFasYTgNIwVBtCHD49WcHUjBU24ADBgYAPIaMIohq
wJwAAAAASUVORK5CYII=
</value>
</data>
<data name="toolStripButtonRadarGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFdSURBVDhPYxh8wGfmJi6fSbtLfSfuPu8xcffPyP27/hcd
PPw1a/uRTZlbDgtClWEHXlP2yvv2774O1PwfhlOOHvhfdeE0GBcfO/EjZeN+C6hyVACyGV0zCOedOgo3
AGZI6O4z/FBtCOA7YU8Zumbvvp1X848d/45sAAhn7Dy2AaoNAYC2X0AxYNLOBKgUQ/qOw7ORDSg6cPgr
VAoBQAGGbDNUGA5ATocZUHnu1H+oMAIgG+A1cdcVqDAE/P/PuObBmx+7X33+v/XFp/+rn77HNMC7f8c5
mAEg7DNhVyJUiqF80/m2w2+//ofhtXdefYFKIYDPxN1FyAZA8TUwnrD7f/nmi3ADpp1+sBaqDQFCeo9x
gpyOZgAce0/Y9T99+cn/62++/l5/4hYfVBsq8JmwWw6fIW69O24mzdlvAlWOHdjP388B8c6us779276D
8cTdZ4D8ApAcVNmgAQwMANmePnUCkMyWAAAAAElFTkSuQmCC
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFbSURBVDhPYxh8wGfmJi6fSbtLfSfuPu8ycffPyP27/hft
3/81a/uRTZlbDgtClWEHXlP2yvv2774O1PwfhlOOHvhfdeE0GBcfO/EjZeN+C6hyVACyGV0zCOedOgo3
AGZI6O4z/FBtCOA7YU8Zumbvvp1X848d/45sAAhn7Dy2AaoNAYC2X0AxYNLOBKgUQ/qOw7ORDQCFCVQK
AUABhmwzVBgOQE6HGVB57tR/qDACIBvgNXHXFagwBPz/z7jiwZsfu199/r/1xaf/q5++xzTAu3/HOZgB
IOwzYVciVIqhfNP5tsNvv/6H4bV3Xn2BSiGAz8TdRcgGQPE1MJ6w+3/55otwA6adfrAWqg0BQnqPcYKc
jmYAHHtP2PU/ffnJ/+uvvv5ef+IWH1QbKvCZsFsOnyFuvTtuJs3ZbwJVjh3Yz9/PAfHOrrO+/Zu+g/HE
3WeA/AKQHFTZoAEMDACJ+j5OaUipqgAAAABJRU5ErkJggg==
</value>
</data>
<data name="toolStripButtonTrendGraph.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEpSURBVDhPY6A7COk9xuk1Za88lIsdBE7bKeY7aac1lIsC
/CbtXunbs+2fV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz
D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNunb/uv
/CbtXunbsemfV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz
D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNuna/Ov
vDUnL4H45edO6FedPz0BxMYAB998DT785msOsiK/ybukAibte+IzcVc1iI/VALfeHULBk/ccb9595QCI
j66o8vyZgKrzx6RBbKwGgELUY+Luv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB
oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEAKbL9ZOjCSnkAAAAASUVORK5CYII=
j66o8vyZgKrzx6RBbKwGgELUZeLuv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB
oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEA8cf9UGxcQysAAAAASUVORK5CYII=
</value>
</data>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@@ -39,6 +39,7 @@
this.lbInfo22 = new System.Windows.Forms.Label();
this.lbInfo23 = new System.Windows.Forms.Label();
this.lbInfo24 = new System.Windows.Forms.Label();
this.lbSpring = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dgvAnalysis)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
@@ -52,11 +53,11 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvAnalysis.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvAnalysis.Location = new System.Drawing.Point(12, 12);
this.dgvAnalysis.Location = new System.Drawing.Point(12, 33);
this.dgvAnalysis.Name = "dgvAnalysis";
this.dgvAnalysis.ReadOnly = true;
this.dgvAnalysis.RowTemplate.Height = 23;
this.dgvAnalysis.Size = new System.Drawing.Size(856, 567);
this.dgvAnalysis.Size = new System.Drawing.Size(856, 546);
this.dgvAnalysis.TabIndex = 0;
//
// tableLayoutPanel1
@@ -195,12 +196,21 @@
this.lbInfo24.TabIndex = 2;
this.lbInfo24.Text = "Not Enough Data";
//
// lbSpring
//
this.lbSpring.AutoSize = true;
this.lbSpring.Location = new System.Drawing.Point(12, 9);
this.lbSpring.Name = "lbSpring";
this.lbSpring.Size = new System.Drawing.Size(0, 12);
this.lbSpring.TabIndex = 2;
//
// PanelAnalysis
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(880, 649);
this.ControlBox = false;
this.Controls.Add(this.lbSpring);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.dgvAnalysis);
this.HideOnClose = true;
@@ -212,6 +222,7 @@
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -228,5 +239,6 @@
private System.Windows.Forms.Label lbInfo22;
private System.Windows.Forms.Label lbInfo23;
private System.Windows.Forms.Label lbInfo24;
private System.Windows.Forms.Label lbSpring;
}
}

View File

@@ -4,7 +4,6 @@ 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;
@@ -27,10 +26,6 @@ namespace friction
Theme.Apply(this);
Theme.Apply(dgvAnalysis);
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;
@@ -73,6 +68,9 @@ namespace friction
if (strSpring == m_CurSpring)
return;
lbSpring.Text = "Material Spring: " +strSpring;
lbSpring.ForeColor = Color.Orange;
dgvAnalysis.Columns.Clear();
dgvAnalysis.Rows.Clear();
@@ -90,6 +88,8 @@ namespace friction
foreach (string strTable in data.GetTableList())
{
DataHandler.CalcResult result = data.GetCalc(strSpring, strTable);
if (result.m_iCnt <= 0)
continue;
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);
@@ -145,5 +145,25 @@ namespace friction
}
}
}
public DataTable GetData()
{
var dt = new DataTable();
foreach (DataGridViewColumn column in dgvAnalysis.Columns)
{
if (column.Visible)
dt.Columns.Add(column.HeaderText);
}
object[] cellValues = new object[dgvAnalysis.Columns.Count];
foreach (DataGridViewRow row in dgvAnalysis.Rows)
{
for (int i = 0; i < row.Cells.Count; i++)
cellValues[i] = row.Cells[i].Value;
dt.Rows.Add(cellValues);
}
return dt;
}
}
}

66
PanelCompatibility.Designer.cs generated Normal file
View File

@@ -0,0 +1,66 @@
namespace friction
{
partial class PanelCompatibility
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dgvMap = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.dgvMap)).BeginInit();
this.SuspendLayout();
//
// dgvMap
//
this.dgvMap.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvMap.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvMap.Location = new System.Drawing.Point(12, 12);
this.dgvMap.Name = "dgvMap";
this.dgvMap.RowTemplate.Height = 23;
this.dgvMap.Size = new System.Drawing.Size(799, 647);
this.dgvMap.TabIndex = 0;
//
// PanelCompatibility
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(823, 671);
this.ControlBox = false;
this.Controls.Add(this.dgvMap);
this.HideOnClose = true;
this.Name = "PanelCompatibility";
this.Text = "Material Compatibility Map";
((System.ComponentModel.ISupportInitialize)(this.dgvMap)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dgvMap;
}
}

103
PanelCompatibility.cs Normal file
View File

@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace friction
{
public partial class PanelCompatibility : DockContent
{
MainForm m_Owner = null;
public PanelCompatibility(MainForm owner)
{
InitializeComponent();
m_Owner = owner;
Theme.Apply(this);
Theme.Apply(dgvMap);
dgvMap.CellPainting += DgvMap_CellPainting;
dgvMap.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
dgvMap.ColumnHeadersHeight = 100;
dgvMap.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
dgvMap.DefaultCellStyle.Format = "N2";
}
public void UpdateData(DataHandler data)
{
var Springs = data.GetSpringList();
var Tables = data.GetTableList();
dgvMap.Rows.Clear();
dgvMap.Columns.Clear();
foreach (var table in Tables)
{
int iCol = dgvMap.Columns.Add(table, table);
dgvMap.Columns[iCol].Width = 29;
}
foreach (var spring in Springs)
{
int iRow = dgvMap.Rows.Add();
dgvMap.Rows[iRow].HeaderCell.Value = spring;
var Averages = data.GetAvgAll(spring);
foreach(var avg in Averages)
{
if(avg.m_fAvg > 0)
{
var cell = dgvMap.Rows[iRow].Cells[avg.m_strTable];
cell.Value = avg.m_fAvg;
Config.ANALYSIS.RISK Risk = Config.ANALYSIS.GetRisk(avg.m_fAvg);
switch(Risk)
{
case Config.ANALYSIS.RISK.NO:
cell.Style.BackColor = Theme.Green;
break;
case Config.ANALYSIS.RISK.POTENTIAL:
cell.Style.BackColor = Theme.Yellow;
break;
case Config.ANALYSIS.RISK.HIGH:
cell.Style.BackColor = Theme.Red;
break;
}
}
}
}
}
private void DgvMap_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
DataGridView view = sender as DataGridView;
if (e.RowIndex == -1 && e.ColumnIndex >= 0)
{
Brush brush = new SolidBrush(this.dgvMap.ForeColor);
e.PaintBackground(e.ClipBounds, true);
Rectangle rect = view.GetColumnDisplayRectangle(e.ColumnIndex, true);
Size titleSize = TextRenderer.MeasureText(e.Value.ToString(), e.CellStyle.Font);
if (view.ColumnHeadersHeight < titleSize.Width)
view.ColumnHeadersHeight = titleSize.Width;
e.Graphics.TranslateTransform(0, titleSize.Width);
e.Graphics.RotateTransform(-90.0F);
e.Graphics.DrawString(e.Value.ToString(), this.Font, brush,
new PointF(rect.Y - (view.ColumnHeadersHeight - titleSize.Width), rect.X+(e.CellBounds.Width-titleSize.Height)/2));
e.Graphics.RotateTransform(90.0F);
e.Graphics.TranslateTransform(0, -titleSize.Width);
e.Handled = true;
}
}
}
}

120
PanelCompatibility.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -35,21 +35,24 @@
this.lvchSpring = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lvTable = new System.Windows.Forms.ListView();
this.lvchTable = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// lbFileName
//
this.lbFileName.AutoSize = true;
this.lbFileName.Font = new System.Drawing.Font("Malgun Gothic", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.lbFileName.Location = new System.Drawing.Point(7, 9);
this.lbFileName.Location = new System.Drawing.Point(3, 0);
this.lbFileName.Name = "lbFileName";
this.lbFileName.Size = new System.Drawing.Size(0, 25);
this.lbFileName.TabIndex = 4;
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 46);
this.label2.Location = new System.Drawing.Point(3, 43);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(90, 12);
this.label2.TabIndex = 5;
@@ -59,7 +62,7 @@
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 339);
this.label3.Location = new System.Drawing.Point(3, 389);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(86, 12);
this.label3.TabIndex = 6;
@@ -67,15 +70,14 @@
//
// lvSpring
//
this.lvSpring.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvSpring.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchSpring});
this.lvSpring.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvSpring.FullRowSelect = true;
this.lvSpring.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSpring.Location = new System.Drawing.Point(12, 61);
this.lvSpring.Location = new System.Drawing.Point(3, 58);
this.lvSpring.Name = "lvSpring";
this.lvSpring.Size = new System.Drawing.Size(326, 263);
this.lvSpring.Size = new System.Drawing.Size(292, 320);
this.lvSpring.TabIndex = 7;
this.lvSpring.UseCompatibleStateImageBehavior = false;
this.lvSpring.View = System.Windows.Forms.View.Details;
@@ -89,16 +91,14 @@
//
// lvTable
//
this.lvTable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvTable.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchTable});
this.lvTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvTable.FullRowSelect = true;
this.lvTable.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvTable.Location = new System.Drawing.Point(12, 354);
this.lvTable.Location = new System.Drawing.Point(3, 404);
this.lvTable.Name = "lvTable";
this.lvTable.Size = new System.Drawing.Size(326, 361);
this.lvTable.Size = new System.Drawing.Size(292, 320);
this.lvTable.TabIndex = 8;
this.lvTable.UseCompatibleStateImageBehavior = false;
this.lvTable.View = System.Windows.Forms.View.Details;
@@ -110,24 +110,42 @@
this.lvchTable.Text = "Table";
this.lvchTable.Width = 305;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.lbFileName, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.lvTable, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.lvSpring, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 5;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(298, 727);
this.tableLayoutPanel1.TabIndex = 9;
//
// PanelMaterial
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(350, 727);
this.ClientSize = new System.Drawing.Size(298, 727);
this.ControlBox = false;
this.Controls.Add(this.lvTable);
this.Controls.Add(this.lvSpring);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.lbFileName);
this.Controls.Add(this.tableLayoutPanel1);
this.HideOnClose = true;
this.Name = "PanelMaterial";
this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.DockLeft;
this.TabText = "Material Pair";
this.Text = "Material Pair";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -139,5 +157,6 @@
private System.Windows.Forms.ListView lvTable;
private System.Windows.Forms.ColumnHeader lvchSpring;
private System.Windows.Forms.ColumnHeader lvchTable;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}

View File

@@ -37,6 +37,7 @@
System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.lbSpring = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
this.SuspendLayout();
//
@@ -54,7 +55,7 @@
this.chart.ChartAreas.Add(chartArea1);
legend1.Name = "Legend1";
this.chart.Legends.Add(legend1);
this.chart.Location = new System.Drawing.Point(12, 12);
this.chart.Location = new System.Drawing.Point(12, 27);
this.chart.Name = "chart";
series1.ChartArea = "ChartArea1";
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Radar;
@@ -101,17 +102,26 @@
this.chart.Series.Add(series4);
this.chart.Series.Add(series5);
this.chart.Series.Add(series6);
this.chart.Size = new System.Drawing.Size(791, 635);
this.chart.Size = new System.Drawing.Size(791, 620);
this.chart.TabIndex = 0;
this.chart.Text = "chart";
this.chart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseClick);
//
// lbSpring
//
this.lbSpring.AutoSize = true;
this.lbSpring.Location = new System.Drawing.Point(12, 12);
this.lbSpring.Name = "lbSpring";
this.lbSpring.Size = new System.Drawing.Size(0, 12);
this.lbSpring.TabIndex = 1;
//
// PanelRadarGraph
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(815, 659);
this.ControlBox = false;
this.Controls.Add(this.lbSpring);
this.Controls.Add(this.chart);
this.HideOnClose = true;
this.Name = "PanelRadarGraph";
@@ -120,11 +130,13 @@
this.Text = "Radar Graph";
((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataVisualization.Charting.Chart chart;
private System.Windows.Forms.Label lbSpring;
}
}

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -27,6 +28,9 @@ namespace friction
m_Owner = owner;
m_DataHandler = data;
Theme.Apply(this);
chart.ChartAreas[0].AxisY.Maximum = 10;
chart.Series["SeriesHigh"].Color = Color.FromArgb(255, 200, 200, 200);
@@ -37,13 +41,14 @@ namespace friction
chart.Series["SeriesAvg"].Color = Theme.Yellow;
chart.Series["SeriesMin"].Color = Theme.Green;
chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Black;
chart.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
chart.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
chart.ChartAreas[0].AxisY.MajorTickMark.Enabled = true;
chart.ChartAreas[0].AxisY.MajorTickMark.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(50, 0, 0, 0);
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(150, 0, 0, 0);
chart.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;
foreach (var series in chart.Series)
@@ -61,6 +66,10 @@ namespace friction
if (m_CurSpring == strSpring)
return;
lbSpring.Text = "Material Spring: " + strSpring;
lbSpring.BackColor = Color.Transparent;
lbSpring.ForeColor = Color.Orange;
foreach (var series in chart.Series)
series.Points.Clear();
@@ -78,14 +87,19 @@ namespace friction
chart.Series["SeriesHigh"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.HIGH);
chart.Series["SeriesPotential"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.POTENTIAL);
chart.Series["SeriesNo"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.NO);
//break;
}
m_CurSpring = strSpring;
}
public Bitmap CopyChart()
{
MemoryStream ms = new MemoryStream();
chart.SaveImage(ms, ChartImageFormat.Bmp);
Bitmap bm = new Bitmap(ms);
return bm;
}
private void chart_MouseClick(object sender, MouseEventArgs e)
{
HitTestResult result = chart.HitTest(e.X, e.Y);

View File

@@ -4,7 +4,6 @@ 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,9 +25,6 @@ namespace friction
Theme.Apply(dgvData);
Theme.Apply(lvColumn);
typeof(DataGridView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, dgvData, new object[] { true });
dgvData.CellFormatting += DgvData_CellFormatting;
}
@@ -51,12 +47,10 @@ namespace friction
dgvData.DataSource = data.GetData();
dgvData.DefaultCellStyle.Format = "N2";
Dictionary<string, bool> CacheChecked = new Dictionary<string, bool>();
foreach (ListViewItem item in lvColumn.Items)
if(lvColumn.Items.Count > 0)
{
string key = item.SubItems[0].Text;
bool bChecked = item.Checked;
CacheChecked.Add(key, bChecked);
Config.OPTION.CheckedColumns = GetCheckedColumns();
Config.OPTION.UncheckedColumns = GetUncheckedColumns();
}
lvColumn.Items.Clear();
@@ -68,8 +62,11 @@ namespace friction
{
ListViewItem item = new ListViewItem(new string[] { col });
item.Text = col;
if (CacheChecked.ContainsKey(col) == true)
item.Checked = CacheChecked[col];
if(Config.OPTION.CheckedColumns != null && Config.OPTION.CheckedColumns.Exists(s => s==col) == true)
item.Checked = true;
else if(Config.OPTION.UncheckedColumns != null && Config.OPTION.UncheckedColumns.Exists(s => s == col) == true)
item.Checked = false;
else if (iGroup == 0)
item.Checked = true;
else
@@ -135,7 +132,72 @@ namespace friction
row.Selected = true;
dgvData.FirstDisplayedScrollingRowIndex = row.Index;
}
}
public void SelectRowByForce(string strSpring, string strTable, float fForce, float fRPN)
{
dgvData.ClearSelection();
DataGridViewRow row = dgvData.Rows
.Cast<DataGridViewRow>()
.Where(r =>
r.Cells[Config.COLUMN_NAME.SPRING].Value.Equals(strSpring) &&
r.Cells[Config.COLUMN_NAME.TABLE].Value.Equals(strTable) &&
r.Cells[Config.COLUMN_NAME.RPN].Value.Equals(fRPN) &&
r.Cells[Config.COLUMN_NAME.FORCE].Value.Equals(fForce)
)
.First();
if (row != null)
{
row.Selected = true;
dgvData.FirstDisplayedScrollingRowIndex = row.Index;
}
}
public void SelectRowByVelocity(string strSpring, string strTable, float fVelocity, float fRPN)
{
dgvData.ClearSelection();
DataGridViewRow row = dgvData.Rows
.Cast<DataGridViewRow>()
.Where(r =>
r.Cells[Config.COLUMN_NAME.SPRING].Value.Equals(strSpring) &&
r.Cells[Config.COLUMN_NAME.TABLE].Value.Equals(strTable) &&
r.Cells[Config.COLUMN_NAME.RPN].Value.Equals(fRPN) &&
r.Cells[Config.COLUMN_NAME.VELOCITY].Value.Equals(fVelocity)
)
.First();
if (row != null)
{
row.Selected = true;
dgvData.FirstDisplayedScrollingRowIndex = row.Index;
}
}
public List<string> GetCheckedColumns()
{
List<string> result = new List<string>();
foreach(ListViewItem item in lvColumn.Items)
{
if (item.Checked == true)
result.Add(item.Text);
}
return result;
}
public List<string> GetUncheckedColumns()
{
List<string> result = new List<string>();
foreach (ListViewItem item in lvColumn.Items)
{
if (item.Checked == false)
result.Add(item.Text);
}
return result;
}
}
}

View File

@@ -32,19 +32,22 @@
this.rbHumidity = new System.Windows.Forms.RadioButton();
this.rbTemp = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbVelocity = new System.Windows.Forms.RadioButton();
this.rbForce = new System.Windows.Forms.RadioButton();
this.panelGraph = new System.Windows.Forms.Panel();
this.groupBox1.SuspendLayout();
this.panelGraph.SuspendLayout();
this.SuspendLayout();
//
// trendChart
//
this.trendChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.trendChart.Location = new System.Drawing.Point(8, 59);
this.trendChart.Dock = System.Windows.Forms.DockStyle.Fill;
this.trendChart.Location = new System.Drawing.Point(0, 0);
this.trendChart.Name = "trendChart";
this.trendChart.Size = new System.Drawing.Size(742, 603);
this.trendChart.TabIndex = 0;
this.trendChart.Text = "trendChart";
this.trendChart.UpdaterTick += new LiveCharts.Events.UpdaterTickHandler(this.trendChart_UpdaterTick);
//
// rbHumidity
//
@@ -77,23 +80,62 @@
// groupBox1
//
this.groupBox1.Controls.Add(this.rbHumidity);
this.groupBox1.Controls.Add(this.rbVelocity);
this.groupBox1.Controls.Add(this.rbForce);
this.groupBox1.Controls.Add(this.rbTemp);
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(171, 50);
this.groupBox1.Size = new System.Drawing.Size(297, 50);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Data";
//
// rbVelocity
//
this.rbVelocity.Appearance = System.Windows.Forms.Appearance.Button;
this.rbVelocity.AutoSize = true;
this.rbVelocity.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rbVelocity.Location = new System.Drawing.Point(226, 19);
this.rbVelocity.Name = "rbVelocity";
this.rbVelocity.Size = new System.Drawing.Size(62, 24);
this.rbVelocity.TabIndex = 1;
this.rbVelocity.Text = "Velocity";
this.rbVelocity.UseVisualStyleBackColor = true;
this.rbVelocity.CheckedChanged += new System.EventHandler(this.rbVelocity_CheckedChanged);
//
// rbForce
//
this.rbForce.Appearance = System.Windows.Forms.Appearance.Button;
this.rbForce.AutoSize = true;
this.rbForce.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.rbForce.Location = new System.Drawing.Point(171, 20);
this.rbForce.Name = "rbForce";
this.rbForce.Size = new System.Drawing.Size(49, 24);
this.rbForce.TabIndex = 1;
this.rbForce.Text = "Force";
this.rbForce.UseVisualStyleBackColor = true;
this.rbForce.CheckedChanged += new System.EventHandler(this.rbForce_CheckedChanged);
//
// panelGraph
//
this.panelGraph.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelGraph.Controls.Add(this.trendChart);
this.panelGraph.Location = new System.Drawing.Point(8, 59);
this.panelGraph.Name = "panelGraph";
this.panelGraph.Size = new System.Drawing.Size(742, 603);
this.panelGraph.TabIndex = 3;
//
// PanelTrendGraph
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(762, 674);
this.ControlBox = false;
this.Controls.Add(this.panelGraph);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.trendChart);
this.HideOnClose = true;
this.Name = "PanelTrendGraph";
this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
@@ -101,6 +143,7 @@
this.Text = "Trend Graph";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.panelGraph.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -111,5 +154,8 @@
private System.Windows.Forms.RadioButton rbHumidity;
private System.Windows.Forms.RadioButton rbTemp;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rbVelocity;
private System.Windows.Forms.RadioButton rbForce;
private System.Windows.Forms.Panel panelGraph;
}
}

View File

@@ -13,17 +13,32 @@ using LiveCharts.Wpf;
using LiveCharts.WinForms;
using LiveCharts.Defaults;
using System.Windows.Media;
using System.Timers;
namespace friction
{
public partial class PanelTrendGraph : DockContent
{
public enum GRAPH_TYPE
{
NONE,
HUMIDITY,
TEMPERATURE,
FORCE,
VELOCITY
}
MainForm m_Owner = null;
DataHandler m_DataHandler = null;
string m_CurSpring = "";
string m_CurTable = "";
bool m_bHumidity = false;
GRAPH_TYPE m_GraphType = GRAPH_TYPE.NONE;
// for report
bool m_bReport = false;
System.Windows.Forms.Timer m_ReportTimer = null;
public PanelTrendGraph(MainForm owner, DataHandler data)
{
@@ -40,6 +55,7 @@ namespace friction
Theme.Apply(rbTemp);
trendChart.AxisX.Add(new Axis
{
Title = "Humidity",
@@ -65,7 +81,6 @@ namespace friction
},
new AxisSection
{
//Label = "Good",
Value = 3,
SectionWidth = 2,
Fill = new SolidColorBrush
@@ -76,7 +91,6 @@ namespace friction
},
new AxisSection
{
//Label = "Bad",
Value = 0,
SectionWidth = 3,
Fill = new SolidColorBrush
@@ -100,111 +114,97 @@ namespace friction
{
m_CurSpring = "";
m_CurTable = "";
m_bHumidity = false;
m_GraphType = GRAPH_TYPE.NONE;
}
private void TrendChart_DataClick(object sender, ChartPoint chartPoint)
{
if (m_bHumidity == true)
m_Owner.OnTrendSelectByHumidity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
else
m_Owner.OnTrendSelectByTemperature(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
switch (m_GraphType)
{
case GRAPH_TYPE.HUMIDITY:
m_Owner.OnTrendSelectByHumidity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
break;
case GRAPH_TYPE.TEMPERATURE:
m_Owner.OnTrendSelectByTemperature(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
break;
case GRAPH_TYPE.FORCE:
m_Owner.OnTrendSelectByForce(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
break;
case GRAPH_TYPE.VELOCITY:
m_Owner.OnTrendSelectByVelocity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y);
break;
}
}
public void UpdateGraph()
private void UpdateGraphHumidity()
{
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
Console.WriteLine(string.Format("[start] TrendGraph::UpdateGraph ({0}, {1}) -> ({2}, {3})",
m_CurSpring, m_CurTable, strSpring, strTable));
if (m_CurSpring == strSpring && m_CurTable == strTable
&& rbHumidity.Checked == m_bHumidity
&& m_bHumidity == rbHumidity.Checked)
{
return;
}
var Chart = m_DataHandler.GetHumidityChart(strSpring, strTable);
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0)
{
foreach(Series series in trendChart.Series)
series.Values.Clear();
m_CurSpring = strSpring;
m_CurTable = strTable;
m_bHumidity = rbHumidity.Checked;
return;
}
string strTitle = "";
double dMin = 0;
double dMax = 0;
if (rbHumidity.Checked == true)
{
strTitle = "Humidity";
trendChart.AxisX[0].Title = "Humidity";
trendChart.AxisX[0].Title = strTitle;
ChartValues<ScatterPoint>[] Points = {
ChartValues<ScatterPoint>[] Points = {
new ChartValues<ScatterPoint>(),
new ChartValues<ScatterPoint>(),
new ChartValues<ScatterPoint>() };
var Values = new List<TrendLine.POINT>();
var Values = new List<TrendLine.POINT>();
foreach (var pnt in Chart)
{
if(pnt.TEMPERATURE < 0)
Points[0].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2));
else if(pnt.TEMPERATURE > 30)
Points[2].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2));
else
Points[1].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2));
foreach (var pnt in Chart)
{
if (pnt.TEMPERATURE < 0)
Points[0].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2));
else if (pnt.TEMPERATURE > 30)
Points[2].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2));
else
Points[1].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2));
Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN });
}
Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN });
}
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
System.Windows.Media.SolidColorBrush[] brushes = {
System.Windows.Media.SolidColorBrush[] brushes = {
System.Windows.Media.Brushes.DodgerBlue.Clone(),
System.Windows.Media.Brushes.Green.Clone(),
System.Windows.Media.Brushes.IndianRed.Clone() };
foreach (var brush in brushes)
brush.Opacity = 0.75;
foreach (var brush in brushes)
brush.Opacity = 0.75;
trendChart.Series = new SeriesCollection
trendChart.Series = new SeriesCollection
{
new ScatterSeries
{
Title = "~ 0℃",
Title = "Low Temp",
Values = Points[0],
Fill = brushes[0],
Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255)),
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new ScatterSeries
{
Title = "0℃ ~ 30℃",
Title = "Mid Temp",
Values = Points[1],
Fill = brushes[1],
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new ScatterSeries
{
Title = "30℃ ~",
Title = "High Temp",
Values = Points[2],
Fill = brushes[2],
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new LineSeries
{
@@ -216,83 +216,272 @@ namespace friction
};
dMin = Chart.Min(r => r.HUMIDITY - 1);
dMax = Chart.Max(r => r.HUMIDITY - 1);
}
else if(rbTemp.Checked == true)
{
strTitle = "Temperature";
trendChart.AxisX[0].Title = strTitle;
ChartValues<ScatterPoint>[] Points = {
new ChartValues<ScatterPoint>(),
new ChartValues<ScatterPoint>() };
var Values = new List<TrendLine.POINT>();
foreach (var pnt in Chart)
{
if(pnt.HUMIDITY <= 60)
Points[0].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2));
else
Points[1].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2));
Values.Add(new TrendLine.POINT { X = pnt.TEMPERATURE, Y = pnt.RPN });
}
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X<b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
trendChart.Series = new SeriesCollection
{
new ScatterSeries
{
Title = "~ 60%",
Values = Points[0],
Foreground = System.Windows.Media.Brushes.SkyBlue,
},
new ScatterSeries
{
Title = "60% ~",
Values = Points[1],
Foreground = System.Windows.Media.Brushes.DarkBlue,
},
new LineSeries
{
Title = "Trend",
Values = TrendPoints,
PointGeometry = DefaultGeometries.None,
StrokeThickness = 4,
},
};
dMin = Chart.Min(r => r.TEMPERATURE - 1);
dMax = Chart.Max(r => r.TEMPERATURE - 1);
}
trendChart.AxisX[0].MinValue = dMin;
trendChart.AxisX[0].MaxValue = dMax;
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
m_CurSpring = strSpring;
m_CurTable = strTable;
m_bHumidity = rbHumidity.Checked;
}
Console.WriteLine(string.Format("[end ] TrendGraph::UpdateGraph({0}, {1})", strSpring, strTable));
private void UpdateGraphTemperature()
{
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0)
return;
trendChart.AxisX[0].Title = "Temperature";
ChartValues<ScatterPoint>[] Points = {
new ChartValues<ScatterPoint>(),
new ChartValues<ScatterPoint>() };
var Values = new List<TrendLine.POINT>();
foreach (var pnt in Chart)
{
if (pnt.HUMIDITY <= 60)
Points[0].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2));
else
Points[1].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2));
Values.Add(new TrendLine.POINT { X = pnt.TEMPERATURE, Y = pnt.RPN });
}
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
trendChart.Series = new SeriesCollection
{
new ScatterSeries
{
Title = "Low Humidity",
Values = Points[0],
Foreground = System.Windows.Media.Brushes.SkyBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new ScatterSeries
{
Title = "High Humidity",
Values = Points[1],
Foreground = System.Windows.Media.Brushes.DarkBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new LineSeries
{
Title = "Trend",
Values = TrendPoints,
PointGeometry = DefaultGeometries.None,
StrokeThickness = 4,
},
};
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
}
private void UpdateGraphForce()
{
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0)
return;
trendChart.AxisX[0].Title = "Force";
var Points = new ChartValues<ScatterPoint>();
var Values = new List<TrendLine.POINT>();
foreach (var pnt in Chart)
{
Points.Add(new ScatterPoint(pnt.FORCE, pnt.RPN, 2));
Values.Add(new TrendLine.POINT { X = pnt.FORCE, Y = pnt.RPN });
}
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
trendChart.Series = new SeriesCollection
{
new ScatterSeries
{
Title = "RPN by force",
Values = Points,
Foreground = System.Windows.Media.Brushes.SkyBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new LineSeries
{
Title = "Trend",
Values = TrendPoints,
PointGeometry = DefaultGeometries.None,
StrokeThickness = 4,
},
};
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
}
private void UpdateGraphVelocity()
{
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
var Chart = m_DataHandler.GetTrendChart(strSpring, strTable);
if (Chart.Count <= 0)
return;
trendChart.AxisX[0].Title = "Velocity";
var Points = new ChartValues<ScatterPoint>();
var Values = new List<TrendLine.POINT>();
foreach (var pnt in Chart)
{
Points.Add(new ScatterPoint(pnt.VELOCITY, pnt.RPN, 2));
Values.Add(new TrendLine.POINT { X = pnt.VELOCITY, Y = pnt.RPN });
}
Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1);
TrendLine trendline = new TrendLine(Values);
ChartValues<ScatterPoint> TrendPoints = new ChartValues<ScatterPoint>();
TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X)));
TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X)));
trendChart.Series = new SeriesCollection
{
new ScatterSeries
{
Title = "RPN by velocity",
Values = Points,
Foreground = System.Windows.Media.Brushes.SkyBlue,
LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y),
},
new LineSeries
{
Title = "Trend",
Values = TrendPoints,
PointGeometry = DefaultGeometries.None,
StrokeThickness = 4,
},
};
trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1);
trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1);
}
public void UpdateGraph(GRAPH_TYPE Type=GRAPH_TYPE.NONE)
{
if (Type == GRAPH_TYPE.NONE)
{
if (rbHumidity.Checked == true)
UpdateGraph(GRAPH_TYPE.HUMIDITY);
else if (rbTemp.Checked == true)
UpdateGraph(GRAPH_TYPE.TEMPERATURE);
else if (rbForce.Checked == true)
UpdateGraph(GRAPH_TYPE.FORCE);
else if (rbVelocity.Checked == true)
UpdateGraph(GRAPH_TYPE.VELOCITY);
return;
}
string strSpring = m_DataHandler.GetCurSpring();
string strTable = m_DataHandler.GetCurTable();
switch (Type)
{
case GRAPH_TYPE.HUMIDITY:
UpdateGraphHumidity();
break;
case GRAPH_TYPE.TEMPERATURE:
UpdateGraphTemperature();
break;
case GRAPH_TYPE.FORCE:
UpdateGraphForce();
break;
case GRAPH_TYPE.VELOCITY:
UpdateGraphVelocity();
break;
}
m_CurSpring = strSpring;
m_CurTable = strTable;
m_GraphType = Type;
}
private void rbHumidity_CheckedChanged(object sender, EventArgs e)
{
UpdateGraph();
UpdateGraph(GRAPH_TYPE.HUMIDITY);
}
private void rbTemp_CheckedChanged(object sender, EventArgs e)
{
UpdateGraph();
UpdateGraph(GRAPH_TYPE.TEMPERATURE);
}
private void rbForce_CheckedChanged(object sender, EventArgs e)
{
UpdateGraph(GRAPH_TYPE.FORCE);
}
private void rbVelocity_CheckedChanged(object sender, EventArgs e)
{
UpdateGraph(GRAPH_TYPE.VELOCITY);
}
public void CopyChart(GRAPH_TYPE Type)
{
Cursor.Current = Cursors.WaitCursor;
m_bReport = true;
trendChart.DisableAnimations = true;
UpdateGraph(Type);
}
private void trendChart_UpdaterTick(object sender)
{
if(m_bReport == true)
{
Cursor.Current = Cursors.WaitCursor;
m_ReportTimer = new System.Windows.Forms.Timer();
m_ReportTimer.Interval = 500;
m_ReportTimer.Tick += new EventHandler(TimerCallback);
m_ReportTimer.Start();
Console.WriteLine("Chart Updated ({0})", m_GraphType);
}
}
private void TimerCallback(object sender, EventArgs e)
{
Console.WriteLine("Chart Timer Callback ({0})", m_GraphType);
m_bReport = false;
m_ReportTimer.Stop();
this.Invoke(new Action(() =>
{
Bitmap bm = new Bitmap(Width, Height);
panelGraph.DrawToBitmap(bm, new Rectangle(panelGraph.Left, panelGraph.Top, panelGraph.Width, panelGraph.Height));
m_Owner.OnChartUpdate(bm, m_GraphType);
}));
}
}
}

211
Report.cs Normal file
View File

@@ -0,0 +1,211 @@
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace friction
{
public class Report
{
public string FilePath { set; get; }
public string MaterialSpring { set; get; }
public string MaterialTable { set; get; }
public DataTable AnalysisData { set; get; }
public Bitmap RadarChart { set; get; }
public Bitmap TrendChartByHumidity { set; get; }
public Bitmap TrendChartByTemperature { set; get; }
public Bitmap TrendChartByForce { set; get; }
public Bitmap TrendChartByVelocity { set; get; }
public void Export()
{
using (ExcelPackage package = new ExcelPackage())
{
if (package.Workbook.Worksheets.Count < 1)
package.Workbook.Worksheets.Add("Report");
ExcelWorksheet Sheet = package.Workbook.Worksheets[1];
int iRow = 2;
int iCol = 2;
Sheet.Cells[iRow, iCol].Value = "Material Spring: " + MaterialSpring;
Sheet.Cells[iRow, iCol].Style.Font.Bold = true;
iRow += 1;
foreach(DataColumn column in AnalysisData.Columns)
{
Sheet.Cells[iRow, iCol].Value = column.ColumnName;
iCol++;
}
iRow++;
iCol = 2;
int iTableRowStart = iRow-1;
int iTableColStart = iCol;
double dValue;
int iNoOfTest = 0;
int iAvgRPNColumn = 1;
foreach(DataRow row in AnalysisData.Rows)
{
int.TryParse(row["No. of Tests"].ToString(), out iNoOfTest);
iCol = 2;
for (int i = 0; i < AnalysisData.Columns.Count; i++)
{
if(double.TryParse(row[i].ToString(), out dValue) == true)
{
Sheet.Cells[iRow, iCol].Value = dValue;
if(AnalysisData.Columns[i].ColumnName == "No. of Tests")
{
}
else if (AnalysisData.Columns[i].ColumnName == "Average RPN")
{
Sheet.Cells[iRow, iCol].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
var Risk = Config.ANALYSIS.GetRisk((float)dValue);
switch (Risk)
{
case Config.ANALYSIS.RISK.NO:
Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Green);
break;
case Config.ANALYSIS.RISK.POTENTIAL:
Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Yellow);
break;
case Config.ANALYSIS.RISK.HIGH:
Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Red);
break;
}
iAvgRPNColumn = iCol;
}
else
{
Sheet.Cells[iRow, iCol].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
var Dependancy = Config.ANALYSIS.GetDependancy((float)dValue, iNoOfTest);
switch (Dependancy)
{
case Config.ANALYSIS.DEPENDANCY.NO:
Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Green);
break;
case Config.ANALYSIS.DEPENDANCY.POTENTIAL:
Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Yellow);
break;
case Config.ANALYSIS.DEPENDANCY.HIGH:
Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Red);
break;
case Config.ANALYSIS.DEPENDANCY.NOT_ENNOUGH_DATA:
Sheet.Cells[iRow, iCol].Style.Fill.BackgroundColor.SetColor(Theme.Gray);
Sheet.Cells[iRow, iAvgRPNColumn].Style.Fill.BackgroundColor.SetColor(Theme.Gray);
break;
}
}
}
else
{
Sheet.Cells[iRow, iCol].Value = row[i].ToString();
}
iCol++;
}
iRow++;
}
Sheet.Cells[iTableRowStart, iTableColStart, iTableRowStart, iCol-1].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
Sheet.Cells[iTableRowStart, iTableColStart, iRow-1, iTableColStart].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
Sheet.Cells[iTableRowStart, iTableColStart, iRow-1, iCol-1].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thick);
Sheet.Cells[iTableRowStart, iTableColStart, iRow - 1, iCol - 1].AutoFitColumns();
iRow += 2;
iCol = 2;
double dX=0;
double dY=0;
for (int i = 1; i < iCol; i++)
dX += ExcelHelper.ColumnWidth2Pixel(Sheet, Sheet.Column(i).Width);
for (int i = 1; i < iRow; i++)
dY += ExcelHelper.RowHeight2Pixel(Sheet.Row(i).Height);
int iWidth = RadarChart.Width;
int iHeight = RadarChart.Height;
iHeight = iHeight * 800 / iWidth;
iWidth = 800;
var picRadarChart = Sheet.Drawings.AddPicture("Radar Chart", RadarChart);
picRadarChart.SetPosition((int)dY, (int)dX);
picRadarChart.SetSize(iWidth, iHeight);
dY += iHeight + 60;
if (TrendChartByHumidity != null)
{
Sheet.Cells[52, 2].Value = MaterialSpring + " vs " + MaterialTable;
Sheet.Cells[52, 2].Style.Font.Bold = true;
dY += 10;
var picTrendChartHumidity = Sheet.Drawings.AddPicture("Trend Chart by Humidity", TrendChartByHumidity);
picTrendChartHumidity.SetPosition((int)dY, (int)dX);
iWidth = TrendChartByHumidity.Width;
iHeight = TrendChartByHumidity.Height;
iHeight = iHeight * 390 / iWidth;
iWidth = 390;
picTrendChartHumidity.SetSize(iWidth, iHeight);
Sheet.Cells[64, 2].Value = "by Humidity";
dX += 400;
var picTrendChartTemperature = Sheet.Drawings.AddPicture("Trend Chart by Temperature", TrendChartByTemperature);
picTrendChartTemperature.SetPosition((int)dY, (int)dX);
iWidth = TrendChartByTemperature.Width;
iHeight = TrendChartByTemperature.Height;
iHeight = iHeight * 390 / iWidth;
iWidth = 390;
picTrendChartTemperature.SetSize(iWidth, iHeight);
Sheet.Cells[64, 6].Value = "by Temperature";
dX -= 400;
dY += iHeight + 10;
var picTrendChartForce = Sheet.Drawings.AddPicture("Trend Chart by Force", TrendChartByForce);
picTrendChartForce.SetPosition((int)dY, (int)dX);
iWidth = TrendChartByForce.Width;
iHeight = TrendChartByForce.Height;
iHeight = iHeight * 390 / iWidth;
iWidth = 390;
picTrendChartForce.SetSize(iWidth, iHeight);
Sheet.Cells[76, 2].Value = "by Force";
dX += 400;
var picTrendChartVelocity = Sheet.Drawings.AddPicture("Trend Chart by Velocity", TrendChartByVelocity);
picTrendChartVelocity.SetPosition((int)dY, (int)dX);
iWidth = TrendChartByVelocity.Width;
iHeight = TrendChartByVelocity.Height;
iHeight = iHeight * 390 / iWidth;
iWidth = 390;
picTrendChartVelocity.SetSize(iWidth, iHeight);
Sheet.Cells[76, 6].Value = "by Velocity";
}
package.SaveAs(new FileInfo(FilePath));
Console.WriteLine("Report Saved");
}
}
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -15,7 +16,6 @@ namespace friction
public static Color Forecolor = Color.FromArgb(255, 235, 235, 235);
public static Color Green = Color.LimeGreen;
//public static Color Yellow = Color.Gold;
public static Color Yellow = Color.FromArgb(255, 255, 165, 0);
public static Color Red = Color.OrangeRed;
public static Color Gray = Color.DarkGray;
@@ -37,6 +37,10 @@ namespace friction
ctrl.ColumnHeadersDefaultCellStyle.ForeColor = Forecolor;
ctrl.RowHeadersDefaultCellStyle.BackColor = Backcolor;
ctrl.RowHeadersDefaultCellStyle.ForeColor = Forecolor;
typeof(DataGridView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, ctrl, new object[] { true });
}
public static void Apply(ListView ctrl)
@@ -50,6 +54,10 @@ namespace friction
(sender, e) => ListViewHeaderDraw(sender, e, Backcolor, Forecolor)
);
ctrl.DrawItem += new DrawListViewItemEventHandler(ListViewBodyDraw);
typeof(ListView).InvokeMember("DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null, ctrl, new object[] { true });
}
private static void ListViewHeaderDraw(object sender, DrawListViewColumnHeaderEventArgs e, Color backColor, Color foreColor)

View File

@@ -71,8 +71,15 @@
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="AboutBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutBox.Designer.cs">
<DependentUpon>AboutBox.cs</DependentUpon>
</Compile>
<Compile Include="Config.cs" />
<Compile Include="DataHandler.cs" />
<Compile Include="ExcelHelper.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -85,6 +92,12 @@
<Compile Include="PanelAnalysis.Designer.cs">
<DependentUpon>PanelAnalysis.cs</DependentUpon>
</Compile>
<Compile Include="PanelCompatibility.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PanelCompatibility.Designer.cs">
<DependentUpon>PanelCompatibility.cs</DependentUpon>
</Compile>
<Compile Include="PanelRadarGraph.cs">
<SubType>Form</SubType>
</Compile>
@@ -111,14 +124,21 @@
<Compile Include="PanelMaterial.Designer.cs">
<DependentUpon>PanelMaterial.cs</DependentUpon>
</Compile>
<Compile Include="Report.cs" />
<Compile Include="Theme.cs" />
<Compile Include="TrendLine.cs" />
<EmbeddedResource Include="AboutBox.resx">
<DependentUpon>AboutBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PanelAnalysis.resx">
<DependentUpon>PanelAnalysis.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PanelCompatibility.resx">
<DependentUpon>PanelCompatibility.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="PanelRadarGraph.resx">
<DependentUpon>PanelRadarGraph.cs</DependentUpon>
</EmbeddedResource>

BIN
resource/map3.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB