duheng
2024-09-22 9ffb31c233f3b4891550293294c2ee716f77b42a
WinFrmUI/HStation.WinFrmUI.Xhs.Core/04-simulation/06-simulation/01-AutoMatching/AssetsAutoMatchingMainDlg.cs
@@ -5,15 +5,47 @@
        public AssetsAutoMatchingMainDlg()
        {
            InitializeComponent();
            this.AssetsMainChoicePage.FormRowClickEvent += AssetsMainChoicePage_FormRowClickEvent;
        }
        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 async void BtnAutoMatching_Click(object sender, EventArgs e)
        {
            WaitFormHelper.ShowWaitForm(this);
            _assetsAutoMatching = await this.AssetsMainChoicePage.SetMatching(_assetsAutoMatching);
            WaitFormHelper.HideWaitForm(this);
        }
    }
}