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

namespace Counter {

  public partial class ProgressView : System.Windows.Forms.Form {

    private IObservableCounter counter_;

    public ProgressView() {
      InitializeComponent();
    }

    public IObservableCounter Model {
      get { return counter_; }
      set { counter_ = value; 
            counter_.AddObserver(OnUpdate);
          }
    }

    private void OnUpdate(object sender, Counter.EventArgs e) {
      count_.Value = e.Count + 21;
    }

    private void increment__Click(object sender, System.EventArgs e) {
      counter_.Increment();
    }

    private void decrement__Click(object sender, System.EventArgs e) {
      counter_.Decrement();
    }

    private void clear__Click(object sender, System.EventArgs e) {
      counter_.Clear();
    }

  }

}