Remove Tabs when disconnect

This commit is contained in:
fabjuuuh
2020-10-14 14:35:14 +02:00
parent 3547207cad
commit af5dca25f4
9 changed files with 52 additions and 8 deletions

View File

@@ -175,7 +175,7 @@ namespace ClientApp.Utils
/// starts sending a message to the server
/// </summary>
/// <param name="message">the message to send</param>
private void sendMessage(byte[] message)
public void sendMessage(byte[] message)
{
stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
}

View File

@@ -15,6 +15,8 @@ namespace ClientApp.Utils
public const string START_SESSION = "START SESSION";
public const string STOP_SESSION = "STOP SESSION";
public const string SET_RESISTANCE = "SET RESISTANCE";
public const string NEW_CONNECTION = "NEW CONNECTION";
public const string DISCONNECT = "DISCONNECT";
/// <summary>
/// makes the json object with LOGIN identifier and username and password
/// </summary>
@@ -201,6 +203,24 @@ namespace ClientApp.Utils
return ((dynamic)JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json))).data.worked;
}
public static byte[] getNewConnectionJson(string user)
{
dynamic data = new
{
username = user
};
return getJsonMessage(NEW_CONNECTION, data);
}
public static byte[] getDisconnectJson(string user)
{
dynamic data = new
{
username = user
};
return getJsonMessage(DISCONNECT, data);
}
}
}