Example #1
0
 private static void DrawPrayText(string prayText, IRosaryPray currentPray, int prayIndex)
 {
     Console.CursorTop  = 1;
     Console.CursorLeft = 0;
     Console.WriteLine(currentPray.Pray[prayIndex].PrayText);
     Console.WriteLine(currentPray.Pray[prayIndex].PrayNumber);
 }
Example #2
0
        private static void Next(KeyValuePair <int, int> currentXY, IRosaryPray currentPray, ref int prayIndex)
        {
            rosaryTab[currentXY.Key, currentXY.Value] = 1;

            DrawPrayText(currentPray.Pray[prayIndex].PrayText, currentPray, prayIndex);

            DrawRosary(rosaryTab);
        }
Example #3
0
        private static void Back(KeyValuePair <int, int> currentXY, IRosaryPray currentPray, ref int prayIndex)
        {
            prayIndex--;

            currentXY = currentPray.Pray[prayIndex].Coordinate;

            rosaryTab[currentXY.Key, currentXY.Value] = 0;

            prayIndex--;

            currentXY = currentPray.Pray[prayIndex].Coordinate;

            DrawPrayText(currentPray.Pray[prayIndex].PrayText, currentPray, prayIndex);

            DrawRosary(rosaryTab);
        }
Example #4
0
        static void Main(string[] args)
        {
            ParametrsConfiguration.ManageArgs(args);

            foreach (var item in ParametrsConfiguration.ParamList
                     .Where(s => !string.IsNullOrEmpty(s.ErrorMsg)))
            {
                Console.WriteLine(item.ErrorMsg);
                Console.ReadKey();
                return;
            }

            switch (ParametrsConfiguration.ParamList.First().Value)
            {
            case "ChapletOfTheDivineMercy":
                prayType = typeof(ChapletOfTheDivineMercy);
                break;
            }

            IRosaryPray currentPray = (IRosaryPray)Activator.CreateInstance(prayType);

            Console.CursorVisible = false;

            var stopWatch = new Stopwatch();

            stopWatch.Start();

            ConsoleKey key = ConsoleKey.Enter;

            var prayIndex = -1;

            Console.WriteLine("Rozpocznij modlitwę...");

            while ((key = Console.ReadKey(true).Key) != ConsoleKey.Escape && prayIndex != 58)
            {
                if (key == ConsoleKey.L)
                {
                    currentPray = ConsoleChangeLanguage();
                    continue;
                }

                if ((key != ConsoleKey.Enter) && (key != ConsoleKey.Backspace))
                {
                    continue;
                }

                Console.Clear();

                if (prayIndex < 0)
                {
                    DrawCross(currentPray.GetCrossCoordinate());
                    DrawRosary(rosaryTab);
                    prayIndex++;
                    continue;
                }

                var currentXY = currentPray.Pray[prayIndex].Coordinate;

                if (key == ConsoleKey.Backspace)
                {
                    Back(currentXY, currentPray, ref prayIndex);
                }
                else
                {
                    Next(currentXY, currentPray, ref prayIndex);
                }

                prayIndex++;
            }

            stopWatch.Stop();

            Console.WriteLine($"Koniec w {GetStopWatchString(stopWatch.Elapsed)}");

            Console.ReadKey();
        }