Merge pull request #12 from SemvdH/hotfix/fixClientServerComms
[FIX] Callbacks weren't properly called
This commit is contained in:
@@ -94,7 +94,6 @@ namespace Client
|
||||
throw new OutOfMemoryException("buffer too small");
|
||||
}
|
||||
|
||||
|
||||
Array.Copy(buffer, 0, totalBuffer, totalBufferReceived, amountReceived);
|
||||
totalBufferReceived += amountReceived;
|
||||
|
||||
|
||||
@@ -48,19 +48,12 @@ namespace Client.ViewModels
|
||||
}
|
||||
|
||||
private string _randomWord;
|
||||
|
||||
public string RandomWord
|
||||
{
|
||||
get { return _randomWord; }
|
||||
set { _randomWord = value; }
|
||||
}
|
||||
|
||||
public static string Word
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsHost
|
||||
{
|
||||
get { return data.User.Host; }
|
||||
@@ -69,17 +62,6 @@ namespace Client.ViewModels
|
||||
public ViewModelGame(GameWindow window)
|
||||
{
|
||||
this.window = window;
|
||||
if (_payload == null)
|
||||
{
|
||||
_message = "";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//_message = data.Message;
|
||||
//_username = data.User.Username;
|
||||
//Messages.Add($"{data.User.Username}: {Message}");
|
||||
}
|
||||
|
||||
buffer = new double[maxLines][];
|
||||
linesQueue = new Queue<double[][]>();
|
||||
@@ -228,7 +210,7 @@ namespace Client.ViewModels
|
||||
data.Client.SendMessage(JSONConvert.GetMessageToSend(JSONConvert.MESSAGE, _payload));
|
||||
}
|
||||
|
||||
public static void HandleIncomingMsg(string username, string message)
|
||||
public void HandleIncomingMsg(string username, string message)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
@@ -241,12 +223,12 @@ namespace Client.ViewModels
|
||||
data.Client.SendMessage(JSONConvert.ConstructLobbyLeaveMessage(data.Lobby.ID));
|
||||
}
|
||||
|
||||
public static void HandleRandomWord(string randomWord)
|
||||
public void HandleRandomWord(string randomWord)
|
||||
{
|
||||
Debug.WriteLine("[CLIENT] Reached the handle random word method!");
|
||||
Application.Current.Dispatcher.Invoke(delegate
|
||||
{
|
||||
Word = randomWord;
|
||||
RandomWord = randomWord;
|
||||
});
|
||||
}
|
||||
public void HandleIncomingPlayer(Lobby lobby)
|
||||
|
||||
@@ -38,10 +38,8 @@
|
||||
<xctk:ColorPicker Name="ClrPcker_Background" SelectedColorChanged="ClrPcker_Background_SelectedColorChanged_1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Height="22" Width="100"/>
|
||||
|
||||
|
||||
<Label Name="GuessWord" Grid.Row="0" Grid.Column="1" Content="{Binding Path=RandomWord, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Label Name="GuessWord" Grid.Row="0" Grid.Column="2" Content="{Binding Path=RandomWord, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="2" FontSize="20" Content="" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
|
||||
<Button Name="CanvasReset" Click="CanvasReset_Click" Grid.Row="0" Grid.Column="3" Content="RESET"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user