コード例 #1
0
        /// <summary>
        /// Find and return the paths to all events in the currently selected month.
        /// </summary>
        /// <returns>collection of paths</returns>
        private List <string> FindEventPaths()
        {
            List <string> paths =
                YearSearcher.FindAllRawObservationsInAMonth(
                    this.Years[this.YearsIndex],
                    this.monthDictionary[this.currentMonth]);

            return(paths);
        }
コード例 #2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="CalendarViewModel"/> class.
        /// </summary>
        /// <param name="logger">the logger</param>
        /// <param name="openEventCommand">
        /// Command used to open an event.
        /// </param>
        public CalendarViewModel(
            IAsLogger logger,
            Action <string> openEventCommand)
        {
            this.logger           = logger;
            this.openEventCommand = openEventCommand;
            this.Years            = YearSearcher.FindRawYears();
            this.MonthSelector    = new ObservableCollection <IPageSelector>();
            this.Events           = new ObservableCollection <ICalendarItem>();

            this.monthDictionary =
                new Dictionary <string, int>()
            {
                { "Jan", 1 },
                { "Feb", 2 },
                { "Mar", 3 },
                { "Apr", 4 },
                { "May", 5 },
                { "Jun", 6 },
                { "Jul", 7 },
                { "Aug", 8 },
                { "Sept", 9 },
                { "Oct", 10 },
                { "Nov", 11 },
                { "Dev", 12 },
            };

            foreach (KeyValuePair <string, int> month in this.monthDictionary)
            {
                IPageSelector selector =
                    new PageSelector(
                        month.Key,
                        this.NewPage);

                this.MonthSelector.Add(selector);
            }

            this.yearsIndex = this.Years.Count - 1;

            string monthName =
                this.monthDictionary.FirstOrDefault(x => x.Value == DateTime.Now.Month).Key;

            this.NewPage(monthName);
        }