예제 #1
0
        public static void PopulateLiturgicalFlags(DateTime inputDate)
        {
            LiturgicalCalendar.LiturgicalFlags.year = inputDate.Year;

            // previous year
            LiturgicalCalendar.LiturgicalFlags.ApostleStAndrew      = new DateTime(LiturgicalCalendar.LiturgicalFlags.year - 1, 11, 30);
            LiturgicalCalendar.LiturgicalFlags.AdventSunday         = CalendarCalculations.NearestSunday(LiturgicalCalendar.LiturgicalFlags.ApostleStAndrew);
            LiturgicalCalendar.LiturgicalFlags.ImmaculateConception = new DateTime(LiturgicalCalendar.LiturgicalFlags.year - 1, 12, 6);
            LiturgicalCalendar.LiturgicalFlags.ChristmasDay         = new DateTime(LiturgicalCalendar.LiturgicalFlags.year - 1, 12, 25);
            LiturgicalCalendar.LiturgicalFlags.Dec31 = new DateTime(LiturgicalCalendar.LiturgicalFlags.year - 1, 12, 31);

            // this year
            LiturgicalCalendar.LiturgicalFlags.SolemnityOfMary        = new DateTime(LiturgicalCalendar.LiturgicalFlags.year, 1, 1);
            LiturgicalCalendar.LiturgicalFlags.Epiphany               = LiturgicalCalendar.LiturgicalFlags.ChristmasDay.AddDays(12);
            LiturgicalCalendar.LiturgicalFlags.EpiphanySunday         = CalendarCalculations.NearestSunday(LiturgicalCalendar.LiturgicalFlags.Epiphany);
            LiturgicalCalendar.LiturgicalFlags.Baptism                = LiturgicalCalendar.LiturgicalFlags.EpiphanySunday.AddDays(7);
            LiturgicalCalendar.LiturgicalFlags.StartFirstOrdinaryTime = LiturgicalCalendar.LiturgicalFlags.Baptism.AddDays(1);
            LiturgicalCalendar.LiturgicalFlags.Easter                  = LiturgicalCalendar.Easter(LiturgicalCalendar.LiturgicalFlags.year);
            LiturgicalCalendar.LiturgicalFlags.AshWednesday            = LiturgicalCalendar.LiturgicalFlags.Easter.AddDays(-46);
            LiturgicalCalendar.LiturgicalFlags.Ascension               = LiturgicalCalendar.LiturgicalFlags.Easter.AddDays(39);
            LiturgicalCalendar.LiturgicalFlags.AscensionSunday         = CalendarCalculations.NearestSunday(LiturgicalCalendar.LiturgicalFlags.Ascension);
            LiturgicalCalendar.LiturgicalFlags.Pentecost               = LiturgicalCalendar.LiturgicalFlags.Easter.AddDays(49);
            LiturgicalCalendar.LiturgicalFlags.PentecostSunday         = CalendarCalculations.NearestSunday(LiturgicalCalendar.LiturgicalFlags.Pentecost);
            LiturgicalCalendar.LiturgicalFlags.StartSecondOrdinaryTime = LiturgicalCalendar.LiturgicalFlags.Easter.AddDays(50);
            LiturgicalCalendar.LiturgicalFlags.AllSaints               = new DateTime(LiturgicalCalendar.LiturgicalFlags.year, 11, 1);
            LiturgicalCalendar.LiturgicalFlags.AllSouls                = new DateTime(LiturgicalCalendar.LiturgicalFlags.year, 11, 2);

            LiturgicalCalendar.LiturgicalFlags.IsAdvent    = IsAdvent(inputDate);
            LiturgicalCalendar.LiturgicalFlags.IsChristmas = IsChristmas(inputDate);
            LiturgicalCalendar.LiturgicalFlags.IsLent      = IsLent(inputDate);
            LiturgicalCalendar.LiturgicalFlags.IsEaster    = IsEaster(inputDate);
            LiturgicalCalendar.LiturgicalFlags.IsOrdinary  = IsOrdinary(inputDate);
        }
예제 #2
0
        public static bool IsEaster(DateTime today)
        {
            DateTime startDate = LiturgicalCalendar.LiturgicalFlags.Easter;
            DateTime endDate   = LiturgicalCalendar.LiturgicalFlags.PentecostSunday;

            bool isEaster = CalendarCalculations.IsWithinDates(today, startDate, endDate);

            return(isEaster);
        }
