示例#1
0
        private void PopulateSubInAndOutDropDowns()
        {
            if (Clock != null)
            {
                if (SelectedStatCategory.StatCategory.StatCategoryName == AppResources.Substitution)
                {
                    int elapsedTimeInGameInSeconds = StatCalculationsModule.CalculateTimeElapsedInGameInSeconds(Game.Game, Convert.ToInt32(SelectedPeriod), Clock);

                    //The players IN the game at this time should appear in the dropdown PLAYER OUT (i.e. if they are in the game, they can come OUT) (vice versa)
                    SubPlayerOutList = DAL.Instance().GetPlayersInAndOutAtAGivenPointInGame(Game.Game.GameID, SelectedTeam.TeamID, elapsedTimeInGameInSeconds, "IN");
                    SubPlayerInList  = DAL.Instance().GetPlayersInAndOutAtAGivenPointInGame(Game.Game.GameID, SelectedTeam.TeamID, elapsedTimeInGameInSeconds, "OUT");
                }
            }
            else
            {
                SubPlayerInList  = new ObservableCollection <TeamRosterModel>();
                SubPlayerOutList = new ObservableCollection <TeamRosterModel>();
            }

            //Set Sub Player In
            foreach (var item in SubPlayerInList)
            {
                SelectedPlayerIn = item;
                break;
            }

            //Set Sub Player Out
            foreach (var item in SubPlayerOutList)
            {
                SelectedPlayerOut = item;
                break;
            }
        }
示例#2
0
        public bool ValidateScreen()
        {
            bool rtnValue = true;
            int  elapsedTimeInGameInSeconds;

            try
            {
                elapsedTimeInGameInSeconds = StatCalculationsModule.CalculateTimeElapsedInGameInSeconds(Game.Game, Game.Game.CurrentPeriod, Game.Game.CurrentClock);

                if (Clock == string.Empty || Clock == null)
                {
                    MessageBox.Show(AppResources.ClockNotEntered, _messageBoxTitle, MessageBoxButton.OK);
                    rtnValue = false;
                }
                else
                {
                    //Make sure this is not a period/clock time that is in the future, that is what Game Manager is for.
                    int elapsedTimeOfThisPlayInSeconds = StatCalculationsModule.CalculateTimeElapsedInGameInSeconds(Game.Game, Convert.ToInt32(SelectedPeriod), Clock);

                    if (elapsedTimeOfThisPlayInSeconds > elapsedTimeInGameInSeconds)
                    {
                        MessageBox.Show(AppResources.PeriodClockValueInFuture, _messageBoxTitle, MessageBoxButton.OK);
                        rtnValue = false;
                    }
                }

                return(rtnValue);
            }
            catch (Exception ex)
            {
                return(rtnValue);
            }
        }