|
using System;
using System.Collections.Generic;
using System.Text;
namespace ObserverPattern
{
class CurrencyRateChangeObserver
{
//Reference to the watcher we�re working with
CurrencyRateWatcher oCurrencyRateWatcher;
public CurrencyRateChangeObserver (CurrencyRateWatcher cwr)
{
oCurrencyRateWatcher = cwr;
// set up the delegate
oCurrencyRateWatcher.OnRateChange += new CurrencyRateWatcher.CurrencyRateChange(RateHasChanged);
}
//The callback method
public void RateHasChanged (object sender, CurrencyRateChangeInfo oInfo)
{
Console.WriteLine("Currency: �{0}� has new value �{1}� and the change Time is {2}", oInfo.sCurrencyName, oInfo.dNewRate, oInfo.tChangeTime);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This is S.M. Rabiul Islam from Bangladesh, I have been working as a software engineer here in Bangladesh at offshore software development house