public void ChangeState(ISoftPhoneState state) { Check.IsTrue(!state.Equals(InternalState), string.Format("Can not change state to '{0}'. The phone is already in '{0}' state", this.InternalState.GetType().Name)); InternalState.Terminate(this); state.Initialize(this); InternalState = state; state.AfterInitialize(this); /*fire internal event*/ InternalStateChanged(this, new EventArgs()); }
public void Initialize(IInternalSoftPhone softPhone) { _state.Initialize(softPhone); _afterInitialized(softPhone);//TODO: rename }
public void ChangeState(ISoftPhoneState state) { Check.IsTrue(!state.Equals(InternalState), string.Format("Can not change state to '{0}'. The phone is already in '{0}' state", this.InternalState.GetType().Name)); InternalState.Terminate(this); state.Initialize(this); InternalState = state; state.AfterInitialize(this); /*fire internal event*/ InternalStateChanged(this, new EventArgs()); }