public PhrasesPresenterIml(PhrasesView view, SoundPlayer player, Database db, int lessonNumber, State initialState)
        {
            this.view = view;
            this.player = player;
            this.db = db;
            this.lessonNumber = lessonNumber;

            player.PlayingFinished += (s, e) =>
            {
                HandlePlaySoundStopEvent ();
            //				new DelayedAction (() => {
            //					//	HandleNextEvent ();
            //				}, 5000);
                HandleTimeoutEvent ();
            };

            stateMachine = new StateMachine (this, initialState);

            var phrases = db.GetPhrasesByLesson (lessonNumber);

            enumerator = phrases.GetLoopedTwoWayEnumerator ();
            HandleNextEvent ();
        }
示例#2
0
 /// <summary>
 /// Sets state and proceed ExitState and EnterState actions
 /// </summary>
 /// <param name="state">State.</param>
 public void ChangeState(State state)
 {
     State.ExitState (this);
     State = state;
     State.EnterState (this);
 }
示例#3
0
 public StateMachine(PhrasesPresenter presenter, State initialState)
 {
     this.presenter = presenter;
     State = initialState;
 }