merge stuff

This commit is contained in:
Sem van der Hoeven
2020-10-22 22:35:29 +02:00
parent ec156f3dc6
commit 09f9e227b8
4 changed files with 14 additions and 31 deletions

View File

@@ -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;
});
}
}
}

View File

@@ -52,8 +52,6 @@
<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"/>
<xctk:ColorPicker Name="ClrPcker_Background" SelectedColorChanged="ClrPcker_Background_SelectedColorChanged_1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Height="22" Width="100"/>
<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">

View File

@@ -36,16 +36,6 @@ namespace Client.Views
private void CanvasReset_Click(object sender, RoutedEventArgs e)
{
CanvasForPaint.Children.Clear();
//FOR FUTURE USE, IF NECCESSARY
//TEST.Children.Clear();
//foreach (UIElement child in CanvasForPaint.Children)
//{
// var xaml = System.Windows.Markup.XamlWriter.Save(child);
// var deepCopy = System.Windows.Markup.XamlReader.Parse(xaml) as UIElement;
// TEST.Children.Add(deepCopy);
//}
}
private void ClrPcker_Background_SelectedColorChanged_1(object sender, RoutedPropertyChangedEventArgs<Color?> e)

View File

@@ -4,6 +4,7 @@ using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Media;