Exemplo n.º 1
0
        /// <summary>
        /// Initialises a new instance of the <see cref="DataEntryViewModel"/> class.
        /// </summary>
        /// <param name="model">
        ///  The associated model object.
        /// </param>
        /// <param name="getBeastie">
        /// The function used to return a specific beastie from the data model.
        /// </param>
        public DataEntryViewModel(
            IEventEntry model,
            Func <string, Beastie> getBeastie)
        {
            bool isSeen = true;

            this.dataEntryModel        = model;
            this.getBeastie            = getBeastie;
            this.observations          = model.Observations;
            this.beastieEntryViewModel =
                new BeastieEntryViewModel(
                    this.observations.SetBeastie,
                    isSeen);
            this.detailsViewModel =
                new EventDetailsEntryViewModel(
                    this.observations,
                    isSeen,
                    this.beastieEntryViewModel.SetIsSeen);

            this.CurrentWorkspace = this.detailsViewModel;

            this.PopulatePageSelector(DataEntryViewModel.EventDetails);

            List <string> beastiePages = model.GetDataEntryPageNames();

            foreach (string pageName in beastiePages)
            {
                this.PopulatePageSelector(pageName);
            }

            this.SaveCommand =
                new CommonCommand(
                    this.Save);
            this.LoadCommand =
                new CommonCommand(
                    this.Load);

            this.NewPage(DataEntryViewModel.EventDetails);
        }