/*
 * 2006.11.15
 * Microsoft Conference 2006
 * ‚í‚ñ‚­‚Ü“¯–¿ ƒÃƒÎƒÇƒÐƒÑƒÅƒÊƒÅ
 * MFC to Windows Forms -Multi language Document/View
 */

namespace Counter {

  public ref class NormalCounter : IObservableCounter {
  protected:
    int count_;
    event Notification^ update_;
    void Notify() { update_(this, gcnew EventArgs(count_)); }

  public:
    NormalCounter() : count_(0) {}

    virtual void AddObserver(Notification^ notif)
      { update_ += notif; }
    virtual void RemoveObserver(Notification^ notif)
      { update_ -= notif; }

    virtual void Increment() { ++count_; Notify(); }
    virtual void Decrement() { --count_; Notify(); }
    virtual void Clear()     { count_ = 0; Notify(); }
    virtual property int Count 
      { int get() { return count_; } }
  };

}
