更新NTT类型为数字显示

1.FullCone
2.RestrictedCone
3.PortRestrictedCone
4.Symmetric
This commit is contained in:
AmazingDM
2020-08-11 17:39:30 +08:00
parent 24f8691cf9
commit 6f1025c73e
3 changed files with 37 additions and 6 deletions

View File

@@ -124,11 +124,13 @@ namespace Netch.Forms
{
NatTypeStatusLabel.Text = String.Format("NAT{0}{1}", i18N.Translate(": "), text);
}
if (Enum.TryParse(text, false, out STUN_Client.NatType natType))
if (int.TryParse(text, out int natType))
{
NatTypeStatusLightLabel.Visible = true;
UpdateNatTypeLight(natType);
if (natType > 0 && natType < 5)
{
NatTypeStatusLightLabel.Visible = true;
UpdateNatTypeLight(natType);
}
}
}
else
@@ -169,6 +171,35 @@ namespace Netch.Forms
NatTypeStatusLightLabel.ForeColor = c;
}
/// <summary>
/// 更新 NAT指示灯颜色
/// </summary>
/// <param name="natType"></param>
private void UpdateNatTypeLight(int natType)
{
Color c;
switch (natType)
{
case 1:
c = Color.LimeGreen;
break;
case 2:
c = Color.Yellow;
break;
case 3:
c = Color.Red;
break;
case 4:
c = Color.Black;
break;
default:
c = Color.Black;
break;
}
NatTypeStatusLightLabel.ForeColor = c;
}
/// <summary>
/// 更新状态栏文本
/// </summary>

View File

@@ -166,7 +166,7 @@ namespace Netch.Models
/// <summary>
/// STUN测试服务器
/// </summary>
public string STUN_Server = "stun.stunprotocol.org";
public string STUN_Server = "stun.syncthing.net";
/// <summary>
/// STUN测试服务器