alielie
2025-03-17 c401a2f2fd1a509cdeb33e850bb5c2827074af48
Plugin.TestResult/ViewControl.xaml.cs
@@ -2,6 +2,7 @@
using HMI.Core.Util;
using HMI.ParameterManage.Entity;
using HMI.ParameterManage.Util;
using HMI.UI;
using HMI.UI.Util;
using log4net;
using NationalInstruments.TestStand.Interop.API;
@@ -10,6 +11,8 @@
using Plugin.TestResult_WPF.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@@ -70,6 +73,21 @@
            testResultView.testApp.ExecutionClosed += new _ApplicationMgrEvents_ExecutionClosedEventHandler(this.axApplicationMgr_ExecutionClosed);
        }
        public override void InitFinish()
        {
            base.InitFinish();
            string path = Path.Combine(BaseFolder, "Count.ini");
            testResultView.SetCountIniPath(path);
            testResultView.InitMainGrid();
            LoadProduct();
            testResultView.InitTestStandEngine();
        }
        public override void DoClose(object sender, EventArgs e)
        {
            testResultView.ReleaseResource();
        }
        private void axApplicationMgr_ExitApplication(object sender, EventArgs e)
        {
        }
@@ -116,17 +134,31 @@
            { }
        }
        private bool isLoaded;
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            LoadProduct();
            testResultView.InitTestStandEngine();
            Start_Click(null, null);
            Loaded -= UserControl_Loaded;
            new MaskWindow(Window.GetWindow(this),
                (win) =>
                {
                    Dispatcher.Invoke(() =>
                    {
                        try
                        {
                            Start_Click(null, null);
                            Loaded -= UserControl_Loaded;
                        }
                        finally
                        {
                            win.Close();
                        }
                    });
                }).Info(LangUtil.Get("Ts.SequenceIsStarting"));
        }
        public void LoadProduct()
        {
            List<ProductData> products = ParameterManager.GetProducts<List<ProductData>>();
            List<ProductData> products = ParameterManager.GetProducts<List<ProductData>>()
                ?? new List<ProductData>();
            this.modelSelect.Items.Clear();
            foreach (var prd in products)
            {
@@ -270,6 +302,16 @@
        {
        }
        /// <summary>
        /// 计数清零按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnClear_Click(object sender, RoutedEventArgs e)
        {
            testResultView.ClearNumber();
        }
    }
}