using Muchinfo.MTPClient.Resources;
using System.Windows.Input;
namespace Muchinfo.MTPClient.Data.Model.Account
{
using GalaSoft.MvvmLight;
using System;
///
/// 交易服务器实体类
///
public class TradeServer : ObservableObject
{
#region Fields
//是否处于选择状态
private bool _isChecked;
//网络状态(显示星级)
private double _netStatus;
//会话延时
private TimeSpan _requestTime;
//服务器地址
private string _serverIP;
//服务器名称
private string _serverName;
//服务器端口
private int _serverPort;
#endregion Fields
#region Properties
///
/// 使用率
///
public string Rate
{
get;
set;
}
///
/// 网络状态(显示星级)
///
public double NetStatus
{
get { return _netStatus; }
set { Set(() => NetStatus, ref _netStatus, value); }
}
///
/// 会话延时
///
public TimeSpan RequestTime
{
get { return _requestTime; }
set
{
Set(() => RequestTime, ref _requestTime, value);
if (_requestTime.TotalMilliseconds < 0)
{
_requestTimeText = "--:---";
}
else if (_requestTime.TotalMilliseconds == 0)
{
_requestTimeText = "00:000";
}
else if (_requestTime.TotalMilliseconds >= 6000)
{
_requestTimeText = Client_Resource.Domain_Timeout;
}
else
{
_requestTimeText = ((int)(_requestTime.TotalMilliseconds / 1000)).ToString().PadLeft(2, '0') + ":" +
((int)(_requestTime.TotalMilliseconds % 1000)).ToString().PadLeft(3, '0');
}
RaisePropertyChanged(() => RequestTimeText);
}
}
public string _requestTimeText;
///
/// 延时提示文本, 小于0表示没测速、大于或等于6s显示超时
///
public string RequestTimeText
{
get
{
return _requestTimeText;
}
set
{
Set(() => RequestTimeText, ref _requestTimeText, value);
}
}
///
/// 是否处于选择状态
///
public bool IsChecked
{
get { return _isChecked; }
set { Set(() => IsChecked, ref _isChecked, value); }
}
///
/// 服务器地址
///
public string ServerIP
{
get { return _serverIP; }
set { Set(() => ServerIP, ref _serverIP, value); }
}
///
/// 服务器名称
///
public string ServerName
{
get { return _serverName; }
set { Set(() => ServerName, ref _serverName, value); }
}
///
/// 服务器端口
///
public int ServerPort
{
get { return _serverPort; }
set { Set(() => ServerPort, ref _serverPort, value); }
}
///
/// 连接测试
///
public ICommand TestCommand { get; set; }
#endregion Properties
}
}