From 9d1660270272180cd71147d6ddd53d1382643d2e Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 18:00:14 +0800
Subject: [PATCH] merge: 并入远程 Initial commit 作为历史根节点
---
HMI.ParameterManage/ProductModal.xaml.cs | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 101 insertions(+), 0 deletions(-)
diff --git a/HMI.ParameterManage/ProductModal.xaml.cs b/HMI.ParameterManage/ProductModal.xaml.cs
new file mode 100644
index 0000000..9210a3d
--- /dev/null
+++ b/HMI.ParameterManage/ProductModal.xaml.cs
@@ -0,0 +1,101 @@
+锘縰sing HMI.Core.Entity;
+using HMI.ParameterManage.Model;
+using HMI.UI.DpUtil;
+using HMI.UI.Util;
+using Panuon.WPF.UI;
+using System;
+using System.ComponentModel;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace HMI.ParameterManage
+{
+ /// <summary>
+ /// ModalWindow.xaml 鐨勪氦浜掗�昏緫
+ /// </summary>
+ public partial class ProductModal : WindowX
+ {
+
+ private XmlModel DataModel;
+
+ public ProductModal(XmlModel dataModel)
+ {
+ DataModel = dataModel;
+ this.DataContext = this;
+ InitializeComponent();
+ }
+
+ public ProductData Data { get; set; }
+
+ private bool _isProcessing;
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ //Press Continue Button
+ if (DialogResult == true)
+ {
+ if (_isProcessing)
+ {
+ e.Cancel = true;
+ return;
+ }
+ var okButton = WindowXModalDialog.GetOKButton(this);
+ try
+ {
+ _isProcessing = true;
+ ButtonHelper.SetIsPending(okButton, true);
+ if (!ValidateForm())
+ {
+ e.Cancel = true;
+ return;
+ }
+
+ DataModel.SaveOrUpdateData(Data);
+ }
+ catch (Exception ex)
+ {
+ ToastHelper.Error(this, $"Error: {ex.Message}");
+ e.Cancel = true;
+ return;
+ }
+ finally
+ {
+ _isProcessing = false;
+ ButtonHelper.SetIsPending(okButton, false);
+ }
+ }
+ base.OnClosing(e);
+ }
+
+ private bool ValidateName(object value, out string msg)
+ {
+ return DataModel.ValidateProductName(value, out msg);
+ }
+
+ private bool ValidateForm()
+ {
+ bool flag = FormGroupHelper.ValidateForm(formPanel);
+ if (flag)
+ {
+ Data.Name = TbName.Text;
+ Data.IsMaster = TbIsMaster.IsChecked == true;
+ Data.ParentId = CbParent.Text;
+ }
+ return flag;
+ }
+
+ public bool? Open(ProductData data, bool isEdit)
+ {
+ Data = data;
+ TbName.Text = Data.Name;
+ TbIsMaster.IsChecked = Data.IsMaster;
+ FgParentId.Visibility = isEdit ? Visibility.Collapsed : Visibility.Visible;
+
+ CbParent.ItemsSource = DataModel.Products.Select(e => e.Name).ToList();
+ //TbParentId.Text = Data.ParentId;
+
+ return this.ShowDialog();
+ }
+ }
+}
--
Gitblit v1.9.1