示例#1
0
        /// <summary>
        /// Initialises a new instance of the <see cref="EventDetailsEntryViewModel"/> class.
        /// </summary>
        /// <param name="observations">
        /// The observations model object.
        /// </param>
        /// <param name="isSeen">Indicates whether the observations are seen or heard</param>
        /// <param name="setIsSeen">
        /// Method to invoke to indicate to interested parties the new <see cref="IsSeen"/> value.
        /// </param>
        public EventDetailsEntryViewModel(
            IObservationManager observations,
            bool isSeen,
            Action <bool> setIsSeen)
        {
            this.disposedValue = false;
            this.location      = string.Empty;
            this.observations  = observations;
            this.date          = DateTime.Now;
            this.notes         = string.Empty;
            this.isSeen        = isSeen;
            this.setIsSeen     = setIsSeen;

            this.LengthSelector =
                new EnumSelectorViewModel <ObservationLength>(
                    "Length",
                    ObservationLength.Unspecified,
                    this.NewObservationLength);

            this.IntensitySelector =
                new EnumSelectorViewModel <ObservationIntensity>(
                    "Intensity",
                    ObservationIntensity.NotRecorded,
                    this.NewObservationIntensity);

            this.TimeOfDaySelector =
                new EnumSelectorViewModel <ObservationTimeOfDay>(
                    "Time Of Day",
                    ObservationTimeOfDay.NotRecorded,
                    this.NewObservationTimeOfDay);

            this.WeatherSelector =
                new EnumSelectorViewModel <ObservationWeather>(
                    "Weather",
                    ObservationWeather.NotRecorded,
                    this.NewObservationWeather);

            this.HabitatSelector =
                new EnumSelectorCompoundViewModel <ObservationHabitat>(
                    "Habitats",
                    this.NewObservationHabitats);

            this.observations.SetDate(this.date);

            this.observations.Loaded += this.ObservationsLoaded;
        }
示例#2
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);
        }
示例#3
0
        /// <summary>
        /// Reset the view models.
        /// </summary>
        private void Reset()
        {
            bool isSeen = true;

            this.observations          = dataEntryModel.Observations;
            this.beastieEntryViewModel =
                new BeastieEntryViewModel(
                    this.observations.SetBeastie,
                    isSeen);

            this.detailsViewModel?.Dispose();

            this.detailsViewModel =
                new EventDetailsEntryViewModel(
                    this.observations,
                    isSeen,
                    this.beastieEntryViewModel.SetIsSeen);

            this.CurrentWorkspace = this.detailsViewModel;
            this.IsEditing        = false;
            this.RaisePropertyChangedEvent(nameof(this.CurrentWorkspace));
        }
示例#4
0
 public ObservationService(IObservationManager observationManager)
 {
     _observationManager = observationManager;
 }