static void Main() { Subject subject = new Subject(); new HexaObserver(subject); new OctalObserver(subject); new BinaryObserver(subject); Console.WriteLine("First state change: 15"); subject.SetState(15); Console.WriteLine("Second state change: 10"); subject.SetState(10); }
static void Main(string[] args) { Subject subject = new Subject(); new TempObserverInCelcijus(subject); new TempObserverInFahrenheit(subject); Console.WriteLine("First"); subject.SetState(10); Console.WriteLine("Second"); subject.SetState(20); }
static void Main(string[] args) { ISubject subject = new Subject(); var third = new Classes.Observer("Third"); subject.RegisterObserver(new Classes.Observer("First")); subject.RegisterObserver(new Classes.Observer("Second")); subject.RegisterObserver(third); subject.SetState(100, 20, 30); subject.RemoveObserver(third); subject.SetState(50, 3, 17); Console.ReadKey(); }
public MainWindow() { InitializeComponent(); this.Height = 950; this.Width = 925; this.GuiUC.DefineText = "Adapter pattern works as a bridge between two incompatible interfaces."; Subject subject = new Subject(); var binary = new BinaryObserver(subject); var octal = new OctalObserver(subject); subject.SetState(15); subject.SetState(200); }