Beispiel #1
0
        /// <summary>
        /// Initialises a new instance of the <see cref="SeasonPaneViewModel"/> class.
        /// </summary>
        /// <param name="model"></param>
        /// <param name="businessLayerManager"></param>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="logger">program logger</param>
        public SeasonPaneViewModel(
            IModel model,
            IBLMngr businessLayerManager,
            IGeneralIo generalIo,
            IJHcLogger logger)
        {
            this.logger = logger;
            this.model  = model;
            this.businessLayerManager = businessLayerManager;
            this.generalIo            = generalIo;

            OpenAthleteSeasonSummaryCommand =
                new SimpleCommand(
                    this.OpenAthleteSeasonSummaryDialog,
                    this.IsLocationValid);
            this.NewSeasonCommand =
                new SimpleCommand(
                    this.EnableNewSeasonFields,
                    this.IsLocationValid);
            this.AddSeasonCommand =
                new SimpleCommand(
                    this.AddNewSeason,
                    this.NewSeasonValid);
            CancelSeasonCommand =
                new SimpleCommand(
                    this.CancelNewSeasonFields);

            this.InitialiseSeasonPane();

            this.LoadSeason();

            Messenger.Default.Register <NewSeriesLoadedMessage>(this, this.NewSeriesLoaded);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="PrimaryDisplayViewModel"/> class
        /// </summary>
        /// <param name="model">application model</param>
        /// <param name="businessLayerManager">business layer manager</param>
        /// <param name="normalisationConfigurationManager">normalisation configuration manager</param>
        /// <param name="resultsConfigurationManager">results configuration manager</param>
        /// <param name="seriesConfigurationManager">series configuration manager</param>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="commonIo">Common IO manager</param>
        /// <param name="logger">application logger</param>
        public PrimaryDisplayViewModel(
            IModel model,
            IBLMngr businessLayerManager,
            INormalisationConfigMngr normalisationConfigurationManager,
            IResultsConfigMngr resultsConfigurationManager,
            ISeriesConfigMngr seriesConfigurationManager,
            IGeneralIo generalIo,
            ICommonIo commonIo,
            IJHcLogger logger)
        {
            this.logger = logger;
            this.logger.WriteLog("HandicapMainViewModel created");
            this.model = model;
            this.normalisationConfigManager  = normalisationConfigurationManager;
            this.resultsConfigurationManager = resultsConfigurationManager;
            this.seriesConfigManager         = seriesConfigurationManager;
            this.businessLayerManager        = businessLayerManager;
            this.generalIo       = generalIo;
            this.commonIo        = commonIo;
            this.isValidLocation = this.businessLayerManager.IsValid;

            Messenger.Default.Register <HandicapErrorMessage>(this, this.PopulateErrorInformation);
            Messenger.Default.Register <HandicapProgressMessage>(this, this.PopulateProgressInformation);
            Messenger.Default.Register <ValidLocationMessage>(this, this.InvalidLocationMessage);

            this.InitialiseViewModels();
            this.InitialiseOpenAppCommands();
        }
Beispiel #3
0
 /// <summary>
 /// Initialises a new instance of the <see cref="NormalisationConfigMngr"/> class
 /// </summary>
 /// <param name="generalIo">general IO manager</param>
 /// <param name="reader">normalisation config reader</param>
 /// <param name="logger">application logger</param>
 public NormalisationConfigMngr(
     IGeneralIo generalIo,
     INormalisationConfigReader reader,
     IJHcLogger logger)
 {
     this.generalIo = generalIo;
     this.reader    = reader;
     this.logger    = logger;
 }
Beispiel #4
0
 /// <summary>
 /// Initialises a new instance of the <see cref="SeriesConfigMngr"/> class
 /// </summary>
 /// <param name="generalIo">general IO manager</param>
 /// <param name="reader">series config reader</param>
 /// <param name="logger">application logger</param>
 public SeriesConfigMngr(
     IGeneralIo generalIo,
     ISeriesConfigReader reader,
     IJHcLogger logger)
 {
     this.generalIo = generalIo;
     this.reader    = reader;
     this.logger    = logger;
 }
Beispiel #5
0
        /// <summary>
        /// Initialises a new instance of the <see cref="ClubData"/> class.
        /// </summary>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="logger">application logger</param>
        public ClubData(
            IGeneralIo generalIo,
            IJHcLogger logger)
        {
            this.logger    = logger;
            this.generalIo = generalIo;

            this.clubDataReader =
                new ClubDataReader(
                    this.logger);
            this.clubSeasonDataReader =
                new ClubSeasonDataReader(
                    this.logger);
        }
Beispiel #6
0
        /// <summary>
        /// Initialise a new instance of the <see cref="ResultsConfigMngr"/> class.
        /// </summary>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="logger">application model</param>
        public ResultsConfigMngr(
            IGeneralIo generalIo,
            IJHcLogger logger)
        {
            this.logger              = logger;
            this.generalIo           = generalIo;
            this.configurationReader =
                new ResultsConfigReader(
                    logger);

            this.ResultsConfigurationDetails =
                this.configurationReader.LoadResultsConfigData(
                    this.generalIo.ResultsConfigurationFile);

            Messenger.Default.Register <LoadNewSeriesMessage>(this, this.LoadNewSeries);
        }
Beispiel #7
0
        /// <summary>
        /// Initialise a new instance of the <see cref="EventPaneViewModel"/> class.
        /// </summary>
        /// <param name="model">junior handicap model</param>
        /// <param name="businessLayerManager">business layer manager</param>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="commonIo">common IO manager</param>
        /// <param name="logger">application logger</param>
        public EventPaneViewModel(
            IModel model,
            IBLMngr businessLayerManager,
            IGeneralIo generalIo,
            ICommonIo commonIo,
            IEventIo eventIo,
            IJHcLogger logger)
        {
            this.model = model;
            this.businessLayerManager = businessLayerManager;
            this.generalIo            = generalIo;
            this.commonIo             = commonIo;
            this.eventIo = eventIo;
            this.logger  = logger;

            this.seasonName = this.model.CurrentSeason.Name;

            // TODO, this.IsLocationValid has been copied from PrimaryDisplayViewModel. Can this be rationalised.
            NewEventCommand =
                new SimpleCommand(
                    this.EnableNewEventFields,
                    this.IsLocationValid);
            AddEventCommand =
                new SimpleCommand(
                    this.AddNewEvent,
                    this.NewEventValid);
            CancelEventCommand =
                new SimpleCommand(
                    this.CancelNewEventFields);

            OpenEventRawResultsDlgCommand =
                new SimpleCommand(
                    this.OpenEventRawResultsDialog,
                    this.IsLocationValid);
            OpenEventImportResultsDlgCommand =
                new SimpleCommand(
                    this.OpenEventImportResultsDialog,
                    this.IsLocationValid);
            CalculateResultsCommand =
                new SimpleCommand(
                    this.CalculateResults,
                    this.CanCalculateResults);

            this.InitialiseEventPane();

            Messenger.Default.Register <LoadNewSeasonMessage>(this, this.NewSeasonSelected);
        }
Beispiel #8
0
        /// <summary>
        /// Prevents a new instance of the HandicapModel class from being created.
        /// </summary>
        /// <param name="normalisationConfigMngr">Normalisation configuration manager</param>
        /// <param name="resultsConfigurationManager">Results configuration manager</param>
        /// <param name="athleteData">athlete data</param>
        /// <param name="clubData">club data</param>
        /// <param name="eventData">event data</param>
        /// <param name="summaryData">summary data</param>
        /// <param name="resultsTableReader">results table reader</param>
        /// <param name="seasonIo">season IO Manager</param>
        /// <param name="eventIo">event IO manager</param>
        /// <param name="rawEventIo">raw event IO manager</param>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="logger">application logger</param>
        public Model(
            INormalisationConfigMngr normalisationConfigMngr,
            IResultsConfigMngr resultsConfigurationManager,
            IAthleteData athleteData,
            IClubData clubData,
            IEventData eventData,
            ISummaryData summaryData,
            IResultsTableReader resultsTableReader,
            ISeasonIO seasonIo,
            IEventIo eventIo,
            IRawEventIo rawEventIo,
            IGeneralIo generalIo,
            IJHcLogger logger)
        {
            this.normalisationConfigurationManager = normalisationConfigMngr;
            this.resultsConfigurationManager       = resultsConfigurationManager;
            this.athleteData = athleteData;
            this.clubData    = clubData;
            this.summaryData = summaryData;
            this.eventIo     = eventIo;
            this.seasonIo    = seasonIo;
            this.logger      = logger;

            // Setup local models.
            this.CurrentSeason =
                new Season(
                    resultsConfigurationManager,
                    this.athleteData,
                    this.clubData,
                    this.summaryData,
                    this.eventIo,
                    this.logger);
            this.CurrentEvent =
                new EventHC(
                    eventData,
                    this.summaryData,
                    resultsTableReader,
                    rawEventIo,
                    this.logger);
            this.Seasons       = seasonIo.GetSeasons();
            this.Athletes      = this.athleteData.ReadAthleteData();
            this.Clubs         = this.clubData.LoadClubData();
            this.GlobalSummary = this.summaryData.LoadSummaryData();

            Messenger.Default.Register <LoadNewSeriesMessage>(this, this.LoadNewSeries);
        }
Beispiel #9
0
        /// <summary>
        /// Initialises a new instance of the <see cref="BLMngr"/> class.
        /// </summary>
        /// <param name="model">junior handicap model</param>
        /// <param name="normalisationConfigurationManager">the normalisation config manager</param>
        /// <param name="resultsConfigurationManager">the results config manager</param>
        /// <param name="seriesConfigurationManager">the series config manager</param>
        /// <param name="athleteData">athlete data</param>
        /// <param name="clubData">club data</param>
        /// <param name="eventData">event data</param>
        /// <param name="summaryData">summary data</param>
        /// <param name="seasonIO">season IO manager</param>
        /// <param name="eventIo">event IO manager</param>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="logger">application logger</param>
        public BLMngr(
            IModel model,
            INormalisationConfigMngr normalisationConfigurationManager,
            IResultsConfigMngr resultsConfigurationManager,
            ISeriesConfigMngr seriesConfigurationManager,
            IAthleteData athleteData,
            IClubData clubData,
            IEventData eventData,
            ISummaryData summaryData,
            ISeasonIO seasonIO,
            IEventIo eventIo,
            IGeneralIo generalIo,
            IJHcLogger logger)
        {
            this.logger = logger;
            this.model  = model;
            this.normalisationConfigurationManager = normalisationConfigurationManager;
            this.resultsConfigurationManager       = resultsConfigurationManager;
            this.seriesConfigurationManager        = seriesConfigurationManager;
            this.athleteData        = athleteData;
            this.clubData           = clubData;
            this.eventData          = eventData;
            this.summaryData        = summaryData;
            this.seasonIO           = seasonIO;
            this.eventIo            = eventIo;
            this.generalIo          = generalIo;
            this.ModelRootDirectory = RootIO.LoadRootFile();
            this.currentSeason      = string.Empty;

            this.resultsCalculator =
                new CalculateResultsMngr(
                    this.model,
                    this.normalisationConfigurationManager,
                    this.resultsConfigurationManager,
                    this.seriesConfigurationManager,
                    this.logger);

            this.IsValid =
                this.generalIo.DataFolderExists && this.generalIo.ConfigurationFolderExists;

            Messenger.Default.Register <LoadNewSeasonMessage>(this, this.NewCurrentSeason);
            Messenger.Default.Register <LoadNewEventMessage>(this, this.NewCurrentEvent);
            Messenger.Default.Register <LoadNewSeriesMessage>(this, this.LoadNewSeries);
            Messenger.Default.Register <CreateNewSeriesMessage>(this, this.CreateNewSeries);
            Messenger.Default.Register <ReinitialiseRoot>(this, this.ReinitialiseRoot);
        }
Beispiel #10
0
        /// <summary>
        /// Initialises a new instance of the <see cref="AthleteData"/> class.
        /// </summary>
        /// <param name="generalIo">general IO manager</param>
        /// <param name="logger">application logger</param>
        public AthleteData(
            IGeneralIo generalIo,
            INormalisationConfigMngr normalisationConfigManager,
            ISeriesConfigMngr seriesConfigManager,
            IJHcLogger logger)
        {
            this.generalIo = generalIo;
            this.logger    = logger;

            this.athleteDataReader =
                new AthleteDataReader(
                    normalisationConfigManager,
                    seriesConfigManager,
                    this.logger);
            this.athleteSeasonDataReader =
                new AthleteSeasonDataReader(
                    this.logger);

            string rootDirectory = RootIO.LoadRootFile();

            this.dataPath = $"{rootDirectory}{Path.DirectorySeparatorChar}{IOPaths.dataPath}{Path.DirectorySeparatorChar}";
            Messenger.Default.Register <ReinitialiseRoot>(this, this.ReinitialiseRoot);
        }