2021-10-18 12:05:45 +13:00
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
using RBG_Server;
|
2021-10-17 16:04:08 +13:00
|
|
|
|
using System;
|
2021-10-17 13:16:40 +13:00
|
|
|
|
using System.Collections.Generic;
|
2021-10-17 16:04:08 +13:00
|
|
|
|
using System.IO;
|
2021-10-17 13:16:40 +13:00
|
|
|
|
using System.Linq;
|
2021-10-17 16:04:08 +13:00
|
|
|
|
using System.Net.Sockets;
|
2021-10-17 13:16:40 +13:00
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
2021-10-18 12:23:54 +13:00
|
|
|
|
// Not using Shapes.Path so specify Path = System.IO
|
|
|
|
|
using Path = System.IO.Path;
|
2021-10-17 13:16:40 +13:00
|
|
|
|
|
|
|
|
|
namespace RBG_Server_WPF
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for ConnectionPage.xaml
|
|
|
|
|
/// </summary>
|
2021-11-02 15:02:12 +13:00
|
|
|
|
public partial class ConnectionPage : Window
|
2021-10-17 13:16:40 +13:00
|
|
|
|
{
|
|
|
|
|
public ConnectionPage()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 11:48:10 +13:00
|
|
|
|
// ************************************************************
|
|
|
|
|
// ****************** Visibility Toggles **********************
|
|
|
|
|
// ************************************************************
|
|
|
|
|
#region visibility toggles
|
|
|
|
|
|
2021-10-17 13:16:40 +13:00
|
|
|
|
private void HostButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Draw host window
|
|
|
|
|
ServerGrid.Visibility = Visibility.Visible;
|
|
|
|
|
ServerSelectPanel.Visibility = Visibility.Collapsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ConnectButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2021-10-17 16:04:08 +13:00
|
|
|
|
// Draw client window
|
|
|
|
|
ClientGrid.Visibility = Visibility.Visible;
|
|
|
|
|
ServerSelectPanel.Visibility = Visibility.Collapsed;
|
2021-10-17 13:16:40 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BackButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Hide host view, show connect view
|
|
|
|
|
ServerGrid.Visibility = Visibility.Collapsed;
|
|
|
|
|
ServerSelectPanel.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
2021-10-17 16:04:08 +13:00
|
|
|
|
|
|
|
|
|
private void ClientBackButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
ClientGrid.Visibility = Visibility.Collapsed;
|
|
|
|
|
ServerSelectPanel.Visibility = Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 11:48:10 +13:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// ************************************************************
|
|
|
|
|
// *************** Client Connection Logic *******************
|
|
|
|
|
// ************************************************************
|
|
|
|
|
#region client connection logic
|
|
|
|
|
TcpClient client;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Connect to server buttonm runs an asynchronous task that attempts to connect to a server,
|
|
|
|
|
/// and load the thumbnails from the server
|
|
|
|
|
/// </summary>
|
2021-10-17 16:04:08 +13:00
|
|
|
|
private void ClientServerConnectButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Run an async connection task
|
|
|
|
|
// This task establishes a connection, then
|
2021-10-18 11:48:10 +13:00
|
|
|
|
Task clientConnect = new(async () =>
|
|
|
|
|
{
|
|
|
|
|
client = new();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
await client.ConnectAsync(ServerAddressConnectBox.Text, int.Parse(ServerPortConnectBox.Text));
|
|
|
|
|
if (client.Connected)
|
|
|
|
|
{
|
2021-10-17 16:04:08 +13:00
|
|
|
|
// Invoke the display to update
|
|
|
|
|
Dispatcher.Invoke(() =>
|
2021-10-18 11:48:10 +13:00
|
|
|
|
{
|
|
|
|
|
StatusTextBlock.Text = "Connected!";
|
|
|
|
|
StatusTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
|
|
|
|
});
|
2021-10-17 16:04:08 +13:00
|
|
|
|
// Run image downloading for the sprite
|
|
|
|
|
// This task is contained in the CommunicationHandler class
|
|
|
|
|
Progress<CommunicationHandler.ProgressData> progress = new Progress<CommunicationHandler.ProgressData>();
|
2021-10-18 11:48:10 +13:00
|
|
|
|
Task t = App.Context.GameCommunicationHandler.InitDataLoader(client.GetStream(), progress);
|
|
|
|
|
progress.ProgressChanged += Progress_ProgressChanged;
|
|
|
|
|
t.Start(); // t is asynchronous; we don't need to monitor/await progress as it fires its progress through the assigned handler
|
|
|
|
|
// We should, however, ensure that we don't make requests on client until progress is completed (which can be monitored via
|
|
|
|
|
// the Progress object)
|
2021-10-17 16:04:08 +13:00
|
|
|
|
}
|
2021-10-18 11:48:10 +13:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
StatusTextBlock.Text = "Connection Failed";
|
|
|
|
|
StatusTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
StatusTextBlock.Text = ex.Message[..(128 < ex.Message.Length ? 128 : ex.Message.Length)];
|
|
|
|
|
StatusTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
|
|
|
|
|
});
|
|
|
|
|
client?.Dispose();
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-10-17 16:04:08 +13:00
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
2021-10-18 11:48:10 +13:00
|
|
|
|
/// Progress callback, that responds to changes in the state of the task
|
2021-10-17 16:04:08 +13:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
|
|
private void Progress_ProgressChanged(object sender, CommunicationHandler.ProgressData e)
|
|
|
|
|
{
|
2021-10-18 11:48:10 +13:00
|
|
|
|
// Load iamges as they arrive
|
2021-10-17 16:04:08 +13:00
|
|
|
|
if (e.CurrentActivity == CommunicationHandler.ProgressData.Activity.ImageDownloaded)
|
|
|
|
|
{
|
2021-10-18 11:48:10 +13:00
|
|
|
|
// Show the user the total number of images downloaded
|
2021-10-17 16:04:08 +13:00
|
|
|
|
Dispatcher.Invoke(() => StatusTextBlock.Text = $"Downloaded {e.Progress} of {App.Context.GameCommunicationHandler.ImageList.Count} images.");
|
2021-10-18 11:48:10 +13:00
|
|
|
|
// Attempt to retrieve the image data
|
|
|
|
|
if(App.Context.GameCommunicationHandler.ImageCollection.TryGetValue(e.Message, out CachedByteArray cachedByteArray))
|
2021-10-17 16:28:58 +13:00
|
|
|
|
{
|
2021-10-18 11:48:10 +13:00
|
|
|
|
BitmapImage image = new();
|
|
|
|
|
image.BeginInit();
|
|
|
|
|
image.StreamSource = new MemoryStream(cachedByteArray, false);
|
|
|
|
|
image.EndInit();
|
|
|
|
|
|
|
|
|
|
if (e.Message == App.Context.GameCommunicationHandler.BoardName)
|
2021-10-17 16:04:08 +13:00
|
|
|
|
{
|
2021-10-18 11:48:10 +13:00
|
|
|
|
// Set the board image to `image`
|
|
|
|
|
_ = Dispatcher.Invoke(() => BoardPreviewImage.Source = image);
|
2021-10-17 16:04:08 +13:00
|
|
|
|
}
|
2021-10-18 11:48:10 +13:00
|
|
|
|
else
|
2021-10-17 16:40:26 +13:00
|
|
|
|
{
|
2021-10-18 11:48:10 +13:00
|
|
|
|
// Create a new image object
|
|
|
|
|
Image spriteImage = new()
|
|
|
|
|
{
|
|
|
|
|
Source = image
|
|
|
|
|
};
|
|
|
|
|
// Image is a sprite, load it
|
|
|
|
|
LoadedSpriteGrid loadedSprite = null;
|
|
|
|
|
foreach (LoadedSpriteGrid item in ClientLoadedSprites.Children)
|
|
|
|
|
{
|
|
|
|
|
// If the image already exists, replace the current image with the new one
|
|
|
|
|
if (item.Equals(e.Message))
|
|
|
|
|
{
|
|
|
|
|
loadedSprite = item;
|
|
|
|
|
// Set the image to the new loaded image
|
|
|
|
|
Dispatcher.Invoke(() => loadedSprite.FrameImage = spriteImage);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (loadedSprite == null)
|
|
|
|
|
{
|
|
|
|
|
loadedSprite = new LoadedSpriteGrid(spriteImage, e.Message);
|
|
|
|
|
// Listen to any selection event
|
|
|
|
|
loadedSprite.MouseDown += SpriteImage_Tapped;
|
|
|
|
|
loadedSprite.TouchDown += SpriteImage_Tapped;
|
|
|
|
|
loadedSprite.StylusDown += SpriteImage_Tapped;
|
|
|
|
|
// Add the loaded image into the view
|
|
|
|
|
Dispatcher.Invoke(() => ClientLoadedSprites.Children.Add(loadedSprite));
|
|
|
|
|
}
|
2021-10-17 16:40:26 +13:00
|
|
|
|
}
|
2021-10-17 16:28:58 +13:00
|
|
|
|
}
|
2021-10-17 16:04:08 +13:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-17 16:40:26 +13:00
|
|
|
|
LoadedSpriteGrid currentlySelected = null;
|
|
|
|
|
|
|
|
|
|
private void SpriteImage_Tapped(object sender, InputEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
currentlySelected.frame.BorderThickness = new Thickness(0, 0, 0, 0);
|
|
|
|
|
currentlySelected = sender as LoadedSpriteGrid;
|
|
|
|
|
currentlySelected.frame.BorderThickness = new Thickness(3, 3, 3, 3);
|
2021-10-18 11:48:10 +13:00
|
|
|
|
// Finally, enable the button
|
|
|
|
|
CheckEnableVis();
|
2021-10-17 16:40:26 +13:00
|
|
|
|
}
|
2021-10-18 11:48:10 +13:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Every check required to enable the 'Join Server' button
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void CheckEnableVis()
|
|
|
|
|
{
|
|
|
|
|
if (currentlySelected != null && PlayerNameBox.Text != "" && client.Connected)
|
|
|
|
|
ClientStartGameButton.IsEnabled = true;
|
|
|
|
|
else
|
|
|
|
|
ClientStartGameButton.IsEnabled = false;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Layout that comprises of a Border containing an Image
|
|
|
|
|
/// </summary>
|
2021-10-17 16:04:08 +13:00
|
|
|
|
internal class LoadedSpriteGrid : Grid
|
|
|
|
|
{
|
|
|
|
|
string imageName;
|
2021-10-17 16:40:26 +13:00
|
|
|
|
public Border frame;
|
2021-10-18 11:48:10 +13:00
|
|
|
|
public Image FrameImage { get; set; }
|
2021-10-17 16:04:08 +13:00
|
|
|
|
public LoadedSpriteGrid(Image spriteImage, string imageName)
|
|
|
|
|
{
|
2021-10-18 11:48:10 +13:00
|
|
|
|
FrameImage = spriteImage;
|
|
|
|
|
frame = new();
|
|
|
|
|
frame.Child = FrameImage;
|
2021-10-17 16:40:26 +13:00
|
|
|
|
frame.BorderThickness = new Thickness(0, 0, 0, 0);
|
|
|
|
|
frame.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 0, 100, 200));
|
|
|
|
|
Children.Add(frame);
|
2021-10-17 16:04:08 +13:00
|
|
|
|
this.imageName = imageName;
|
|
|
|
|
}
|
2021-10-17 16:40:26 +13:00
|
|
|
|
|
2021-10-18 11:48:10 +13:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets if the two grids are referencing the same image (regardless of the loaded mip level)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
/// <returns></returns>
|
2021-10-17 16:04:08 +13:00
|
|
|
|
public new bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
if (obj == null || GetType() != obj.GetType())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-10-18 11:48:10 +13:00
|
|
|
|
string otherName = ((LoadedSpriteGrid)obj).imageName.Replace(App.MIP_LOW, "").Replace(App.MIP_MEDIUM, "").Replace(App.MIP_HIGH, "").Replace(App.MIP_RAW, "");
|
|
|
|
|
string tName = imageName.Replace(App.MIP_LOW, "").Replace(App.MIP_MEDIUM, "").Replace(App.MIP_HIGH, "").Replace(App.MIP_RAW, "");
|
|
|
|
|
|
|
|
|
|
return tName.Equals(otherName);
|
2021-10-17 16:04:08 +13:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-18 11:48:10 +13:00
|
|
|
|
|
|
|
|
|
private void PlayerNameBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CheckEnableVis();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// ************************************************************
|
|
|
|
|
// *************** Server Connection Logic *******************
|
|
|
|
|
// ************************************************************
|
|
|
|
|
#region server connection logic
|
2021-10-18 12:05:45 +13:00
|
|
|
|
private static readonly SolidColorBrush borderBrush = new(Color.FromRgb(255, 0, 0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void BrowseButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OpenFileDialog ofd = new();
|
|
|
|
|
ofd.Filter = "Image Files|*.png;*.jpg";
|
|
|
|
|
if (ofd.ShowDialog() == true)
|
|
|
|
|
{
|
|
|
|
|
ImageSourceTextBox.Text = ofd.FileName;
|
2021-11-02 15:02:12 +13:00
|
|
|
|
|
|
|
|
|
Task.Run(() => UpdateImage(ofd.FileName));
|
|
|
|
|
|
2021-10-18 12:05:45 +13:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Update the image when the text box looses focus
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void ImageSourceTextBox_LostFocus(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
2021-11-02 15:02:12 +13:00
|
|
|
|
//UpdateImage().Start();
|
2021-10-18 12:05:45 +13:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-02 15:02:12 +13:00
|
|
|
|
private void UpdateImage(string sourceFile)
|
2021-10-18 12:05:45 +13:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CommunicationHandler host = App.Context.GameCommunicationHandler;
|
2021-11-02 15:02:12 +13:00
|
|
|
|
using FileStream fs = File.OpenRead(sourceFile);
|
2021-10-18 12:05:45 +13:00
|
|
|
|
using MemoryStream ms = new();
|
|
|
|
|
|
|
|
|
|
fs.CopyTo(ms);
|
|
|
|
|
// Calc mips
|
|
|
|
|
ms.Position = 0;
|
2021-11-02 15:02:12 +13:00
|
|
|
|
App.Context.LoadStream(ms, sourceFile, false);
|
2021-10-18 12:05:45 +13:00
|
|
|
|
ms.Position = 0;
|
2021-11-02 15:02:12 +13:00
|
|
|
|
|
|
|
|
|
this.Dispatcher.Invoke(() => {
|
|
|
|
|
BitmapImage gameBoardImage = new();
|
|
|
|
|
gameBoardImage.BeginInit();
|
|
|
|
|
gameBoardImage.StreamSource = ms;
|
|
|
|
|
gameBoardImage.CacheOption = BitmapCacheOption.OnLoad;
|
|
|
|
|
gameBoardImage.EndInit();
|
|
|
|
|
PreviewImage.Source = gameBoardImage;
|
|
|
|
|
RedrawGrid();
|
|
|
|
|
}, System.Windows.Threading.DispatcherPriority.Render);
|
|
|
|
|
|
2021-10-18 12:05:45 +13:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws the overlay grid, clearing existing elements if necessary
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void RedrawGrid()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
PreviewImageOverlay.RowDefinitions.Clear();
|
|
|
|
|
PreviewImageOverlay.ColumnDefinitions.Clear();
|
|
|
|
|
PreviewImageOverlay.Children.Clear();
|
|
|
|
|
for (int i = 0; i < NumberOfColumns.Value; i++)
|
|
|
|
|
{
|
|
|
|
|
PreviewImageOverlay.ColumnDefinitions.Add(new ColumnDefinition());
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < NumberOfRows.Value; i++)
|
|
|
|
|
{
|
|
|
|
|
PreviewImageOverlay.RowDefinitions.Add(new RowDefinition());
|
|
|
|
|
}
|
|
|
|
|
// Draw the overlay
|
|
|
|
|
Rectangle overlay = new();
|
|
|
|
|
overlay.Fill = new SolidColorBrush(Color.FromArgb(128, 0, 128, 255));
|
|
|
|
|
_ = PreviewImageOverlay.Children.Add(overlay);
|
|
|
|
|
Grid.SetRow(overlay, (int)ZoomBoxStartRow.Value);
|
|
|
|
|
Grid.SetColumn(overlay, (int)ZoomBoxStartColumn.Value);
|
|
|
|
|
Grid.SetRowSpan(overlay, (int)ZoomBoxSpan.Value);
|
|
|
|
|
Grid.SetColumnSpan(overlay, (int)ZoomBoxSpan.Value);
|
|
|
|
|
// Draw the starting position
|
|
|
|
|
overlay = new();
|
|
|
|
|
overlay.Fill = new SolidColorBrush(Color.FromArgb(64, 0, 255, 128));
|
|
|
|
|
_ = PreviewImageOverlay.Children.Add(overlay);
|
|
|
|
|
Grid.SetRow(overlay, (int)StartingRow.Value);
|
|
|
|
|
Grid.SetColumn(overlay, (int)StartingColumn.Value);
|
|
|
|
|
// Draw grids onto the preview image
|
|
|
|
|
for (int v = 0; v < PreviewImageOverlay.RowDefinitions.Count; v++)
|
|
|
|
|
{
|
|
|
|
|
for (int u = 0; u < PreviewImageOverlay.ColumnDefinitions.Count; u++)
|
|
|
|
|
{
|
|
|
|
|
Border border = new();
|
|
|
|
|
border.BorderBrush = borderBrush;
|
|
|
|
|
border.BorderThickness = new Thickness(2);
|
|
|
|
|
_ = PreviewImageOverlay.Children.Add(border);
|
|
|
|
|
Grid.SetRow(border, v);
|
|
|
|
|
Grid.SetColumn(border, u);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-18 12:23:54 +13:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Loads the selected sprites into the image list
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void GameSpritesBrowser_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CommunicationHandler host = App.Context.GameCommunicationHandler;
|
|
|
|
|
OpenFileDialog ofd = new();
|
|
|
|
|
ofd.Filter = "Image Files|*.png;*.jpg;*.gif";
|
|
|
|
|
ofd.Multiselect = true;
|
|
|
|
|
if (ofd.ShowDialog() == true)
|
|
|
|
|
{
|
|
|
|
|
string[] resultFiles = ofd.FileNames;
|
|
|
|
|
// Clear existing sprites
|
|
|
|
|
host.ClearSprites();
|
|
|
|
|
// Finally, load the sprites
|
|
|
|
|
foreach (string file in resultFiles)
|
|
|
|
|
{
|
|
|
|
|
using FileStream fs = File.OpenRead(file);
|
|
|
|
|
string fileName = Path.GetFileName(file);
|
|
|
|
|
host.ImageList.Add(fileName);
|
|
|
|
|
App.Context.LoadStream(fs, fileName, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-02 15:02:12 +13:00
|
|
|
|
private void GridVisibilityToggleButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
PreviewImageOverlay.Visibility = PreviewImageOverlay.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Performs the logic required to start the server
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void StartServerButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CommunicationHandler host = App.Context.GameCommunicationHandler;
|
|
|
|
|
host.InitialiseServer((int)NumberOfRows.Value, (int)NumberOfColumns.Value, (int)ZoomBoxStartRow.Value, (int)ZoomBoxStartColumn.Value, (int)ZoomBoxSpan.Value, (int)ZoomBoxSpan.Value, (int)StartingRow.Value, (int)StartingColumn.Value);
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 12:05:45 +13:00
|
|
|
|
|
2021-10-18 11:48:10 +13:00
|
|
|
|
|
|
|
|
|
#endregion
|
2021-10-18 12:23:54 +13:00
|
|
|
|
|
2021-11-02 15:02:12 +13:00
|
|
|
|
private void Sliders_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
|
|
{
|
2021-10-18 12:23:54 +13:00
|
|
|
|
|
2021-11-02 15:02:12 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void NumberOfRows_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DrawRandomizedPlayers_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void NumberOfColumns_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2021-10-17 13:16:40 +13:00
|
|
|
|
}
|
|
|
|
|
}
|