From 3a471ae651b228231bebb3a2d438baa1d4ac0261 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期五, 21 十一月 2025 08:57:52 +0800
Subject: [PATCH] 优化
---
Plugin.TsExecution/SingleControl.xaml.cs | 60 +++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/Plugin.TsExecution/SingleControl.xaml.cs b/Plugin.TsExecution/SingleControl.xaml.cs
index 33afb58..8c3aec9 100644
--- a/Plugin.TsExecution/SingleControl.xaml.cs
+++ b/Plugin.TsExecution/SingleControl.xaml.cs
@@ -1,7 +1,5 @@
锘縰sing HMI.Core.Manager;
using HMI.Core.Util;
-using HMI.UI;
-using HMI.UI.Util;
using HMI.Util;
using NationalInstruments.TestStand.Interop.API;
using Plugin.TsExecution.Entity;
@@ -10,10 +8,10 @@
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
-using System.Threading;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Media;
namespace Plugin.TsExecution
{
@@ -27,7 +25,6 @@
protected void Set([CallerMemberName] string name = null)
{
-
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
@@ -103,6 +100,13 @@
set { Set(ref barcode, value); }
}
+ private string model = string.Empty;
+ public string Model
+ {
+ get { return model; }
+ set { Set(ref model, value); }
+ }
+
private string elapseTime = "00:00:00";
public string ElapseTime
{
@@ -112,7 +116,8 @@
if (value == "Start Timing")
{
this.refreshTimer.Enabled = true;
- TimeNow = DateTime.Now;
+ TestStartTime = DateTime.Now;
+ StepStartTime = DateTime.Now;
}
else
{
@@ -136,7 +141,8 @@
}
}
- private DateTime TimeNow = new DateTime();
+ private DateTime TestStartTime = new DateTime();
+ private DateTime StepStartTime = new DateTime();
private TimeSpan TimeCount = new TimeSpan();
private System.Timers.Timer refreshTimer;
@@ -214,8 +220,8 @@
public SingleControl(int Index, string CountIniPath, int probeWarn)
{
- this.CountIniPath = CountIniPath;
DataContext = this;
+ this.CountIniPath = CountIniPath;
this.index = Index;
ProbeWarn = probeWarn;
@@ -266,7 +272,7 @@
//AddTestData("1", "1", "1", "1", "1", "1", "1");
- TimeCount = DateTime.Now - TimeNow;
+ TimeCount = DateTime.Now - TestStartTime;
elapseTime = string.Format("{0:00}:{1:00}:{2:00}", TimeCount.Hours, TimeCount.Minutes, TimeCount.Seconds);
Set("ElapseTime");
Set("TestInfo");
@@ -297,8 +303,12 @@
Unit = unit,
Result = Status
};
- Dispatcher.BeginInvoke(new Action(() =>
+ table.Dispatcher.Invoke(new Action(() =>
{
+ var now = DateTime.Now;
+ var span = now - StepStartTime;
+ StepStartTime = now;
+ data.ConsumeTime = $"{(span.TotalMilliseconds / 1000d).ToString("F2")}s";
Datasource.Add(data);
table.ScrollIntoView(data);
}));
@@ -506,22 +516,22 @@
}
public void ShowScannerPanel()
{
- scannerPanel.Visibility = Visibility.Visible;
+ //scannerPanel.Visibility = Visibility.Visible;
}
private void SendSnr2Ts()
{
- try
- {
- string snr = TbManualSnr.Text;
- SequenceFileContext?.StationGlobals.SetValString($"StationState.SN[{index}]", 1, snr);
- scannerPanel.Visibility = Visibility.Collapsed;
- TbManualSnr.Text = string.Empty;
- }
- catch (Exception ex)
- {
- ToastHelper.Error(ex.Message);
- }
+ //try
+ //{
+ // string snr = TbManualSnr.Text;
+ // SequenceFileContext?.StationGlobals.SetValString($"StationState.SN[{index}]", 1, snr);
+ // scannerPanel.Visibility = Visibility.Collapsed;
+ // TbManualSnr.Text = string.Empty;
+ //}
+ //catch (Exception ex)
+ //{
+ // ToastHelper.Error(ex.Message);
+ //}
}
private void pausePanel_Loaded(object sender, RoutedEventArgs e)
@@ -535,10 +545,10 @@
}
else
{
- var can = scannerPanel;
- var modal = scannerVisualModal;
- Canvas.SetLeft(modal, (scannerPanel.ActualWidth - scannerVisualModal.ActualWidth) / 2);
- Canvas.SetTop(modal, (scannerPanel.ActualHeight - scannerVisualModal.ActualHeight) / 2);
+ //var can = scannerPanel;
+ //var modal = scannerVisualModal;
+ //Canvas.SetLeft(modal, (scannerPanel.ActualWidth - scannerVisualModal.ActualWidth) / 2);
+ //Canvas.SetTop(modal, (scannerPanel.ActualHeight - scannerVisualModal.ActualHeight) / 2);
}
}
}
--
Gitblit v1.9.1