public S2(Termometro term) { this._term = term; TermometroEventHandler del = new TermometroEventHandler(term_TemperatureTooHigh); //costruzione del delegate this._term.TemperatureTooHigh += del; //invoco add_MailArrived(del) }
static void Main(string[] args) { Termometro t = new Termometro(); for (int i = 0; i < 50; i++) { double x = Accademy.Helper.Helper.GetRandomDouble(20, 30); t.SimulatedTemp(x); } }
static void Main(string[] args) { Termometro term = new Termometro(); S1 s1 = new S1(term); S2 s2 = new S2(term); S3 s3 = new S3(term); for (int i = 0; i < 50; i++) { double n = Accademy.Helper.Helper.GetRandomDouble(20, 30); term.SimulateTemp(n); } Console.ReadLine(); }
public S1(Termometro _trm) { this.trm = _trm; this.trm.TempTooHigh += trm_TempTooHigh; }