示例#1
0
        /// <summary>
        /// Loads a  new event into the model.
        /// </summary>
        /// <param name="message">load new event message</param>
        private void LoadNewEvent(
            LoadNewEventMessage message)
        {
            bool success = true;

            this.Name = message.Name;

            try
            {
                if (string.IsNullOrEmpty(this.Name))
                {
                    this.ResultsTable = new EventResults();
                    this.Summary      = new Summary();
                    this.Date         = new DateType();
                }
                else
                {
                    EventMiscData misc =
                        this.eventData.LoadEventData(
                            this.seasonName,
                            this.Name);
                    this.Date = misc.EventDate;

                    this.ResultsTable =
                        this.resultsTableReader.LoadResultsTable(
                            this.seasonName,
                            this.Name,
                            misc.EventDate);

                    this.Summary =
                        this.summaryData.LoadSummaryData(
                            this.seasonName,
                            this.Name);
                }
            }
            catch (Exception ex)
            {
                this.logger.WriteLog($"Failed to load new event ({this.Name}): {ex}");
            }

            if (success)
            {
                Messenger.Default.Send(
                    new HandicapProgressMessage(
                        $"New Event Loaded - {this.Name}"));

                this.logger.WriteLog($"Event, loaded {this.Name}");
            }
        }
示例#2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="EventHC"/> class
        /// </summary>
        /// <param name="eventData">event data</param>
        /// <param name="summaryData">summary data</param>
        /// <param name="resultsTableReader">results table reader</param>
        /// <param name="rawEventIo">raw events IO manager</param>
        /// <param name="logger">application logger</param>
        public EventHC(
            IEventData eventData,
            ISummaryData summaryData,
            IResultsTableReader resultsTableReader,
            IRawEventIo rawEventIo,
            IJHcLogger logger)
        {
            this.eventData          = eventData;
            this.summaryData        = summaryData;
            this.resultsTableReader = resultsTableReader;
            this.rawEventIo         = rawEventIo;
            this.logger             = logger;

            this.Name         = string.Empty;
            this.seasonName   = string.Empty;
            this.Date         = new DateType();
            this.summary      = new Summary();
            this.resultsTable = new EventResults();

            Messenger.Default.Register <LoadNewSeasonMessage>(this, this.NewSeasonSelected);
            Messenger.Default.Register <LoadNewEventMessage>(this, this.LoadNewEvent);
        }
示例#3
0
 /// <summary>
 /// Set the results and save them.
 /// </summary>
 /// <param name="results">results to save</param>
 public void SetResultsTable(IEventResults results)
 {
     this.ResultsTable = results;
 }