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
|
}
|
}
|