public WithoutPatternApp()
 {
     this.musicPlayerApp   = new MusicPlayerApp();
     this.googleAccountApp = new GoogleAccountApp();
     this.youTubeApp       = new YouTubeApp();
     this.pizzaOrderApp    = new PizzaOrderApp();
 }
Exemple #2
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);
        }
Exemple #3
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;
                }
                }
            }
        }
Exemple #4
0
        static void Main(string[] args)
        {
            //
            // OLD MACDONALD
            //

            List <ISingAbout> animals = new List <ISingAbout>();

            animals.Add(new Horse());
            animals.Add(new Elephant());
            animals.Add(new Dragon());
            animals.Add(new Tractor());
            animals.Add(new Cat());
            // animals.Add(new FarmAnimal("Hardtospellvark"));
            animals.Add(new Bird("Eagle"));
            animals.Add(new Bird("Condor"));
            animals.Add(Bird.CreatePterodactyl());
            animals.Add(new Bird("Robot Chicken"));

            Horse horse = new Horse();

            horse.MakeSoundOnce();

            WindowsPhone phone = new WindowsPhone();
            YouTubeApp   app   = new YouTubeApp();

            phone.RunApplication(app);


            FarmAnimal flyingThing = new Dragon();

            IFlyable trogdor = GetFlyingThing();

            foreach (ISingAbout item in animals)
            {
                SingAbout(item);
            }

            /*
             *
             * // Let's try singing about a Farm Animal
             * FarmAnimal animal = new Horse();
             * SingAbout(animal);
             *
             * // Horse horse = (Horse)animal;
             * // horse.Gallop();
             *
             * Elephant elephant = new Elephant();
             * SingAbout(elephant);
             *
             * Dragon dragon = new Dragon();
             * SingAbout(dragon);
             * // Same thing as: SingAbout(new Dragon());
             */

            // What if we wanted to sing about other things on the farm that were
            // singable but not farm animals?
            // Can it be done?

            Console.ReadLine();
        }
Exemple #5
0
 public void play(YouTubeVideo video)
 {
     YouTubeApp.getInstance().Advertisements[0].play();
     video.play();
 }