Added OnIncomingMessages (for loading messages from json array)

This commit is contained in:
Patrick Hellebrand
2021-09-23 10:21:55 +02:00
committed by Felix Hartmann (PEA3-Fe-FI)
parent 55bd72b467
commit 92bc795aff
3 changed files with 63 additions and 12 deletions

View File

@@ -80,8 +80,7 @@ namespace PolyChat
Debug.WriteLine("--- Controller.OnMessage ---");
if (data != null && data.Length > 0 && data[0] != null)
{
Debug.WriteLine("Message: " + data[0]);
Debug.WriteLine($"RAW: {data[0].ToString()}");
Debug.WriteLine("RAW: " + data[0]);
UIController.OnIncomingMessage(ip, data[0].ToString());
}
else Debug.WriteLine("Undefined: " + data);
@@ -92,8 +91,8 @@ namespace PolyChat
Connections[IP].Close();
Connections.Remove(IP);
UIController.OnChatPartnerDeleted(IP);
if(!wasConnected)
UIController.ShowConnectionError("Connection close", IP, $"Connection to {IP} failed...");
string heading = wasConnected ? "Connection Closed" : "Connection Failed";
UIController.ShowConnectionError(IP, heading, $"Connecting to {IP} failed...");
}
public string getIP()