/// <summary> /// Initialises a new instance of the <see cref="AthleteConfigurationViewModel"/> class. /// </summary> /// <param name="model">handicap model</param> /// <param name="seriesConfigManager">series configutation manager</param> public AthleteConfigurationViewModel( IModel model, ISeriesConfigMngr seriesConfigManager) { this.model = model; this.athleteCollection = new ObservableCollection <AthleteType>(); this.changePredeclaredHandicap = string.Empty; this.numberPrefix = seriesConfigManager.ReadNumberPrefix(); LoadAthleteInformation(); ClubCollection.Add(new ClubType() { Club = string.Empty }); // Order clubs alphabetically. List <string> clubs = model.GetClubList().OrderBy(club => club).ToList(); foreach (string club in clubs) { ClubCollection.Add(new ClubType() { Club = club }); } this.newRaceNumber = this.NextRunningNumber; this.addRaceNumber = this.NextRunningNumber; // Search parameters this.searchString = string.Empty; this.surnameLetterSelectorCollection = new List <string>() { "", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "X", "Y", "Z" }; this.surnameSelectorIndex = 0; AthleteAddNumberCommand = new AthleteConfigAddNumberCmd(this); //AthleteChangeCommand = new AthleteConfigChangeCmd(this); this.AthleteChangeCommand = new SimpleCommand( this.ChangeAthlete, this.CanChange); //AthleteDeleteCommand = new AthleteConfigDeleteCmd(this); this.AthleteDeleteCommand = new SimpleCommand( this.DeleteAthlete, this.CanDelete); this.AthleteNewCommand = new SimpleCommand( this.AddNewAthlete, this.CanAdd); //AthleteNewCommand = new AthleteConfigNewCmd(this); //AthleteSaveCommand = new AthleteConfigSaveCmd(this); this.AthleteSaveCommand = new SimpleCommand( this.SaveAthletes, this.CanSave); }
/// ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- /// <name>AddNewClub</name> /// <date>24/02/15</date> /// <summary> /// Adds a new club and resets the NewClub property. /// </summary> /// ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- public void AddNewClub() { ClubCollection.Add(new ClubType() { Club = NewClub, Status = StatusType.Added }); NewClub = string.Empty; saved = false; }