From dedcf4174c8540ee3a912daad2ff13e014e495b1 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 28 三月 2025 16:28:30 +0800
Subject: [PATCH] 优化UI组件;
---
Plugin.TsExecution/SingleControl.xaml.cs | 52 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/Plugin.TsExecution/SingleControl.xaml.cs b/Plugin.TsExecution/SingleControl.xaml.cs
index efa58a4..2dc2d8e 100644
--- a/Plugin.TsExecution/SingleControl.xaml.cs
+++ b/Plugin.TsExecution/SingleControl.xaml.cs
@@ -1,4 +1,5 @@
锘縰sing HMI.Core.Util;
+using HMI.Util;
using NationalInstruments.TestStand.Interop.API;
using System;
using System.ComponentModel;
@@ -35,7 +36,7 @@
#endregion
private bool isLoadOK = false;
private int index;
- private string counterFilePath;
+ private string CountIniPath;
private string status = "Ready";
@@ -89,13 +90,6 @@
get => this.lang("Ts.TestInfo", Barcode, ElapseTime);
}
- private string currentStep;
- public string CurrentStep
- {
- get { return currentStep; }
- set { Set(ref currentStep, value); }
- }
-
private string barcode = string.Empty;
public string Barcode
{
@@ -133,8 +127,19 @@
private DataTable dt;
- public SingleControl(int Index, int passNum, int failNum)
+ private string currentStep = "绛夊緟鎵爜";
+ public string CurrentStep
{
+ get => currentStep;
+ set
+ {
+ Set(ref currentStep, value);
+ }
+ }
+
+ public SingleControl(int Index, string CountIniPath)
+ {
+ this.CountIniPath = CountIniPath;
DataContext = this;
this.index = Index;
PassNum = passNum;
@@ -219,13 +224,13 @@
/// <param name="ProcessVal"></param>
public void SetTestProcess(int ProcessVal)
{
- //this.TestProcess.Value = ProcessVal;
- //this.TestProcessLabel.Text = ProcessVal.ToString() + "%";
- //this.TestProcessLabel.BackColor = Color.Transparent;
+ this.testProcess.Value = ProcessVal;
+ this.testProcessLabel.Content = ProcessVal.ToString() + "%";
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
+ ReadCounter();
this.UpdateTestCounter(null);
}
@@ -243,7 +248,7 @@
TotalNum = PassNum + FailNum;
if (TotalNum != 0)
{
- PassRate = (PassNum / TotalNum) * 100;
+ PassRate = (PassNum / TotalNum);
}
else
{
@@ -255,14 +260,31 @@
private void WriteCounter()
{
+ IniFileHelper.WriteIniData("Socket" + this.index.ToString(), "Pass",
+ this.passNum.ToString(), this.CountIniPath);
+ IniFileHelper.WriteIniData("Socket" + this.index.ToString(), "Fail", this.failNum.ToString(),
+ this.CountIniPath);
+ }
+ private void ReadCounter()
+ {
+ try
+ {
+ this.passNum = Convert.ToInt32(IniFileHelper.ReadIniData("Socket" + this.index.ToString(), "Pass", "", CountIniPath));
+ this.failNum = Convert.ToInt32(IniFileHelper.ReadIniData("Socket" + this.index.ToString(), "Fail", "", CountIniPath));
+ }
+ catch (Exception ex)
+ {
+ //do nothing
+ }
}
public void ResetCounter()
{
- PassNum = 0;
- FailNum = 0;
+ this.passNum = 0;
+ this.failNum = 0;
this.UpdateTestCounter(null);
}
+
}
}
--
Gitblit v1.9.1