To make it easier to recognize whether a message is coming from the server or whether it is being sent by the user of the device that the code is executing on, we will create a LocalSimpleTextMessage:
-
Create a new class called LocalSimpleTextMessage in the Chat.Messages project.
-
Add SimpleTextMessage as the base class.
-
Create a constructor with SimpleTextMessage as the parameter.
-
Set the value to all of the base properties with the value from the parameter, as shown in the following code:
public class LocalSimpleTextMessage : SimpleTextMessage
{
public LocalSimpleTextMessage(SimpleTextMessage message)
{
Id = message.Id;
Text = message.Text;
Timestamp = message.Timestamp;
Username = message.Username;
TypeInfo = message.TypeInfo;
}
}