[EDIT] made main window open only when the client has connected

This commit is contained in:
Sem van der Hoeven
2020-10-20 18:27:53 +02:00
parent f6c70bc717
commit 73dc0b94de
3 changed files with 14 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ namespace Client
public int Port = 5555;
public bool Connected = false;
private string username;
public Callback OnSuccessfullConnect;
public Client(string username)
{
@@ -31,6 +32,7 @@ namespace Client
Debug.Write("finished connecting to server");
this.tcpClient.EndConnect(ar);
this.stream = tcpClient.GetStream();
OnSuccessfullConnect?.Invoke();
SendMessage(JSONConvert.ConstructUsernameMessage(username));
this.stream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnReadComplete),null);
}