/// <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); }
/// <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(); }
/// <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); }