/// <summary> /// Requests that a season is loaded into memory. /// </summary> /// <remarks> /// This will create the season.txt file if one is not already present. /// </remarks> private void LoadSeason() { if (this.SelectedSeasonIndex >= 0 && this.SelectedSeasonIndex < this.Seasons.Count) { string seasonName = this.Seasons[this.SelectedSeasonIndex]; this.logger.WriteLog("Load season " + seasonName); LoadNewSeasonMessage message = new LoadNewSeasonMessage( seasonName); Messenger.Default.Send(message); } }
/// <summary> /// Load a new season into the model. /// </summary> /// <param name="message">load a new season message</param> private void LoadNewSeason(LoadNewSeasonMessage message) { bool success = true; this.Name = message.Name; try { if (string.IsNullOrEmpty(this.Name)) { this.Summary = new Summary(); this.Athletes = new List <IAthleteSeasonDetails>(); this.Clubs = new List <IClubSeasonDetails>(); this.Events = new List <string>(); } else { this.Summary = this.summaryData.LoadSummaryData( this.Name); this.Athletes = this.athleteData.LoadAthleteSeasonData( this.Name, this.resultsConfigurationManager); this.Clubs = this.clubData.LoadClubSeasonData(this.Name); this.Events = this.eventIo.GetEvents( this.Name); } } catch (Exception ex) { this.logger.WriteLog($"Season, Failed to load Season {ex}"); success = false; } if (success) { Messenger.Default.Send( new HandicapProgressMessage( $"New Season Loaded - {this.Name}")); this.logger.WriteLog($"Season, loaded {this.Name}"); } this.AthleteCollectionChangedEvent?.Invoke(this, EventArgs.Empty); }
/// <summary> /// A new season has been selected, reinitialise the view model to reflect the new season. /// </summary> /// <param name="message">the load new season message</param> private void NewSeasonSelected(LoadNewSeasonMessage message) { this.seasonName = message.Name; this.InitialiseEventPane(); }
/// <summary> /// Saves the selected season to file and make a note of the season name. /// </summary> /// <param name="season">load season message</param> private void NewCurrentSeason(LoadNewSeasonMessage message) { this.currentSeason = message.Name; this.seasonIO.SaveCurrentSeason(message.Name); }
/// <summary> /// Save the name of the currently selected season /// </summary> /// <param name="message">the load new season message</param> private void NewSeasonSelected(LoadNewSeasonMessage message) { this.seasonName = message.Name; }