/// <summary>
        /// Initialises a new instance of the <see cref="ConfigurationViewModel"/> class.
        /// </summary>
        /// <param name="dataManager">data manager</param>
        /// <param name="fileFactory">beastie file factory</param>
        public ConfigurationViewModel(
            IDataManager dataManager,
            IBeastieDataFileFactory fileFactory)
        {
            this.dataManager = dataManager;
            this.fileFactory = fileFactory;

            this.CurrentWorkspace =
                new BeastieConfigurationViewModel(
                    dataManager,
                    fileFactory);

            this.PopulatePageSelector(ConfigureBeastie);
        }
        /// <summary>
        /// Initialises a new instance of the <see cref="BeastieConfigurationViewModel"/> class.
        /// </summary>
        /// <param name="dataManager">data manager</param>
        /// <param name="fileFactory">beastie file factory</param>
        public BeastieConfigurationViewModel(
            IDataManager dataManager,
            IBeastieDataFileFactory fileFactory)
        {
            this.beastieIndex          = -1;
            this.beastieImageListIndex = -1;
            this.dataManager           = dataManager;
            this.fileFactory           = fileFactory;
            this.BeastieImageList      = new ObservableCollection <string>();
            this.PresenceList          = new ObservableCollection <Presence>();

            string[] imageFileNamesRaw =
                System.IO.Directory.GetFiles(
                    DataPath.ImageDataPath);

            foreach (string file in imageFileNamesRaw)
            {
                string fileName = file.Substring(file.LastIndexOf('\\') + 1);
                this.BeastieImageList.Add(fileName);
            }

            IEnumerable <Presence> presenceData = Enum.GetValues(typeof(Presence)).Cast <Presence>();

            foreach (Presence presence in presenceData)
            {
                this.PresenceList.Add(presence);
            }

            this.Beasties = new ObservableCollection <string>();
            foreach (Beastie beastie in dataManager.Beasties)
            {
                Beasties.Add(beastie.Name);
            }

            this.SaveCommand =
                new CommonCommand(
                    this.Save,
                    this.CanSave);
            this.DiscardCommand =
                new CommonCommand(
                    this.Discard,
                    this.CanSave);
        }
Beispiel #3
0
        /// <summary>
        /// Initialises a new instance of the <see cref="EventEntry"/> class.
        /// </summary>
        /// <param name="dataFileFactory">Data file factory</param>
        /// <param name="logger">the logger</param>
        public EventEntry(
            IBeastieDataFileFactory dataFileFactory,
            IAsLogger logger)
        {
            this.Observations = new ObservationManager();
            this.logger       = logger;
            this.rawPageData  =
                XmlFileIo.ReadXml <BeastiePages>(
                    $"{DataPath.BasePath}\\TestDataEntry.xml");

            // Ensure that all data files exist.
            List <string> beastieNames = new List <string>();

            foreach (Page page in this.rawPageData.Pages)
            {
                beastieNames.AddRange(page.Beasties);
            }

            dataFileFactory.CheckFiles(
                beastieNames);
        }
Beispiel #4
0
        /// <summary>
        /// Initialises a new instance of the <see cref="BodyViewModel"/> class.
        /// </summary>
        /// <param name="dataEntryModel">
        ///  The model object associated with the data entry process.
        /// </param>
        /// <param name="dataModel">
        /// The model object containing data set.
        /// </param>
        /// <param name="fileFactory">beastie file factory</param>
        /// <param name="logger">the logger</param>
        public BodyViewModel(
            IEventEntry dataEntryModel,
            IDataManager dataModel,
            IBeastieDataFileFactory fileFactory,
            IAsLogger logger)
        {
            this.configurationViewModel =
                new ConfigurationViewModel(
                    dataModel,
                    fileFactory);
            this.consistencyViewModel = new ConsistencyViewModel();
            this.reportsViewModel     =
                new ReportsViewModel(
                    dataModel,
                    logger);
            this.dataEntryViewModel =
                new DataEntryViewModel(
                    dataEntryModel,
                    dataModel.FindBeastie);

            this.currentView = this.dataEntryViewModel;

            Messenger.Default.Register <MainViewMessage>(this, this.ChangeView);
        }