This commit is contained in:
Sem van der Hoeven
2020-10-23 21:04:29 +02:00
3 changed files with 16 additions and 3 deletions

View File

@@ -101,7 +101,7 @@ namespace Client.ViewModels
private void CanvasResetLocal()
{
this.window.CanvasForPaint.Children.Clear();
data.Client.SendMessage(JSONConvert.GetMessageToSend(JSONConvert.CANVAS, JSONConvert.CANVAS_RESET));
data.Client.SendMessage(JSONConvert.ConstructCanvasReset());
}
@@ -194,7 +194,11 @@ namespace Client.ViewModels
private void CanvasResetData()
{
this.window.CanvasForPaint.Children.Clear();
Application.Current.Dispatcher.Invoke(delegate
{
this.window.CanvasForPaint.Children.Clear();
});
}
private void ChatBox_KeyDown()

View File

@@ -40,7 +40,7 @@
<Label Name="GuessWord" Grid.Row="0" Grid.Column="2" Content="{Binding Path=RandomWord, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20"/>
<Button Name="CanvasReset" Click="CanvasReset_Click" Grid.Row="0" Grid.Column="3" Content="RESET"/>
<Button Name="CanvasReset" Command="{Binding ButtonResetCanvas}" Grid.Row="0" Grid.Column="3" Content="RESET"/>
</Grid>

View File

@@ -193,6 +193,15 @@ namespace SharedClientServer
color = colorToSend
});
}
public static byte[] ConstructCanvasReset()
{
dynamic payload = new
{
canvasType = CANVAS_RESET
};
return GetMessageToSend(CANVAS, payload);
}
public static int GetCanvasMessageType(byte[] json)
{