1
0
Fork 0

Send an ErrorMessage to the client if they try to draw a line before selecting a plane

This commit is contained in:
Starbeamrainbowlabs 2017-04-23 17:22:21 +01:00
parent 48056bd888
commit 363fdbb20c
2 changed files with 10 additions and 2 deletions

View File

@ -5,12 +5,12 @@ namespace Nibriboard.Client.Messages
/// Represents a complaint (usually by the server) about something that the other party
/// has done that probably shouldn't have.
/// </summary>
public class ErrorMessage
public class ErrorMessage : Message
{
/// <summary>
/// The message describing the error that has occurred.
/// </summary>
string Message;
public string Message;
public ErrorMessage()
{

View File

@ -375,6 +375,14 @@ namespace Nibriboard.Client
line.LineWidth = message.LineWidth;
line.Colour = message.LineColour;
if(CurrentPlane == null)
{
Send(new ErrorMessage() {
Message = "Error: You can't complete a line until you've selected a plane" +
"to draw it on!"
});
return;
}
await CurrentPlane.AddLine(line);
}