refactor: set StatusPortInfoText.ShareLan

This commit is contained in:
ChsBuffer
2020-10-29 12:07:12 +08:00
parent 39081c0a6f
commit 9d6b6d15d7
2 changed files with 6 additions and 2 deletions

View File

@@ -69,6 +69,8 @@ namespace Netch.Controllers
throw new StartFailedException();
}
StatusPortInfoText.UpdateShareLan();
if (!await StartMode(server, mode))
{
throw new StartFailedException();

View File

@@ -187,7 +187,7 @@ namespace Netch.Forms
{
private static ushort? _socks5Port;
private static ushort? _httpPort;
private static bool ShareLan => Global.Settings.LocalAddress != "127.0.0.1";
private static bool _shareLan;
public static ushort HttpPort
{
@@ -199,6 +199,8 @@ namespace Netch.Forms
set => _socks5Port = value;
}
public static void UpdateShareLan() => _shareLan = Global.Settings.LocalAddress != "127.0.0.1";
public static string Value
{
get
@@ -218,7 +220,7 @@ namespace Netch.Forms
if (!strings.Any())
return string.Empty;
return $" ({(ShareLan ? i18N.Translate("Allow other Devices to connect") + " " : "")}{string.Join(" | ", strings)})";
return $" ({(_shareLan ? i18N.Translate("Allow other Devices to connect") + " " : "")}{string.Join(" | ", strings)})";
}
}