Exemplo n.º 1
0
        private Message CreateMessage(Serialization.MessageData messageData)
        {
            switch (messageData.MessageType)
            {
            case MessageType.Empty:
            case MessageType.EstimationStarted:
            case MessageType.EstimationCanceled:
                return(new Message(messageData));

            case MessageType.MemberJoined:
            case MessageType.MemberDisconnected:
            case MessageType.MemberEstimated:
                var member = Team.FindMemberOrObserver(messageData.MemberName);
                if (member == null)
                {
                    member = new Member(Team, messageData.MemberName);
                }

                return(new MemberMessage(messageData)
                {
                    Member = member
                });

            case MessageType.EstimationEnded:
                var estimationResult = new EstimationResult(Team, messageData.EstimationResult);
                estimationResult.SetReadOnly();
                return(new EstimationResultMessage(messageData)
                {
                    EstimationResult = estimationResult
                });

            default:
                throw new ArgumentException($"Invalid message type {messageData.MessageType}.", nameof(messageData));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EstimationResultMessage"/> class.
 /// </summary>
 /// <param name="messageData">Message serialization data.</param>
 internal EstimationResultMessage(Serialization.MessageData messageData)
     : base(messageData)
 {
 }