/// <summary> /// 옵저버에 등록된 구독자들에게 ObserverAction 을 전달 /// 전달은 받은 구독자들은 ObserverAction 에 따라서 적절한 행동을 한다. /// </summary> public void Notify(ObserverAction aAction) { foreach (IObserver item in this.mListener) { item.OnNext(aAction); } }
/// <summary> /// 수신된 ObserverAction 에 따라서 처리 한다. /// </summary> public void OnNext(ObserverAction aAction) { switch (aAction) { case ObserverAction.Command: SetToolStripMenu(); return; case ObserverAction.Invalidate: SetToolStripMenu(); return; case ObserverAction.Select: SetToolStripMenu(); return; } }
/// <summary> /// 수신된 ObserverAction 에 따라서 처리 한다. /// </summary> public void OnNext(ObserverAction action) { switch (action) { case ObserverAction.Invalidate: this.Invalidate(false); return; case ObserverAction.FileLoad: this.Invalidate(false); return; case ObserverAction.New: this.Invalidate(false); return; } }
/// <summary> /// 수신된 ObserverAction 에 따라서 처리 한다. /// </summary> public void OnNext(ObserverAction action) { switch (action) { case ObserverAction.Command: this.SetUndoRedoButton(); return; case ObserverAction.Invalidate: this.SetToolBarButtonState("Select"); return; case ObserverAction.Ellipse: this.SetToolBarButtonState("Ellipse"); return; case ObserverAction.Line: this.SetToolBarButtonState("Line"); return; case ObserverAction.Pencil: this.SetToolBarButtonState("Pencil"); return; case ObserverAction.Rectangle: this.SetToolBarButtonState("Rectangle"); return; case ObserverAction.Select: this.SetToolBarButtonState("Select"); return; case ObserverAction.FileLoad: this.SetToolBarButtonState("Select"); this.SetUndoRedoButton(); return; case ObserverAction.New: this.SetToolBarButtonState("Select"); this.SetUndoRedoButton(); return; } }
public void RemoveAction(ObserverAction <ActionType> action) { _actions -= action; }
public void AddAction(ObserverAction <ActionType> action) { _actions += action; }