//state immer erreichbar public override State Handle(VHSContext.Events currentEvent, TapeState tapeState) { switch (currentEvent) { case VHSContext.Events.PlayClicked: //& tapeState==!TapeState._tapeEnd: //if Tape in and not end return(tapeState == TapeState._tapeIn ? _play : this); case VHSContext.Events.ForwardClicked: //if Tape in and not end return(tapeState == TapeState._tapeIn ? _forward : this); case VHSContext.Events.RewindClicked: //if Tape in and not begin return(tapeState == TapeState._tapeIn ? _reward : this); case VHSContext.Events.RecordClicked: //if Tape in and not end return(tapeState == TapeState._tapeIn ? _record : this); default: //pressed StopButton again return(this); } }
public override State Handle(VHSContext.Events currentEvent, TapeState tapeState) { switch (currentEvent) { case VHSContext.Events.StopClicked: return(tapeState != TapeState._tapeOut ? _standBy : this); default: //no switch from record to rewind //no switch from record to forward //no switch from record to play return(_record); } }
//nur ereichbar wenn tape in public override State Handle(VHSContext.Events currentEvent, TapeState tapeState) { switch (currentEvent) { case VHSContext.Events.StopClicked: return(tapeState != TapeState._tapeOut ? _standBy : this); case VHSContext.Events.ForwardClicked: return(tapeState != TapeState._tapeEnd ? _forward : this); case VHSContext.Events.RewindClicked: return(tapeState == TapeState._tapeIn ? _reward : this); default: //no switch from play to record return(this); } }
//state nur erreichbar wenn tapestate == in public override State Handle(VHSContext.Events currentEvent, TapeState tapeState) { switch (currentEvent) { case VHSContext.Events.PlayClicked: //if Tape not end return(tapeState != TapeState._tapeEnd ? _play: this); case VHSContext.Events.StopClicked: //if tape in return(tapeState == TapeState._tapeIn ? _standBy : this); case VHSContext.Events.ForwardClicked: //if tape not end return(tapeState != TapeState._tapeEnd ? _forward : this); default: //no switch from reward to record return(_reward); } }
public VHSContext() { CurrentState = State._standBy; tapeState = mytape.currTape; }
public abstract State Handle(VHSContext.Events currentEvent, TapeState tapeState);
public TapeContext() { currTape = TapeState._tapeIn; }