static void Main(string[] args)
        {
            #region Lab_1
            var customerObesrver = new CustomerObserver();
            var employeeObserver = new EmployeeObserver();

            ProductSubject productSubject = new ProductSubject();

            productSubject.Attached(customerObesrver);
            productSubject.Attached(employeeObserver);

            productSubject.Update();

            #endregion


            Console.WriteLine("\n");

            #region Lab_2
            ConcreteProduct concreteProduct = new ConcreteProduct("HP Laptop", 12);

            concreteProduct.members.Add(new ConcreteMember {
                EmailAddress = "*****@*****.**"
            });
            concreteProduct.members.Add(new ConcreteMember {
                EmailAddress = "*****@*****.**"
            });

            concreteProduct.Price = 15;
            #endregion

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var            customer       = new CustomerObserver();
            ProductManager productManager = new ProductManager();

            productManager.Attach(customer);
            productManager.Attach(new EmployeeObserver());
            productManager.Detach(customer);
            productManager.UpdatePrice();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            CustomerObserver customerObserver = new CustomerObserver();
            ProductManager   productManager   = new ProductManager();

            productManager.Attach(customerObserver); //müşteri için bir observer ekle
            productManager.Detach(customerObserver); //müşteri için eklenen observer'ı kaldır
            productManager.Attach(new EmployeeObserver());
            productManager.Update();

            Console.ReadLine();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            ProductManager productManager   = new ProductManager();
            var            customerObserver = new CustomerObserver();
            var            employeeObserver = new EmployeeObserver();

            productManager.Attach(customerObserver);
            productManager.Attach(employeeObserver);
            productManager.UpdatePrice();

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            //ana kısımda

            var            customerObserver = new CustomerObserver();
            ProductManager productManager   = new ProductManager();

            productManager.Attach(customerObserver);
            productManager.Attach(new EmployeeObserver()); //eklemek için
            productManager.Detach(customerObserver);
            productManager.UpdatePrice();

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            //sık kullanılır.
            //kendisine abone olan sistemlerin bir işlem olduğunda devreye girmesini sağlayan desen.
            //bir alışveriş sisteminde fiyatı düşen ürün hakkında bilgi almak
            var            customerObserver = new CustomerObserver();
            ProductManager productManager   = new ProductManager();

            productManager.Attach(customerObserver);
            productManager.Attach(new EmployeeObserver());
            productManager.Detach(customerObserver);
            productManager.UpdatePrice();


            Console.ReadLine();
        }