Exemplo n.º 1
0
        static void Main()
        {
            var wp1 = new WindowsPhone("Lumia 620");
            var wp2 = new WindowsPhone("Lumia 1020");
            var wp3 = new WindowsPhone("Lumia 930");

            var android1 = new AndroidPhone("Nexus 4");
            var android2 = new AndroidPhone("Nexus 5");
            var android3 = new AndroidPhone("Galaxy 3");

            var observer = new Messages();

            //Подписываем на уведомления Windows Phone девайсы
            observer.ContentChanged += wp1.Update;
            observer.ContentChanged += wp2.Update;
            observer.ContentChanged += wp3.Update;

            //Подписываем на уведомления Android девайсы
            observer.ContentChanged += android1.Update;
            observer.ContentChanged += android2.Update;
            observer.ContentChanged += android3.Update;


            //Первое PUSH уведомление
            observer.MessageAvailable();

            //Удаляем из рассылки Lumia 620 и Nexus 4
            observer.ContentChanged -= wp1.Update;
            observer.ContentChanged -= android1.Update;

            Console.WriteLine("\n---Были удалены некоторые девайсы из рассылки---");

            //Второе PUSH уведомление
            observer.MessageAvailable();
            Console.WriteLine("\n---Третья рассылка---");
            //Третья рассылка
            observer.MessageAvailable();
        }
Exemplo n.º 2
0
 public void StartWindowsPhonePushService(WindowsPhone.WindowsPhonePushChannelSettings channelSettings = null, PushServiceSettings serviceSettings = null)
 {
     wpService = new WindowsPhone.WindowsPhonePushService(channelSettings, serviceSettings);
     wpService.Events.RegisterProxyHandler(this.Events);
 }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Android android = new Android();

            android.Name        = "Moto G4";
            android.phoneNumber = "0760000000";
            IOS iOS = new IOS();

            iOS.Name        = "Iphone 6S";
            iOS.phoneNumber = "08222222";
            WindowsPhone windowsPhone = new WindowsPhone();

            windowsPhone.Name        = "Nokia Lumia 8";
            windowsPhone.phoneNumber = "9673241900";
            WaltonFeaturePhone waltonFeaturePhone = new WaltonFeaturePhone();

            waltonFeaturePhone.Name        = "Walton X";
            waltonFeaturePhone.phoneNumber = "12345676";
            AppoFeaturePhone appoFeaturePhone = new AppoFeaturePhone();

            appoFeaturePhone.Name        = "Appo eXcel";
            appoFeaturePhone.phoneNumber = "3456432";
            LandPhone landPhone = new LandPhone();

            landPhone.Name        = "Beetel Pro";
            landPhone.phoneNumber = "98762315";


            phoneList.Add(android);
            phoneList.Add(iOS);
            phoneList.Add(windowsPhone);
            phoneList.Add(waltonFeaturePhone);
            phoneList.Add(appoFeaturePhone);
            phoneList.Add(landPhone);



            android.DialCall("99090909", "hi", "789");


            android.DialCall("2342324", "how are you", "67");
            android.callLog();


            //caller outgoing
            //IPhone caller=null;
            //string message = null;



            //while (caller == null)
            //{
            //    Console.WriteLine("Enter the  caller subcriber number ");

            //    string callerNumber = Console.ReadLine();
            //    for (int i = 0; i <= phoneList.Count - 1; i++)
            //    {
            //        if (phoneList[i].phoneNumber == callerNumber)
            //        {
            //            caller = phoneList[i];
            //        }
            //    }
            //    if (caller == null)
            //    {
            //        Console.WriteLine("The phone number is not valid");
            //        //Console.ReadKey();
            //        //return;
            //    }
            //}



            ////receiver incoming
            //IPhone receiver = null;
            //while (receiver == null)
            //{
            //    Console.WriteLine("Enter the reciver number ");
            //    string receiverNumber = Console.ReadLine();
            //    for (int i = 0; i <= phoneList.Count - 1; i++)
            //    {
            //        if (phoneList[i].phoneNumber == receiverNumber)
            //        {
            //            receiver = phoneList[i];
            //        }
            //    }
            //    if (receiver == null)
            //    {
            //        Console.WriteLine("The phone number is not valid");
            //    }
            //    else if (caller == receiver)
            //    {
            //        Console.WriteLine("caller & receiver can not be same");
            //    }
            //    else
            //    {
            //        Console.WriteLine(caller.Name + " going to call " + receiver.Name);
            //        Console.WriteLine("Please enter " + caller.Name + "'s message :");
            //        string callerMessage = Console.ReadLine();
            //        Console.WriteLine("Enter call duration (in second) : ");
            //        string timeDuration = Console.ReadLine();
            //        message = caller.DialCall(receiver.Name, callerMessage, timeDuration);
            //        Console.WriteLine(caller.Name + " is calling " + message);
            //        string outgoingCaller = caller.Name;
            //        //Tom is about to call Jerry
            //        //Please enter Tom's message: Hi Jerry, may we meet this weekend?
            //        //Enter call duration (in seconds) :  378

            //        //caller.dial(receiver,"Hi how are you?",315);

            Console.ReadKey();
        }