[ADD] add canvas data sending on mouse up
This commit is contained in:
@@ -148,12 +148,16 @@ namespace Client.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Canvas_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
sendArrayFromQueue(sender, null);
|
||||||
|
}
|
||||||
|
|
||||||
private void sendArrayFromQueue(object sender, ElapsedEventArgs e)
|
private void sendArrayFromQueue(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (linesQueue.Count != 0)
|
if (linesQueue.Count != 0)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("[GAME] sending canvas data...");
|
|
||||||
double[][] temp = linesQueue.Dequeue();
|
double[][] temp = linesQueue.Dequeue();
|
||||||
data.Client.SendMessage(JSONConvert.ConstructDrawingCanvasData(temp,color));
|
data.Client.SendMessage(JSONConvert.ConstructDrawingCanvasData(temp,color));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,11 +50,11 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Button Name="StartGame" Grid.Row="0" Grid.Column="2" Content="Start Game" FontSize="20" Command="{Binding ButtonStartGame}" IsEnabled="{Binding IsHost}"/>
|
<Button Name="StartGame" Grid.Row="0" Grid.Column="2" Content="Start Game" FontSize="20" Command="{Binding ButtonStartGame}" IsEnabled="{Binding IsHost}"/>
|
||||||
<Label Name="GuessWord" Grid.Row="0" Grid.Column="1" Content="{Binding Path=Word, UpdateSourceTrigger=PropertyChanged}" Margin="140,0,109,0"/>
|
<Label Name="GuessWord" Grid.Row="0" Grid.Column="1" Content="{Binding Path=Word, UpdateSourceTrigger=PropertyChanged}" Margin="418,-5,103,5"/>
|
||||||
|
|
||||||
|
|
||||||
<Border Grid.Row="1" Grid.Column="1" Margin ="10,10,10,10" BorderBrush="Black" BorderThickness ="2.5">
|
<Border Grid.Row="1" Grid.Column="1" Margin ="10,10,10,10" BorderBrush="Black" BorderThickness ="2.5">
|
||||||
<Canvas Name="CanvasForPaint" MouseDown="CanvasForPaint_MouseDown" MouseMove="CanvasForPaint_MouseMove">
|
<Canvas Name="CanvasForPaint" MouseDown="CanvasForPaint_MouseDown" MouseMove="CanvasForPaint_MouseMove" MouseUp="CanvasForPaint_MouseUp">
|
||||||
<Canvas.Background>
|
<Canvas.Background>
|
||||||
<SolidColorBrush Color="White" Opacity="0"/>
|
<SolidColorBrush Color="White" Opacity="0"/>
|
||||||
</Canvas.Background>
|
</Canvas.Background>
|
||||||
|
|||||||
@@ -43,5 +43,9 @@ namespace Client.Views
|
|||||||
viewModel.Color_Picker(e, this);
|
viewModel.Color_Picker(e, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CanvasForPaint_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
viewModel.Canvas_MouseUp(sender, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user