コード例 #1
0
        public int callAction()
        {
            int option = 0;

            Console.Write("Command: ");
            while (!Int32.TryParse(Console.ReadLine(), out option))
            {
                Console.WriteLine("-------------------------------------------------------------------------");
                Console.WriteLine("Invalid input, please enter a valid option (from 0 to 6)!                ");
                Console.WriteLine("-------------------------------------------------------------------------");
                Console.Write("Command: ");
            }

            switch (option)
            {
            case 1:
                this.createGoogleAccount();
                break;

            case 2:
                this.displayAccounts();
                break;

            case 3:
                this.subscribeAccount(YouTubeApp.getInstance().Channels);
                break;

            case 4:
                this.unsubscribeAccount(YouTubeApp.getInstance().Channels);
                break;

            case 5:
                this.viewGoogleAccountMails();
                break;

            case 6:
                this.sendMail();
                break;

            case 0:
                Console.WriteLine("Exiting from google account app...");
                break;

            default:
                Console.WriteLine("-------------------------------------------------------------------------");
                Console.WriteLine("Invalid input, please enter a valid option (from 0 to 6)!                ");
                break;
            }
            Console.WriteLine("-------------------------------------------------------------------------");
            return(option);
        }
コード例 #2
0
        public void menu()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("Choose example to run: ");
                Console.WriteLine("1. Music player");
                Console.WriteLine("2. YouTube");
                Console.WriteLine("3. Google account");
                Console.WriteLine("4. Pizza ordering");
                Console.WriteLine();
                Console.Write("Command: ");

                String option = Console.ReadLine();

                Console.Clear();

                switch (option)
                {
                case "1":
                {
                    MusicPlayerApp.getInstance().startApp();
                    break;
                }

                case "2":
                {
                    YouTubeApp.getInstance().startApp();
                    break;
                }

                case "3":
                {
                    GoogleAccountApp.getInstance().startApp();
                    break;
                }

                case "4":
                {
                    PizzaOrderApp.getInstance().startApp();
                    break;
                }
                }
            }
        }
コード例 #3
0
 public void play(YouTubeVideo video)
 {
     YouTubeApp.getInstance().Advertisements[0].play();
     video.play();
 }