[Addition] Added a chatbox function!

This commit is contained in:
Dogukan
2020-10-19 22:40:58 +02:00
parent 35917e547a
commit eb7b8e2584
10 changed files with 175 additions and 25 deletions

View File

@@ -18,10 +18,12 @@ namespace Client.Views
/// </summary>
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");
}
}
}