Exemple #1
0
        /// <summary>
        /// Gets a value which indicates whether the <paramref name="name"/> is present in the model
        /// when searching the list indicated by <paramref name="isSeen"/>.
        /// </summary>
        /// <param name="name">Name of the beastie</param>
        /// <param name="isSeen">
        /// Indicates whether the beastie is seen or heard.
        /// </param>
        /// <returns>
        /// Indicates whether the beastie is currently present.
        /// </returns>
        public bool GetIncluded(
            string name,
            bool isSeen)
        {
            if (isSeen)
            {
                return(this.observations.Species.Kind.Find(k => StringCompare.SimpleCompare(k, name)) != null);
            }

            return(this.observations.Heard.Kind.Find(k => StringCompare.SimpleCompare(k, name)) != null);;
        }
 /// <summary>
 /// Select a new page for the view.
 /// </summary>
 /// <param name="newPageName">
 /// Name of the page to display.
 /// </param>
 private void NewPage(string newPageName)
 {
     if (StringCompare.SimpleCompare(newPageName, ConfigureBeastie))
     {
         if (this.CurrentWorkspace.GetType() != typeof(BeastieConfigurationViewModel))
         {
             this.CurrentWorkspace =
                 new BeastieConfigurationViewModel(
                     this.dataManager,
                     this.fileFactory);
             this.RaisePropertyChangedEvent(nameof(this.CurrentWorkspace));
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Select a new page for the view.
        /// </summary>
        /// <param name="newPageName">
        /// Name of the page to display.
        /// </param>
        private void NewPage(string newPageName)
        {
            if (StringCompare.SimpleCompare(newPageName, ReportsViewModel.CalendarSelector))
            {
                this.CurrentWorkspace = this.calendarViewModel;
            }
            else if (StringCompare.SimpleCompare(newPageName, ReportsViewModel.EventSelector))
            {
                this.CurrentWorkspace = this.eventReportViewModel;
            }

            this.ResetSelectedPage(newPageName);

            this.RaisePropertyChangedEvent(nameof(this.CurrentWorkspace));
        }
        /// <summary>
        /// Convert a string to a visibility
        /// </summary>
        /// <param name="value">value to convert</param>
        /// <param name="targetType">not used</param>
        /// <param name="parameter">not used</param>
        /// <param name="culture">not used</param>
        /// <returns>visibility value</returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null || value.GetType() != typeof(string))
            {
                return(this.NotVisibile());
            }

            string check = (string)value;

            if (StringCompare.CompareEmpty(this.AssessmentString))
            {
                return(StringCompare.CompareNullOrEmpty(check) ? this.NotVisibile() : Visibility.Visible);
            }

            return(StringCompare.SimpleCompare(check, AssessmentString) ? this.NotVisibile() : Visibility.Visible);
        }
Exemple #5
0
        /// <summary>
        /// Select a new page for the view.
        /// </summary>
        /// <param name="newPageName">
        /// Name of the page to display.
        /// </param>
        private void NewPage(string newPageName)
        {
            if (StringCompare.SimpleCompare(newPageName, EventDetails))
            {
                this.CurrentWorkspace = this.detailsViewModel;
            }
            else
            {
                this.beastieEntryViewModel.Clear();

                List <string> beasties =
                    this.dataEntryModel.GetBeastiesOnAPage(
                        newPageName);

                foreach (string beastie in beasties)
                {
                    bool isIncluded =
                        this.observations.GetIncluded(
                            beastie,
                            this.detailsViewModel.IsSeen);

                    Beastie modelBeastie = this.getBeastie(beastie);

                    this.beastieEntryViewModel.Add(
                        beastie,
                        modelBeastie?.LatinName ?? string.Empty,
                        modelBeastie?.Image ?? string.Empty,
                        modelBeastie?.Presence ?? (Presence)(-1),
                        isIncluded);
                }

                this.CurrentWorkspace = this.beastieEntryViewModel;
                this.beastieEntryViewModel.Refresh();
            }

            this.ResetSelectedPage(newPageName);

            this.RaisePropertyChangedEvent(nameof(this.CurrentWorkspace));
        }