Ejemplo n.º 1
0
        public static void Search(Participants participants, Weather weather, EffortLevel effortLevel)
        {
            latestParticipants = participants;
            latestWeather      = weather;
            latestEffortLevel  = effortLevel;

            if (approvedSports.Count < 1)
            {
                foreach (Sport sport in sports)
                {
                    if (ParticipantsCondition(sport.participants, participants) && WeatherCondition(sport.weather, weather) && EffortLevelCondition(sport.effortLevel, effortLevel))
                    {
                        approvedSports.Add(sport);
                    }
                }
            }
            if (approvedSports.Count >= 1)
            {
                currentSport = approvedSports[0];
                approvedSports.RemoveAt(0);
            }
            else
            {
                currentSport = null;
            }
        }
Ejemplo n.º 2
0
 public Sport(string _name, Participants _participants, Weather _weather, EffortLevel _effortLevel, string _imagePath)
 {
     name         = _name;
     participants = _participants;
     weather      = _weather;
     effortLevel  = _effortLevel;
     imagePath    = _imagePath;
 }
Ejemplo n.º 3
0
 private static bool EffortLevelCondition(EffortLevel sportValue, EffortLevel userPreference)
 {
     return(sportValue == EffortLevel.Any || userPreference == EffortLevel.Any || userPreference == sportValue);
 }