From eb7b8e258471ccb029f56d59344d28e8f8888f11 Mon Sep 17 00:00:00 2001 From: Dogukan Date: Mon, 19 Oct 2020 22:40:58 +0200 Subject: [PATCH] [Addition] Added a chatbox function! --- Client/Client.cs | 3 +- Client/Models/Model.cs | 6 +- Client/ViewModels/ViewModel.cs | 6 -- Client/ViewModels/ViewModelGame.cs | 8 +- Client/Views/GameWindow.xaml | 16 ++-- Client/Views/GameWindow.xaml.cs | 23 ++++- Client/Views/MainWindow.xaml.cs | 1 - .../.idea.Eindproject/.idea/contentModel.xml | 88 +++++++++++++++++++ .../.idea.Eindproject/.idea/indexLayout.xml | 8 ++ .../.idea.Eindproject/.idea/workspace.xml | 41 +++++++++ 10 files changed, 175 insertions(+), 25 deletions(-) create mode 100644 Eindproject/.idea/.idea.Eindproject/.idea/contentModel.xml create mode 100644 Eindproject/.idea/.idea.Eindproject/.idea/indexLayout.xml create mode 100644 Eindproject/.idea/.idea.Eindproject/.idea/workspace.xml diff --git a/Client/Client.cs b/Client/Client.cs index 87ac03d..17551de 100644 --- a/Client/Client.cs +++ b/Client/Client.cs @@ -17,7 +17,7 @@ namespace Client public int Port = 5555; public bool Connected = false; //TODO send login packet to server with ClientServerUtil.createpayload(0x01,dynamic json with username) - public string username; + public string Username { get; } public Client() { @@ -81,6 +81,7 @@ namespace Client string textUsername = combo.Item1; string textMsg = combo.Item2; //TODO display username and message in chat window + break; case 0x03: diff --git a/Client/Models/Model.cs b/Client/Models/Model.cs index 6fb46cb..59b3577 100644 --- a/Client/Models/Model.cs +++ b/Client/Models/Model.cs @@ -12,12 +12,10 @@ namespace Client private int _numbers; private bool _status; + //Test code public int Numbers { - get - { - return _numbers; - } + get { return _numbers; } set { diff --git a/Client/ViewModels/ViewModel.cs b/Client/ViewModels/ViewModel.cs index 67bc890..241b520 100644 --- a/Client/ViewModels/ViewModel.cs +++ b/Client/ViewModels/ViewModel.cs @@ -12,8 +12,6 @@ namespace Client { public event PropertyChangedEventHandler PropertyChanged; - - public ViewModel() { _model = new Model(); @@ -63,9 +61,5 @@ namespace Client get { return _lobbies; } set { _lobbies = value; } } - - - - } } diff --git a/Client/ViewModels/ViewModelGame.cs b/Client/ViewModels/ViewModelGame.cs index 831253b..2d12d4f 100644 --- a/Client/ViewModels/ViewModelGame.cs +++ b/Client/ViewModels/ViewModelGame.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; -using System.Text; namespace Client.ViewModels { class ViewModelGame : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; - - - - } } diff --git a/Client/Views/GameWindow.xaml b/Client/Views/GameWindow.xaml index ddb835f..e896679 100644 --- a/Client/Views/GameWindow.xaml +++ b/Client/Views/GameWindow.xaml @@ -15,7 +15,8 @@ - + + @@ -34,17 +35,22 @@ -