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.DataStore; using INT_LKD.Forms; namespace INT_LKD.Controls.MainDisplay { public partial class ControlMainResult10 : UserControl { #region Field private FormMainDisplay m_ParentForm; private Color ColorResultPass; private Color ColorResultNG; private Color ColorResultNone; #endregion #region Constructor public ControlMainResult10(FormMainDisplay parent) { InitializeComponent(); this.ParentForm = parent; this.Initialize(); this.InitializeDesign(); } #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); } public void InitializeDesign() { switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE) { case Define.E_LanguageID.Chinese: this.labelResultDiff.Text = "压差"; this.labelResultDisp.Text = "位移"; break; default: this.labelResultDiff.Text = "Diff"; this.labelResultDisp.Text = "Disp"; break; } } 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: switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE) { case Define.E_LanguageID.Chinese: value = "标准"; break; default: value = "Pass"; break; } label.BackGroundColor = this.ColorResultPass; break; case Define.E_JudgmentStatus.Ng: switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE) { case Define.E_LanguageID.Chinese: value = "泄漏"; break; default: value = "Leak"; break; } label.BackGroundColor = this.ColorResultNG; break; case Define.E_JudgmentStatus.Empty: switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE) { case Define.E_LanguageID.Chinese: value = "空的"; break; default: value = "Empty"; break; } label.BackGroundColor = this.ColorResultNone; break; case Define.E_JudgmentStatus.Error: switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE) { case Define.E_LanguageID.Chinese: value = "错误"; break; default: value = "Error"; break; } 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; switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE) { case Define.E_LanguageID.Chinese: value = "压差"; break; default: value = "Diff"; break; } 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; switch (this.ParentForm.ParentForm.SystemConfig.LANGUAGE) { case Define.E_LanguageID.Chinese: value = "位移"; break; default: value = "Disp"; break; } 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 } }