|
@@ -32,19 +32,22 @@ public partial class StatusBarViewModel : ObservableObject
|
|
|
|
|
|
private void OnConnectionChanged(object? sender, (bool, UniversalNetFrame451.IO.TcpConnection) e)
|
|
private void OnConnectionChanged(object? sender, (bool, UniversalNetFrame451.IO.TcpConnection) e)
|
|
{
|
|
{
|
|
- if(e.Item1)
|
|
|
|
|
|
+ App.Current.Dispatcher.Invoke(() =>
|
|
{
|
|
{
|
|
- Status = "Connected";
|
|
|
|
- RemoteIp = e.Item2.RemoteEndPoint.Address.ToString();
|
|
|
|
- RemotePort = e.Item2.RemoteEndPoint.Port.ToString();
|
|
|
|
- _logService.Log($"Get a connection from {RemoteIp}:{RemotePort}");
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- Status = "Disconnected";
|
|
|
|
- RemoteIp = "Unknown";
|
|
|
|
- RemotePort = "Unknown";
|
|
|
|
- _logService.Log($"The connection lost");
|
|
|
|
- }
|
|
|
|
|
|
+ if (e.Item1)
|
|
|
|
+ {
|
|
|
|
+ Status = "Connected";
|
|
|
|
+ RemoteIp = e.Item2.RemoteEndPoint.Address.ToString();
|
|
|
|
+ RemotePort = e.Item2.RemoteEndPoint.Port.ToString();
|
|
|
|
+ _logService.Log($"Get a connection from {RemoteIp}:{RemotePort}");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Status = "Disconnected";
|
|
|
|
+ RemoteIp = "Unknown";
|
|
|
|
+ RemotePort = "Unknown";
|
|
|
|
+ _logService.Log($"The connection lost");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|