From 09f9e227b807fb71608fc700285750cc0ed39825 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Thu, 22 Oct 2020 22:35:29 +0200 Subject: [PATCH] merge stuff --- Client/ViewModels/ViewModelGame.cs | 32 ++++++++++++------------------ Client/Views/GameWindow.xaml | 2 -- Client/Views/GameWindow.xaml.cs | 10 ---------- SharedClientServer/JSONConvert.cs | 1 + 4 files changed, 14 insertions(+), 31 deletions(-) diff --git a/Client/ViewModels/ViewModelGame.cs b/Client/ViewModels/ViewModelGame.cs index 976e24d..e010161 100644 --- a/Client/ViewModels/ViewModelGame.cs +++ b/Client/ViewModels/ViewModelGame.cs @@ -1,5 +1,5 @@ -using Client.Views; +using Client.Views; using GalaSoft.MvvmLight.Command; using SharedClientServer; using System; @@ -9,7 +9,6 @@ using System.ComponentModel; using System.Diagnostics; using System.Timers; using System.Windows; -using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Shapes; @@ -33,12 +32,6 @@ namespace Client.ViewModels private dynamic _payload; - public static string Word - { - get; - set; - } - public string _username; public string _message; @@ -54,6 +47,12 @@ namespace Client.ViewModels } } + public static string Word + { + get; + set; + } + public bool IsHost { get { return data.User.Host; } @@ -213,10 +212,6 @@ namespace Client.ViewModels data.Client.SendMessage(JSONConvert.GetMessageToSend(JSONConvert.MESSAGE, _payload)); } - /* - * MISC make this a callback - * Handles the incoming chat message from another client. - */ public static void HandleIncomingMsg(string username, string message) { Application.Current.Dispatcher.Invoke(delegate @@ -224,21 +219,20 @@ namespace Client.ViewModels Messages.Add($"{username}: {message}"); }); } - public void LeaveGame(object sender, CancelEventArgs e) + public void LeaveGame(object sender, System.ComponentModel.CancelEventArgs e) { Debug.WriteLine("Leaving..."); data.Client.SendMessage(JSONConvert.ConstructLobbyLeaveMessage(data.Lobby.ID)); } - /* - * MISC make this a callback - * Handles the random word that has been received from the server. - */ public static void HandleRandomWord(string randomWord) { Debug.WriteLine("[CLIENT] Reached the handle random word method!"); - Word = "NegerPik"; + Application.Current.Dispatcher.Invoke(delegate + { + Word = randomWord; + }); } } } - + diff --git a/Client/Views/GameWindow.xaml b/Client/Views/GameWindow.xaml index ab2d3ef..94fe1e3 100644 --- a/Client/Views/GameWindow.xaml +++ b/Client/Views/GameWindow.xaml @@ -52,8 +52,6 @@