예제 #3
0
        public static bool IsLent(DateTime today)
        {
            DateTime startDate = LiturgicalCalendar.LiturgicalFlags.AshWednesday;
            DateTime endDate   = LiturgicalCalendar.LiturgicalFlags.Easter;

            bool isAdvent = CalendarCalculations.IsWithinDates(today, startDate, endDate);

            return(isAdvent);
        }
예제 #4
0
        public static bool IsChristmas(DateTime today)
        {
            DateTime startDate = LiturgicalCalendar.LiturgicalFlags.Dec31;
            DateTime endDate   = LiturgicalCalendar.LiturgicalFlags.Baptism;

            bool isChristmas = CalendarCalculations.IsWithinDates(today, startDate, endDate);

            return(isChristmas);
        }
예제 #5
0
        public static bool IsAdvent(DateTime today)
        {
            DateTime startDate = LiturgicalCalendar.LiturgicalFlags.ApostleStAndrew;
            DateTime endDate   = LiturgicalCalendar.LiturgicalFlags.Dec31;

            bool isAdvent = CalendarCalculations.IsWithinDates(today, startDate, endDate);

            return(isAdvent);
        }
예제 #6
0
        public static bool IsOrdinary(DateTime today)
        {
            DateTime startDate1 = LiturgicalCalendar.LiturgicalFlags.StartFirstOrdinaryTime;
            DateTime endDate1   = LiturgicalCalendar.LiturgicalFlags.AshWednesday;

            DateTime startDate2 = LiturgicalCalendar.LiturgicalFlags.StartSecondOrdinaryTime;
            DateTime endDate2   = CalendarCalculations.NearestSunday(new DateTime(LiturgicalCalendar.LiturgicalFlags.year, 11, 30));   // ApostleStAndrew this year

            bool isOrdinary1 = CalendarCalculations.IsWithinDates(today, startDate1, endDate1);
            bool isOrdinary2 = CalendarCalculations.IsWithinDates(today, startDate2, endDate2);

            bool isOrdinary = (isOrdinary1 || isOrdinary2);

            return(isOrdinary);
        }
예제 #7
0
        static void UILoop()
        {
            int i;

            i = CalendarCalculations.InitialMystery();  // Start position based on the today's date
            RenderDisplay.DisplayAbout();               // Display initial about info

            while (i <= ERClass.RosaryBead.structRecords.Length)
            {
                Console.Clear();                        // clear console

                RenderDisplay.UpdateMainView(i);        // Populate view struct with new query data
                RenderDisplay.DisplayView();            // render console display text

                i = UserInput.KeyNavigation(i);         // prompt for UI input, update to next position
            }
        }
예제 #8
0
        public static void DisplayAbout()
        {
            string about = "\t\tThis program is a scripture rosary for the command line interface ( CLI ).\n\t\tThis app reads from a scripture database arranged in an ER schema.\n\t\tEnglish readings are quoted from The New American Bible ( CSV files ).";

            string vimKeys = "\t\tUse vim keys to navigate.\n\t\tUse h/l for backwards and forward.\n\t\tUse j/k to display help.\n\t\tUse Esc or 'q' key to quit.";

            DateTime today         = DateTime.Now;
            string   todaysMystery = CalendarCalculations.TodaysMysteryName(today);

            Console.ResetColor();
            Console.Clear();            // clear console

            Console.ResetColor();
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("## ############# ##");
            Console.WriteLine("## Instructions  ##");
            Console.WriteLine("## ############# ##\n");
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(" About:");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(about);
            Console.WriteLine("");

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(" Controls:");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine(vimKeys);
            Console.WriteLine("");

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(" Date:");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("\t\tThe day of the week for {0:d} is {1}.", today.DayOfWeek, today.DayOfWeek);
            Console.WriteLine("\t\t" + today.ToString("dddd, dd MMMM yyyy"));
            Console.WriteLine("\t\tMystery of the day: " + todaysMystery);
            Console.ResetColor();

            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("\nPress any key to continue.");
            Console.ResetColor();
            Console.ReadKey();
        }