schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using XCommon.Log;
using XImagingXhandler.XDAL;
 
namespace XHandler.View.MethodProperty
{
    /// <summary>
    /// Socket-TCP标准协议 参数共用页面
    /// </summary>
    public partial class SocketParamterItem : UserControl
    {
        #region 变量
        private MethodThirdPart m_methodProperty = null;
 
        public string MethodParamterId = string.Empty;
        public string Title = string.Empty;
        public string Value = string.Empty;
        public MethodEx method= null;
        public string sendParamsData = string.Empty;
        #endregion
 
        #region 构造函数
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mEx"></param>
        public SocketParamterItem(MethodThirdPart methodProperty,MethodEx method)
        {
            m_methodProperty = methodProperty;
            InitializeComponent();
            this.method = method;
        }
        #endregion
 
        #region 界面初期表示事件
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                tBoxTitle.Text = Title;
                tBoxValue.Text = Value;
                tBoxValue.Tag = MethodParamterId;
            }
            catch (Exception ex)
            {
                LoggerHelper.ErrorLog("ERROR:", ex);
            }
        }
        #endregion
 
        #region 参数值变更事件
        /// <summary>
        /// 参数值变更事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tBoxValue_TextChanged(object sender, TextChangedEventArgs e)
        {
            try
            {
                sendParamsData = string.Empty;
                var methodParameter = m_methodProperty.methodParametersData.FirstOrDefault(it => it.Id.Equals(MethodParamterId));
                if (methodParameter != null)
                {
                    Value = methodParameter.Value = tBoxValue.Text;
 
                    foreach(var param in m_methodProperty.methodParametersData)
                    {
                        sendParamsData += param.ParameterName + ":" + param.Value + ";";
                    }
                    method.method_Tipcontent = string.Format("{0},发送参数:{1}", m_methodProperty.deviceMethod == null ? "" : m_methodProperty.deviceMethod.ParameterName, sendParamsData);
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.ErrorLog("ERROR:", ex);
            }
        }
        #endregion
    }
}