コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: gulnisaslan/CSharpLesson
        static void Main(string[] args)
        {
            var            customerObserver = new CustomerObserver();
            var            employeeObserver = new EmployeeObserver();
            ProductManager productManager   = new ProductManager();

            productManager.Attach(customerObserver);
            productManager.Attach(employeeObserver);
            productManager.Detach(customerObserver);
            productManager.Detach(employeeObserver);
            productManager.UpdatePrice();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: furkank14/DesignPatterns
        static void Main(string[] args)
        {
            var            employee1      = new EmployeeObserver();
            ProductManager productManager = new ProductManager();

            productManager.Attach(employee1);
            productManager.Attach(new CustomerObserver());
            productManager.Detach(employee1);
            productManager.UpdatePrice();


            Console.ReadLine();
        }