Merge remote-tracking branch 'origin/develop' into dataOnTabs
This commit is contained in:
@@ -111,11 +111,10 @@ namespace DoctorApp.Utils
|
||||
Console.WriteLine("Set resistance identifier");
|
||||
break;
|
||||
case DataParser.NEW_CONNECTION:
|
||||
Debug.WriteLine("doctor client new connection");
|
||||
this.MainViewModel.NewConnectedUser(DataParser.getUsernameFromResponseJson(payloadbytes));
|
||||
this.MainViewModel.NewConnectedUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
break;
|
||||
case DataParser.DISCONNECT:
|
||||
this.MainViewModel.DisconnectedUser(DataParser.getUsernameFromResponseJson(payloadbytes));
|
||||
this.MainViewModel.DisconnectedUser(DataParser.getUsernameFromJson(payloadbytes));
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($"Received json with identifier {identifier}:\n{Encoding.ASCII.GetString(payloadbytes)}");
|
||||
@@ -135,6 +134,8 @@ namespace DoctorApp.Utils
|
||||
expectedMessageLength = BitConverter.ToInt32(totalBuffer, 0);
|
||||
}
|
||||
|
||||
if (ar == null || (!ar.IsCompleted) || (!this.stream.CanRead) || !this.client.Connected)
|
||||
return;
|
||||
this.stream.BeginRead(this.buffer, 0, this.buffer.Length, new AsyncCallback(OnRead), null);
|
||||
|
||||
}
|
||||
@@ -197,6 +198,7 @@ namespace DoctorApp.Utils
|
||||
public void Dispose()
|
||||
{
|
||||
Debug.WriteLine("client dispose called");
|
||||
sendMessage(DataParser.getDisconnectJson(LoginViewModel.Username));
|
||||
this.stream.Dispose();
|
||||
this.client.Dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user