コード例 #1
0
        /// <summary>
        /// Creates new Scrum team with specified team name and Scrum master name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="scrumMasterName">Name of the Scrum master.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// Created Scrum team.
        /// </returns>
        public Task <ScrumTeam> CreateTeam(string teamName, string scrumMasterName, CancellationToken cancellationToken)
        {
            return(InvokeOperation(async() =>
            {
                await EnsureConnected(cancellationToken);
                var result = await _hubConnection.InvokeAsync <ScrumTeam>("CreateTeam", teamName, scrumMasterName, cancellationToken);

                ScrumTeamMapper.ConvertScrumTeam(result);
                return result;
            }));
        }
コード例 #2
0
        /// <summary>
        /// Connects member or observer with specified name to the Scrum team with specified name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member or observer.</param>
        /// <param name="asObserver">If set to <c>true</c> then connects as observer; otherwise as member.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// The Scrum team the member or observer joined to.
        /// </returns>
        public Task <ScrumTeam> JoinTeam(string teamName, string memberName, bool asObserver, CancellationToken cancellationToken)
        {
            return(InvokeOperation(async() =>
            {
                await EnsureConnected(cancellationToken);
                var result = await _hubConnection.InvokeAsync <ScrumTeam>("JoinTeam", teamName, memberName, asObserver, cancellationToken);

                ScrumTeamMapper.ConvertScrumTeam(result);
                return result;
            }));
        }
コード例 #3
0
        /// <summary>
        /// Creates new Scrum team with specified team name and Scrum master name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="scrumMasterName">Name of the Scrum master.</param>
        /// <param name="deck">Selected deck of estimation cards to use in the team.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// Created Scrum team.
        /// </returns>
        public async Task <TeamResult> CreateTeam(string teamName, string scrumMasterName, Deck deck, CancellationToken cancellationToken)
        {
            var encodedTeamName        = _urlEncoder.Encode(teamName);
            var encodedScrumMasterName = _urlEncoder.Encode(scrumMasterName);
            var uri = $"CreateTeam?teamName={encodedTeamName}&scrumMasterName={encodedScrumMasterName}&deck={deck}";

            var result = await GetJsonAsync <TeamResult>(uri, cancellationToken);

            ScrumTeamMapper.ConvertScrumTeam(result.ScrumTeam);
            return(result);
        }
コード例 #4
0
        /// <summary>
        /// Reconnects member with specified name to the Scrum team with specified name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// The Scrum team the member or observer reconnected to.
        /// </returns>
        /// <remarks>
        /// This operation is used to resynchronize client and server. Current status of ScrumTeam is returned and message queue for the member is cleared.
        /// </remarks>
        public Task <ReconnectTeamResult> ReconnectTeam(string teamName, string memberName, CancellationToken cancellationToken)
        {
            return(InvokeOperation(async() =>
            {
                await EnsureConnected(cancellationToken);
                var result = await _hubConnection.InvokeAsync <ReconnectTeamResult>("ReconnectTeam", teamName, memberName, cancellationToken);

                ScrumTeamMapper.ConvertScrumTeam(result.ScrumTeam);
                ScrumTeamMapper.ConvertEstimation(result.SelectedEstimation);
                return result;
            }));
        }
コード例 #5
0
        /// <summary>
        /// Reconnects member with specified name to the Scrum team with specified name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// The Scrum team the member or observer reconnected to.
        /// </returns>
        /// <remarks>
        /// This operation is used to resynchronize client and server. Current status of ScrumTeam is returned and message queue for the member is cleared.
        /// </remarks>
        public async Task <ReconnectTeamResult> ReconnectTeam(string teamName, string memberName, CancellationToken cancellationToken)
        {
            var encodedTeamName   = _urlEncoder.Encode(teamName);
            var encodedMemberName = _urlEncoder.Encode(memberName);
            var uri = $"ReconnectTeam?teamName={encodedTeamName}&memberName={encodedMemberName}";

            var result = await GetJsonAsync <ReconnectTeamResult>(uri, cancellationToken);

            ScrumTeamMapper.ConvertScrumTeam(result.ScrumTeam);
            ScrumTeamMapper.ConvertEstimation(result.SelectedEstimation);
            return(result);
        }
コード例 #6
0
        /// <summary>
        /// Connects member or observer with specified name to the Scrum team with specified name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member or observer.</param>
        /// <param name="asObserver">If set to <c>true</c> then connects as observer; otherwise as member.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// The Scrum team the member or observer joined to.
        /// </returns>
        public async Task <TeamResult> JoinTeam(string teamName, string memberName, bool asObserver, CancellationToken cancellationToken)
        {
            var encodedTeamName   = _urlEncoder.Encode(teamName);
            var encodedMemberName = _urlEncoder.Encode(memberName);
            var encodedAsObserver = asObserver.ToString(CultureInfo.InvariantCulture);
            var uri = $"JoinTeam?teamName={encodedTeamName}&memberName={encodedMemberName}&asObserver={encodedAsObserver}";

            var result = await GetJsonAsync <TeamResult>(uri, cancellationToken);

            ScrumTeamMapper.ConvertScrumTeam(result.ScrumTeam);
            return(result);
        }
コード例 #7
0
        /// <summary>
        /// Begins to get messages of specified member asynchronously.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="lastMessageId">ID of last message the member received.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// List of messages.
        /// </returns>
        public async Task <IList <Message> > GetMessages(string teamName, string memberName, long lastMessageId, CancellationToken cancellationToken)
        {
            var encodedTeamName      = _urlEncoder.Encode(teamName);
            var encodedMemberName    = _urlEncoder.Encode(memberName);
            var encodedLastMessageId = _urlEncoder.Encode(lastMessageId.ToString(CultureInfo.InvariantCulture));
            var uri = $"GetMessages?teamName={encodedTeamName}&memberName={encodedMemberName}&lastMessageId={encodedLastMessageId}";

            var result = await GetJsonAsync <List <Message> >(uri, cancellationToken);

            ScrumTeamMapper.ConvertMessages(result);
            return(result);
        }
コード例 #8
0
        /// <summary>
        /// Begins to get messages of specified member asynchronously.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member.</param>
        /// <param name="lastMessageId">ID of last message the member received.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>
        /// List of messages.
        /// </returns>
        public Task <IList <Message> > GetMessages(string teamName, string memberName, long lastMessageId, CancellationToken cancellationToken)
        {
            return(InvokeOperation(async() =>
            {
                await EnsureConnected(cancellationToken);

                try
                {
                    Task <IList <Message> > getMessagesTask;

                    lock (_getMessagesLock)
                    {
                        if (_getMessagesTask != null)
                        {
                            throw new InvalidOperationException("GetMessages is already in progress.");
                        }

                        _getMessagesTask = new TaskCompletionSource <IList <Message> >();
                        getMessagesTask = _getMessagesTask.Task;
                    }

                    await _hubConnection.InvokeAsync("GetMessages", teamName, memberName, lastMessageId, cancellationToken);

                    var result = await getMessagesTask;
                    ScrumTeamMapper.ConvertMessages(result);
                    return result;
                }
                finally
                {
                    lock (_getMessagesLock)
                    {
                        _getMessagesTask?.TrySetCanceled();
                        _getMessagesTask = null;
                    }
                }
            }));
        }