Esempio n. 1
0
        /// <summary>
        /// Creates new Scrum Team and initialize Planning Poker game.
        /// </summary>
        /// <param name="teamName">Name of the team.</param>
        /// <param name="scrumMasterName">Name of Scrum Master.</param>
        /// <returns><c>True</c> if the operation was successful; otherwise <c>false</c>.</returns>
        public async Task <bool> CreateTeam(string teamName, string scrumMasterName)
        {
            if (string.IsNullOrEmpty(teamName) || string.IsNullOrEmpty(scrumMasterName))
            {
                return(false);
            }

            try
            {
                ScrumTeam team = null;
                using (_busyIndicatorService.Show())
                {
                    team = await _planningPokerService.CreateTeam(teamName, scrumMasterName, CancellationToken.None);
                }

                if (team != null)
                {
                    await _planningPokerInitializer.InitializeTeam(team, scrumMasterName);

                    ControllerHelper.OpenPlanningPokerPage(_uriHelper, team, scrumMasterName);
                    return(true);
                }
            }
            catch (PlanningPokerException ex)
            {
                var message = ControllerHelper.GetErrorMessage(ex);
                await _messageBoxService.ShowMessage(message, Resources.MessagePanel_Error);
            }

            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Joins existing Scrum Team and initialize Planning Poker game.
        /// </summary>
        /// <param name="teamName">Name of the team.</param>
        /// <param name="memberName">Name of the joining member.</param>
        /// <param name="asObserver"><c>True</c> if member is joining as observer only; otherwise <c>false</c>.</param>
        /// <returns><c>True</c> if the operation was successful; otherwise <c>false</c>.</returns>
        public async Task <bool> JoinTeam(string teamName, string memberName, bool asObserver)
        {
            if (string.IsNullOrEmpty(teamName) || string.IsNullOrEmpty(memberName))
            {
                return(false);
            }

            try
            {
                ScrumTeam team = null;
                using (_busyIndicatorService.Show())
                {
                    team = await _planningPokerService.JoinTeam(teamName, memberName, asObserver, CancellationToken.None);
                }

                if (team != null)
                {
                    await _planningPokerInitializer.InitializeTeam(team, memberName);

                    ControllerHelper.OpenPlanningPokerPage(_uriHelper, team, memberName);
                    return(true);
                }
            }
            catch (PlanningPokerException ex)
            {
                var message = ex.Message;
                if (message.IndexOf(MemberExistsError1, StringComparison.OrdinalIgnoreCase) >= 0 &&
                    message.IndexOf(MemberExistsError2, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    message = ControllerHelper.GetErrorMessage(ex);
                    message = $"{message}{Environment.NewLine}{Resources.JoinTeam_ReconnectMessage}";
                    if (await _messageBoxService.ShowMessage(message, Resources.JoinTeam_ReconnectTitle, Resources.JoinTeam_ReconnectButton))
                    {
                        return(await ReconnectTeam(teamName, memberName, false, CancellationToken.None));
                    }
                }
                else
                {
                    message = ControllerHelper.GetErrorMessage(ex);
                    await _messageBoxService.ShowMessage(message, Resources.MessagePanel_Error);
                }
            }

            return(false);
        }