automapper框架优化
This commit is contained in:
62
UIShare/UIViewModel/TcpConfigVM.cs
Normal file
62
UIShare/UIViewModel/TcpConfigVM.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace UIShare.UIViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// TCP 连接配置(与 DeviceCommand.Base.Tcp 保持字段一致)。
|
||||
/// </summary>
|
||||
public class TcpConfigVM : BindableBase
|
||||
{
|
||||
private string _ipAddress = "127.0.0.1";
|
||||
public string IPAddress
|
||||
{
|
||||
get => _ipAddress;
|
||||
set => SetProperty(ref _ipAddress, value);
|
||||
}
|
||||
|
||||
private int _port = 502;
|
||||
public int Port
|
||||
{
|
||||
get => _port;
|
||||
set => SetProperty(ref _port, value);
|
||||
}
|
||||
|
||||
private int _sendTimeout = 3000;
|
||||
public int SendTimeout
|
||||
{
|
||||
get => _sendTimeout;
|
||||
set => SetProperty(ref _sendTimeout, value);
|
||||
}
|
||||
|
||||
private int _receiveTimeout = 3000;
|
||||
public int ReceiveTimeout
|
||||
{
|
||||
get => _receiveTimeout;
|
||||
set => SetProperty(ref _receiveTimeout, value);
|
||||
}
|
||||
|
||||
public TcpConfigVM() { }
|
||||
|
||||
/// <summary>拷贝构造,用于对话框编辑副本。</summary>
|
||||
public TcpConfigVM(TcpConfigVM? src)
|
||||
{
|
||||
if (src == null) return;
|
||||
IPAddress = src.IPAddress;
|
||||
Port = src.Port;
|
||||
SendTimeout = src.SendTimeout;
|
||||
ReceiveTimeout = src.ReceiveTimeout;
|
||||
}
|
||||
|
||||
/// <summary>把字段拷回目标对象(保存时用)。</summary>
|
||||
public void CopyTo(TcpConfigVM? dst)
|
||||
{
|
||||
if (dst == null) return;
|
||||
dst.IPAddress = IPAddress;
|
||||
dst.Port = Port;
|
||||
dst.SendTimeout = SendTimeout;
|
||||
dst.ReceiveTimeout = ReceiveTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user