public FireAlarmObserver(FireAlarmSubject subject) { this.subject = subject; // Add the Fire Alarm Handler to the list of handlers for Subject.FireEvent subject.feHandler += new FireAlarmSubject.FireEventHandler(FireAlarmHandler); }
public Form1() { InitializeComponent(); fireSubject = new FireAlarmSubject(); new InstructionsObserver(fireSubject); new AlarmObserver(fireSubject); }
public FireAlarmObserverBase(FireAlarmSubject subject) { this.subject = subject; FireAlarmSubject.FireEventHandler handler = new FireAlarmSubject.FireEventHandler(FireAlarmHandlerMethod); subject.FireEvent += handler; }
public Form1() { InitializeComponent(); subject = new FireAlarmSubject(); instructionObserver = new FireInstructionsObserver(subject); toneObserver = new FireToneObserver(subject); }
public Form1() { InitializeComponent(); rbMinor.Checked = true; fireAlarmSubject = new FireAlarmSubject(); instructionsObserver = new InstructionsObserver(fireAlarmSubject); beepObserver = new BeepObserver(fireAlarmSubject); }
public Form1() { InitializeComponent(); subject = new FireAlarmSubject(); io = new InstructionsObserver(subject); bo = new BellObserver(subject); }
public FireAlarmObservers(FireAlarmSubject subject) { fireSubject = subject; FireAlarmEventHandler handler = new FireAlarmEventHandler(FireAlarmHandlerMethod); subject.FireEvent += handler; }
public Form1() { InitializeComponent(); //Instantiate objects fas = new FireAlarmSubject(); io = new InstructionsObserver(fas); }
public FireAlarmObserver(FireAlarmSubject subject) { this.subject = subject; FireAlarmSubject.FireEventHandler handler = new FireAlarmSubject.FireEventHandler(HandlerMethod); subject.FireEvent += handler; }
//Ctor public FireAlarmObserverBase(FireAlarmSubject s) { subject = s; //Create an event handler FireAlarmSubject.FireEventHandler handler = new FireAlarmSubject.FireEventHandler(FireAlarmEventHandler); //Bind this subject's method to a event handler subject.FireEvent += handler; }
public Form1() { InitializeComponent(); // Instantiate them subject = new FireAlarmSubject(); obI = new InstructionObserver(subject); obB = new BeepObserver(subject); }
//Constructor public FireAlarmObserverBase(FireAlarmSubject sub) { this.sub = sub; FireAlarmSubject.FireEventHandler handler = new FireAlarmSubject.FireEventHandler(FireAlarmHandlerMethod); // Observer gets added to the subject sub.FireEvent += handler; }
public Form1() { InitializeComponent(); subject = new FireAlarmSubject(); //sets observers to subject (beep first then message) FireAlarmBeep beepEvent = new FireAlarmBeep(subject); FireAlarmMessage messageEvent = new FireAlarmMessage(subject); }
public Form1() { InitializeComponent(); //Create subject FireAlarm = new FireAlarmSubject(); //Create observer(s) InstructionsObserver observer1 = new InstructionsObserver(FireAlarm); BeepObserver observer2 = new BeepObserver(FireAlarm); }
/// <summary> /// Constructor /// </summary> /// <param name="subject">Subject to observe</param> public FireAlarmObserverBase(FireAlarmSubject subject) { //Keep reference to subject this.subject = subject; //Create a new handler FireAlarmSubject.FireEventHandler handler = new FireAlarmSubject.FireEventHandler(FireAlarmHandlerMethod); //Register handler with subject subject.FireEvent += handler; }
//Blank ctor public InstructionsObserver(FireAlarmSubject subject) : base(subject) { }
public FireAlarmBeep(FireAlarmSubject subject) : base(subject) { }
public FireAlarmMessage(FireAlarmSubject subject) : base(subject) { }
public FireAlarmEventTip(FireAlarmSubject subject) : base(subject) { }
public AlarmObserver(FireAlarmSubject subject) : base(subject) { }
private void Form1_Load(object sender, EventArgs e) { subjectWithEvent = new FireAlarmSubject(); beep = new BeepObserver(subjectWithEvent); instruction = new InstructionsObserver(subjectWithEvent); }
//Constructor public BeepObserver(FireAlarmSubject sub) : base(sub) { }
public FireToneObserver(FireAlarmSubject subject) : base(subject) { }
public InstructionsObserver(FireAlarmSubject subject) : base(subject) { }
public BeepObserver(FireAlarmSubject subject) : base(subject) { }