Added OnIncomingMessages (for loading messages from json array)

This commit is contained in:
Patrick Hellebrand
2021-09-23 10:21:55 +02:00
parent 43b78014ca
commit 69d5327c75
3 changed files with 63 additions and 12 deletions

View File

@@ -82,8 +82,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);
@@ -94,8 +93,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()