Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Chanel chanel = new Chanel();

            Subscribers matti = new Subscribers("Matti");

            chanel.Subscribe(matti);

            Subscribers moa = new Subscribers("Moa");

            chanel.Subscribe(moa);

            chanel.Content++;

            Subscribers agnes = new Subscribers("Agnes");

            chanel.Subscribe(agnes);

            chanel.Content++;

            chanel.Unsubscribe(agnes);
            chanel.Unsubscribe(moa);

            chanel.Content++;

            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Channel channel = new Channel();

            Subscribers jeff = new Subscribers("Beffrey");

            channel.Subscribe(jeff);

            Subscribers viggo = new Subscribers("Biggo");

            channel.Subscribe(viggo);

            channel.Content++;

            Subscribers hugo = new Subscribers("Bugo");

            channel.Subscribe(hugo);

            channel.Content++;

            Console.ReadLine();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var subject = new Subscribers();

            Viewer observer1 = new Viewer("Observer 1");

            subject.Subscribe(observer1);

            Viewer observer2 = new Viewer("Observer 2");

            subject.Subscribe(observer2);

            subject.Inventory++;

            Viewer observer3 = new Viewer("Observer 3");

            subject.Subscribe(observer3);

            subject.Inventory++;

            Console.ReadLine();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Channel rasmusChannel = new Channel();

            Subscribers observer1 = new Subscribers("KUngen Rasmus");

            rasmusChannel.Subscribe(observer1);

            Subscribers observer2 = new Subscribers(" King Haris");

            rasmusChannel.Subscribe(observer2);

            rasmusChannel.Inventory++;                                //fler videos jaoo

            Subscribers observer3 = new Subscribers("Kung Oskaroru"); //oskar subscriba king

            rasmusChannel.Subscribe(observer3);

            rasmusChannel.Inventory++;



            Console.ReadLine();
        }
Ejemplo n.º 5
0
 public void Unsubscribe(Subscribers observer)
 {
     subscribers.Remove(observer);
 }
Ejemplo n.º 6
0
 public void Subscribe(Subscribers observer)
 {
     subscribers.Add(observer);
 }