Esempio n. 1
0
        static void Main()
        {
            var start = new AppStarter();
            var m     = new Manipulations();

            start.PrintMessage();

Switch:
            Console.WriteLine($"Menu\nChose a paragraph:\nPress '1' to play\n" +
                              $"Press '2' to stop\nPress '3' to next song\n" +
                              $"press '4' to previous song\nPress '5' to change format\n" +
                              $"Press 'Esc' to exit");
            Console.WriteLine();
            int.TryParse(Console.ReadLine(), out var variable);

            switch (variable)
            {
            case 1:
                m.PlayMusic();
                break;

            case 2:
                Manipulations.Stop();
                break;

            case 3:
                Manipulations.ToNext();
                break;

            case 4:
                Manipulations.ToPrevious();
                break;

            case 5:
                CallerStorage.ChangeFormatCaller();
                break;

            default:
                Console.WriteLine("Unexpected Case");
                break;
            }

            if (Console.ReadKey(true).Key == ConsoleKey.Escape)
            {
                Process.GetCurrentProcess().Kill();
            }

            goto Switch;
        }
Esempio n. 2
0
        /// <summary>
        /// Represents a change format act.
        /// </summary>
        public static void ChangeFormatCaller()
        {
            var songsCollection = new[] { "Song1", "Song2" };

            Console.WriteLine("Please chose a song for format changes: ");
            Console.WriteLine($"{string.Join("\n", songsCollection)}\n{new string('-', 70)}");
            var mySong = Console.ReadLine();

            if (mySong?.Contains(songsCollection[0]) == true)
            {
                Manipulations.FormatChange($"{string.Format(songsCollection[0])}");
            }
            else if (mySong?.Contains(songsCollection[1]) == true)
            {
                Manipulations.FormatChange($"{string.Format(songsCollection[1])}");
            }
            else
            {
                Console.WriteLine($"Please, type a song that exists in songs list.");
            }
        }