INT_LKD_2/INT_LKD_2/Controls/MainDisplay/ControlMainResult.cs

166 lines
5.4 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SmartX;
using INT_LKD_2.DataStore;
using INT_LKD_2.Forms;
namespace INT_LKD_2.Controls.MainDisplay
{
public partial class ControlMainResult : UserControl
{
#region Field
private FormMainDisplay m_ParentForm;
private Color ColorResultPass;
private Color ColorResultNG;
private Color ColorResultNone;
#endregion
#region Constructor
public ControlMainResult(FormMainDisplay parent)
{
InitializeComponent();
this.ParentForm = parent;
this.Initialize();
}
#endregion
#region Property
public FormMainDisplay ParentForm
{
get { return this.m_ParentForm; }
set { this.m_ParentForm = value; }
}
#endregion
#region Method
private void Initialize()
{
this.ColorResultPass = Color.FromArgb(39, 200, 64);
this.ColorResultNG = Color.FromArgb(254, 70, 70);
this.ColorResultNone = Color.FromArgb(42, 43, 45);
}
private void GetJudgmentResult(Define.E_JudgmentStatus judg, SmartLabel label)
{
string value = "";
switch (judg)
{
case Define.E_JudgmentStatus.None:
value = "-";
label.BackGroundColor = this.ColorResultNone;
break;
case Define.E_JudgmentStatus.Pass:
value = "Pass";
label.BackGroundColor = this.ColorResultPass;
break;
case Define.E_JudgmentStatus.Ng:
value = "Leak";
label.BackGroundColor = this.ColorResultNG;
break;
case Define.E_JudgmentStatus.Empty:
value = "Empty";
label.BackGroundColor = this.ColorResultNone;
break;
case Define.E_JudgmentStatus.Error:
value = "Error";
label.BackGroundColor = this.ColorResultNone;
break;
default:
break;
}
if (label.Text != value)
label.Text = value;
}
private void GetJudgmentResultDiff(Define.E_JudgmentStatus judg, SmartLabel label)
{
string value = "Diff";
switch (judg)
{
case Define.E_JudgmentStatus.None:
label.TextColor = Color.Gainsboro;
break;
case Define.E_JudgmentStatus.Pass:
label.TextColor = this.ColorResultPass;
break;
case Define.E_JudgmentStatus.Ng:
label.TextColor = this.ColorResultNG;
break;
case Define.E_JudgmentStatus.Empty:
label.TextColor = Color.Gainsboro;
break;
case Define.E_JudgmentStatus.Error:
label.TextColor = Color.Gainsboro;
break;
default:
break;
}
if (label.Text != value)
label.Text = value;
}
private void GetJudgmentResultDisp(Define.E_JudgmentStatus judg, SmartLabel label)
{
string value = "Disp";
switch (judg)
{
case Define.E_JudgmentStatus.None:
label.TextColor = Color.Gainsboro;
break;
case Define.E_JudgmentStatus.Pass:
label.TextColor = this.ColorResultPass;
break;
case Define.E_JudgmentStatus.Ng:
label.TextColor = this.ColorResultNG;
break;
case Define.E_JudgmentStatus.Empty:
label.TextColor = Color.Gainsboro;
break;
case Define.E_JudgmentStatus.Error:
label.TextColor = Color.Gainsboro;
break;
default:
break;
}
if (label.Text != value)
label.Text = value;
}
public void SetResult(LeakResult result)
{
this.GetJudgmentResult(result.Result, this.labelResult);
if (result.Result == Define.E_JudgmentStatus.Empty || result.Result == Define.E_JudgmentStatus.Error)
{
this.GetJudgmentResultDiff(Define.E_JudgmentStatus.Empty, this.labelResultDiff);
this.GetJudgmentResultDisp(Define.E_JudgmentStatus.Empty, this.labelResultDisp);
}
else
{
this.GetJudgmentResultDiff(result.DIFF_Result, this.labelResultDiff);
this.GetJudgmentResultDisp(result.DISP_Result, this.labelResultDisp);
}
}
public void SetResultTestMode(Define.E_JudgmentStatus judg, Define.E_JudgmentStatus diff, Define.E_JudgmentStatus disp)
{
this.GetJudgmentResult(judg, this.labelResult);
this.GetJudgmentResultDiff(diff, this.labelResultDiff);
this.GetJudgmentResultDisp(disp, this.labelResultDisp);
}
#endregion
}
}