diff --git a/PolyChat/MainPage.xaml b/PolyChat/MainPage.xaml index 4fdf466..e56eae1 100644 --- a/PolyChat/MainPage.xaml +++ b/PolyChat/MainPage.xaml @@ -30,8 +30,8 @@ - + @@ -98,8 +98,8 @@ - - + + diff --git a/PolyChat/MainPage.xaml.cs b/PolyChat/MainPage.xaml.cs index bbc53e8..f3905e7 100644 --- a/PolyChat/MainPage.xaml.cs +++ b/PolyChat/MainPage.xaml.cs @@ -27,7 +27,7 @@ namespace PolyChat networkingController = new NetworkingController(this); Partners = new ObservableCollection(); - //ipAddress.Text = IP.GetCodeFromIP(Controller.GetIP()); + ipAddress.Text = IP.GetCodeFromIP(networkingController.getIP().ToString()); } public void OnChatPartnerSelected(object sender, RoutedEventArgs e) @@ -58,7 +58,7 @@ namespace PolyChat string ip = dialog.getValue(); if (IP.ValidateIP(ip)) { - Controller.Connect(ip); + networkingController.connectNewClient(ip); Partners.Add(new ChatPartner( "Connecting...", ip @@ -83,7 +83,7 @@ namespace PolyChat { ChatPartner sendingPartner = Partners.First(p => p.Code == message.Ip); sendingPartner.AddMessage(new ChatMessage( - message.Msg, + message.Content, true, message.Sender )); diff --git a/PolyChat/Models/ChatMessage.cs b/PolyChat/Models/ChatMessage.cs index 60cb6d0..28cf47c 100644 --- a/PolyChat/Models/ChatMessage.cs +++ b/PolyChat/Models/ChatMessage.cs @@ -6,17 +6,15 @@ namespace PolyChat.Models { public readonly string Sender; public readonly DateTime Timestamp = new DateTime(1970, 01, 01); - public readonly string Msg = "empty"; + public readonly string Content; public readonly string Ip; public readonly bool Foreign; - public readonly string StringTimeStamp; - public ChatMessage(string Msg = "", bool Foreign = true, string Sender= "Unknown", string Ip = "127.0.0.1") + public ChatMessage(string Content = "", bool Foreign = true, string Sender= "Unknown", string Ip = "127.0.0.1") { this.Sender = Sender; this.Timestamp = DateTime.Now; - StringTimeStamp = Timestamp.ToString(); - this.Msg = Msg; + this.Content = Content; this.Foreign = Foreign; this.Ip = Ip; } @@ -25,7 +23,7 @@ namespace PolyChat.Models public string ToString() { string prefix = Foreign ? "Other" : "Me"; - return $"{prefix}: {Msg}({Sender})"; + return $"{prefix}: {Content}({Sender})"; } } } \ No newline at end of file