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 @@
-
+
-
+
-
+
-
+
+
+
+
+
+
diff --git a/Client/Views/GameWindow.xaml.cs b/Client/Views/GameWindow.xaml.cs
index ac9b36c..0b609ba 100644
--- a/Client/Views/GameWindow.xaml.cs
+++ b/Client/Views/GameWindow.xaml.cs
@@ -18,10 +18,12 @@ namespace Client.Views
///
public partial class GameWindow : Window
{
+
public GameWindow()
{
DataContext = new ViewModelGame();
InitializeComponent();
+
}
Point currentPoint = new Point();
@@ -40,7 +42,7 @@ namespace Client.Views
{
Line line = new Line();
-
+
line.Stroke = new SolidColorBrush(color);
//line.Stroke = SystemColors.WindowFrameBrush;
line.X1 = currentPoint.X;
@@ -92,5 +94,24 @@ namespace Client.Views
colorSelected.B = ClrPcker_Background.SelectedColor.Value.B;
color = colorSelected;
}
+
+ private void ChatBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ //if enter then clear textbox and send message.
+ if (e.Key.Equals(Key.Enter))
+ {
+ WriteToChat(ChatBox.Text);
+ ChatBox.Clear();
+ }
+ }
+
+ /*
+ * Writes the current client's message to the chatbox.
+ */
+ private void WriteToChat(string message)
+ {
+ string user = "Monkey";
+ SentMessage.AppendText($"{user}: {message}\n");
+ }
}
}
diff --git a/Client/Views/MainWindow.xaml.cs b/Client/Views/MainWindow.xaml.cs
index ccbf69d..70bb34a 100644
--- a/Client/Views/MainWindow.xaml.cs
+++ b/Client/Views/MainWindow.xaml.cs
@@ -41,7 +41,6 @@ namespace Client
GameWindow window = new GameWindow();
window.Show();
}
-
}
}
}
diff --git a/Eindproject/.idea/.idea.Eindproject/.idea/contentModel.xml b/Eindproject/.idea/.idea.Eindproject/.idea/contentModel.xml
new file mode 100644
index 0000000..c0c1781
--- /dev/null
+++ b/Eindproject/.idea/.idea.Eindproject/.idea/contentModel.xml
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Eindproject/.idea/.idea.Eindproject/.idea/indexLayout.xml b/Eindproject/.idea/.idea.Eindproject/.idea/indexLayout.xml
new file mode 100644
index 0000000..27ba142
--- /dev/null
+++ b/Eindproject/.idea/.idea.Eindproject/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Eindproject/.idea/.idea.Eindproject/.idea/workspace.xml b/Eindproject/.idea/.idea.Eindproject/.idea/workspace.xml
new file mode 100644
index 0000000..e5f7c09
--- /dev/null
+++ b/Eindproject/.idea/.idea.Eindproject/.idea/workspace.xml
@@ -0,0 +1,41 @@
+
+
+
+ ../Server/Server.csproj
+ ../Client/Client.csproj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file