From 9ffb31c233f3b4891550293294c2ee716f77b42a Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期日, 22 九月 2024 19:08:49 +0800
Subject: [PATCH] 完善自动匹配

---
 WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.cs |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.cs
index 9eb376e..f65d8f1 100644
--- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.cs
@@ -2,28 +2,49 @@
 {
     public partial class AssetsAutoMatchingMainDlg : DevExpress.XtraEditors.XtraForm
     {
-        public AssetsAutoMatchingMainDlg(AssetsAutoMatchingInputViewModel assetsAutoMatchingInputViewModel)
+        public AssetsAutoMatchingMainDlg()
         {
-            _assetsAutoMatching = assetsAutoMatchingInputViewModel;
             InitializeComponent();
+            this.AssetsMainChoicePage.FormRowClickEvent += AssetsMainChoicePage_FormRowClickEvent;
         }
 
-        private AssetsAutoMatchingInputViewModel _assetsAutoMatching = null;
-
-        public void SetBindingData()
+        private void AssetsMainChoicePage_FormRowClickEvent(string code)
         {
+            AssetsMatchingClickEvent.Invoke(code);
+        }
+
+        public event Func<AssetsAutoMatchingViewModel, bool> RelaodEvent = null;
+
+        public event Action<string> AssetsMatchingClickEvent = null;
+
+        private AssetsAutoMatchingViewModel _assetsAutoMatching = null;
+
+        public void SetBindingData(AssetsAutoMatchingViewModel assetsAutoMatchingInputViewModel)
+        {
+            _assetsAutoMatching = assetsAutoMatchingInputViewModel;
+            this.AssetsMainChoicePage.SetBindingData(_assetsAutoMatching);
         }
 
         //瀹屾垚
         private void btnComplete_Click(object sender, EventArgs e)
         {
+            if (RelaodEvent.Invoke(_assetsAutoMatching))
+            {
+                TipFormHelper.ShowSucceed("淇敼鎴愬姛!");
+            }
+            else
+            {
+                TipFormHelper.ShowError("淇敼澶辫触!");
+            }
+            this.DialogResult = DialogResult.OK;
+            this.Close();
         }
 
         //鑷姩鍖归厤
-        private void BtnAutoMatching_Click(object sender, EventArgs e)
+        private async void BtnAutoMatching_Click(object sender, EventArgs e)
         {
             WaitFormHelper.ShowWaitForm(this);
-            this.AssetsMainChoicePage.SetMatching(_assetsAutoMatching);
+            _assetsAutoMatching = await this.AssetsMainChoicePage.SetMatching(_assetsAutoMatching);
             WaitFormHelper.HideWaitForm(this);
         }
     }

--
Gitblit v1.9.3