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(); }
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(); }
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(); }