From 8e17ffa978879c3ce7b4f5e0aa4cb87f06a59f07 Mon Sep 17 00:00:00 2001 From: "Felix Hartmann (PEA3-Fe-FI)" Date: Thu, 23 Sep 2021 15:18:57 +0200 Subject: [PATCH 1/2] dont open new chat window if client is already in list --- PolyChat/MainPage.xaml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PolyChat/MainPage.xaml.cs b/PolyChat/MainPage.xaml.cs index 59ef3c3..452e752 100644 --- a/PolyChat/MainPage.xaml.cs +++ b/PolyChat/MainPage.xaml.cs @@ -99,7 +99,9 @@ namespace PolyChat { string ip = IP.GetIPFromCode(dialog.getValue()); Controller.Connect(ip); - Partners.Add(new ChatPartner( + ChatPartner pa = Partners.FirstOrDefault(p => p.Code == ip); + if (pa == null) + Partners.Add(new ChatPartner( "Connecting...", ip )); From a5dd048f076cc5a14c7bdf01cbc790527ec88057 Mon Sep 17 00:00:00 2001 From: "Felix Hartmann (PEA3-Fe-FI)" Date: Thu, 23 Sep 2021 15:46:13 +0200 Subject: [PATCH 2/2] remove unused variables --- PolyChat/Controller.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/PolyChat/Controller.cs b/PolyChat/Controller.cs index ce10213..d5e6efe 100644 --- a/PolyChat/Controller.cs +++ b/PolyChat/Controller.cs @@ -29,8 +29,6 @@ namespace PolyChat private readonly FileManager fileManager; // Props private Dictionary Connections = new Dictionary(); - private string OwnName = ""; - private string OwnIP; /// /// Initializes Controller with UI access @@ -40,7 +38,6 @@ namespace PolyChat { UIController = uiController; fileManager = new FileManager(uiController); - OwnIP = getIP(); fileManager.loadChats(); Serve();