public override void execute(List <Activity> historyList) { if (relActivity is UserStartRecordingActivity) { for (int i = historyList.Count; --i >= 0;) { Activity act = historyList.ElementAt(i); if (act is UserSelectStoryModeActivity) { UserSelectStoryModeActivity uact = (UserSelectStoryModeActivity)act; if (uact.getMode() == Mode.RECORD) { string path = storyManager.getCurrentStoryPath() + "\\" + EBookInteractiveSystem.voice_dir + "\\" + uact.getRecordVoiceName(); Command comm = new Command(CommandType.INIT_DEVICES_FOR_RECORD); comm.addData(path); comm.addData(EBookInteractiveSystem.STREAM_TYPE); AbstractDeviceManager.executeCommand(comm); storyManager.changeStoryMode(Mode.RECORD); storyManager.start(); //storyManager.changeStoryMode(uact.getMode(),path,true); //createAcceptRejectButtons(); AbstractDeviceManager.executeCommand(new Command(CommandType.CREATE_ACCEPT_REJECT_BUTTON)); break; } } } } }
public override void execute(List <Activity> historyList) { if (relActivity is UserChangePageActivity) { UserChangePageActivity activity = (UserChangePageActivity)relActivity; PageAction pa = activity.getPageAction(); int pageNum = activity.getPageNumber(); storyManager.changePage(pa, pageNum); } else if (relActivity is InternalSpeechNavigatePageActivity) { InternalSpeechNavigatePageActivity activity = (InternalSpeechNavigatePageActivity)relActivity; PageAction pa = activity.getPageAction(); int pageNum = activity.getPageNumber(); storyManager.changePage(pa, pageNum); } else if (relActivity is InternalFinishPageActivity) { InternalFinishPageActivity activity = (InternalFinishPageActivity)relActivity; storyManager.changePage(PageAction.NEXT, 0); //AbstractEBookEvent.raise(new FinishPageEvent()); if (storyManager.getStoryMode() == Mode.RECORD) { AbstractDeviceManager.executeCommand(new Command(CommandType.LOG_PAGE_END)); } } }
public override void execute(List <Activity> historyList) { storyManager.stop(); Command comm = new Command(CommandType.RESTART_SYSTEM); AbstractDeviceManager.executeCommand(comm); }
public override void execute(List <Activity> historyList) { string[] storyList = storyManager.getStoryNames(); Command comm = new Command(CommandType.DISPLAY_MAIN_PAGE); comm.addData(storyList); AbstractDeviceManager.executeCommand(comm); }
public override void execute(List <Activity> historyList) { storyManager.removeLastHighlight(); Command comm = new Command(CommandType.LOG_REJECT_LAST_RECOGNITION); AbstractDeviceManager.executeCommand(comm); //StoryLogger.logRejectLastRecognition(); }
public override void execute(List <Activity> historyList) { if (relActivity is InternalPlayAnimationActivity) { int animationId = ((InternalPlayAnimationActivity)relActivity).getAnimationId(); Command comm = new Command(CommandType.PLAY_ANIMATION); comm.addData(animationId); AbstractDeviceManager.executeCommand(comm); } }
public override void execute(List <Activity> historyList) { if (relActivity is InternalChangeGrammarPriorityActivity) { int priority = ((InternalChangeGrammarPriorityActivity)relActivity).getPriority(); Command comm = new Command(CommandType.CHANGE_GRAMMAR_PRIORITY); comm.addData(priority); AbstractDeviceManager.executeCommand(comm); } }
public override void execute(List <Activity> historyList) { if (relActivity is InternalChangeBackgroundActivity) { string bg = ((InternalChangeBackgroundActivity)relActivity).getBackgroundImage(); Command comm = new Command(CommandType.CHANGE_BACKGROUND); comm.addData(bg); AbstractDeviceManager.executeCommand(comm); } }
public override void execute(List <Activity> historyList) { if (relActivity is InternalReloadOnGoingGrammarActivity) { Grammar g = ((InternalReloadOnGoingGrammarActivity)relActivity).getGrammar(); Command comm = new Command(CommandType.RELOAD_ONGOING_GRAMMAR); comm.addData(g); AbstractDeviceManager.executeCommand(comm); } }
public override void execute(List <Activity> historyList) { if (relActivity is InternalReloadStoryGrammarActivity) { List <Grammar> g = ((InternalReloadStoryGrammarActivity)relActivity).getGrammars(); Command comm = new Command(CommandType.RELOAD_STORY_GRAMMAR); comm.addData(g); AbstractDeviceManager.executeCommand(comm); } }
public override void execute(List <Activity> historyList) { InternalUpdateTextHighLightActivity act = (InternalUpdateTextHighLightActivity)relActivity; //AbstractEBookEvent.raise(new UpdateSpeechTextEvent(act.getHTMLText())); Command comm = new Command(CommandType.UPDATE_PAGE_TEXT); comm.addData(act.getHTMLText()); comm.addData(-1); AbstractDeviceManager.executeCommand(comm); //EBookBrowserDisplayDevice.DisplayStoryText(act.getHTMLText(), -1); }
public override void execute(List <Activity> historyList) { InternalSpeechStateChangeActivity act = (InternalSpeechStateChangeActivity)relActivity; storyManager.updateSpeechState(act.getSpeechState()); Command comm = new Command(CommandType.LOG_SPEECH_STATE); comm.addData(act.getSpeechState()); AbstractDeviceManager.executeCommand(comm); //StoryLogger.logSpeechState(act.getSpeechState()); }
public override void execute(List <Activity> historyList) { if (relActivity is InternalReplayAudioActivity) { InternalReplayAudioActivity act = (InternalReplayAudioActivity)relActivity; string audioName = act.getAudioName(); int audioIndex = act.getAudioIndex(); Command comm = new Command(CommandType.REPLAY_AUDIO); comm.addData(audioName); comm.addData(audioIndex); AbstractDeviceManager.executeCommand(comm); } }
public override void execute(List <Activity> historyList) { InternalSpeechRecognitionResultActivity act = (InternalSpeechRecognitionResultActivity)relActivity; storyManager.updateRecognizedText( act.getConfidenceScore(), act.getTextResult(), act.isHypothesisResult(), act.getSemanticResult(), act.getGrammarName(), act.getRuleName(), act.getAudioDuration(), act.getWavPath()); /* * StoryLogger.logRecognitionResult( * act.getConfidenceScore(), * act.getTextResult(), * act.isHypothesisResult(), * act.getSemanticResult(), * act.getGrammarName(), * act.getRuleName(), * act.getAudioDuration(), * act.getWavPath()); * */ Command comm = new Command(CommandType.LOG_RECOGNITION_RESULT); comm.addData(act.getConfidenceScore()); comm.addData(act.getTextResult()); comm.addData(act.isHypothesisResult()); comm.addData(act.getSemanticResult()); comm.addData(act.getGrammarName()); comm.addData(act.getRuleName()); comm.addData(act.getAudioDuration()); comm.addData(act.getWavPath()); AbstractDeviceManager.executeCommand(comm); if (!act.isHypothesisResult()) { if (storyManager.getStoryMode() == Mode.RECORD) { Command comm2 = new Command(CommandType.ENABLE_ACCEPT_REJECT_BUTTON); comm2.addData(true); AbstractDeviceManager.executeCommand(comm2); //EBookBrowserDisplayDevice.disableAcceptRejectButton(false); } } }
public override void execute(List <Activity> historyList) { if (relActivity is UserStartReplayingActivity) { //EBookBrowserDisplayDevice.createPauseResumeButton(); AbstractDeviceManager.executeCommand(new Command(CommandType.CREATE_PAUSE_RESUME_BUTTON)); string voiceName = ((UserStartReplayingActivity)relActivity).getVoiceName(); string path = storyManager.getCurrentStoryPath() + "\\" + EBookInteractiveSystem.voice_dir + "\\" + voiceName; Command comm = new Command(CommandType.INIT_DEVICE_FOR_REPLAY); AbstractDeviceManager.executeCommand(comm); storyManager.changeStoryMode(Mode.REPLAY); storyManager.startReplay(path); //storyManager.changeStoryMode(Mode.REPLAY, path, true); } }
public override void execute(List <Activity> historyList) { if (relActivity != null) { UserConfirmRecordedSpeechActivity confirmRecAct = (UserConfirmRecordedSpeechActivity)relActivity; if (confirmRecAct.isAccept()) { //accept speech storyManager.confirmHighlight(); Command comm = new Command(CommandType.CONFIRM_AND_SAVE_SPEECH); AbstractDeviceManager.executeCommand(comm); } else { //reject speech storyManager.rollBackHighlight(); Command comm = new Command(CommandType.CLEAN_UNCONFIRMED_SPEECH); AbstractDeviceManager.executeCommand(comm); } } }
public override void execute(List <Activity> historyList) { if (relActivity is UserSelectStoryModeActivity) { UserSelectStoryModeActivity act = (UserSelectStoryModeActivity)relActivity; Mode mode = act.getMode(); if (mode == Mode.REALTIME) { Command comm = new Command(CommandType.INIT_DEVICES_FOR_REALTIME); comm.addData(EBookInteractiveSystem.STREAM_TYPE); AbstractDeviceManager.executeCommand(comm); Command comm2 = new Command(CommandType.ENABLE_STORY_LOGGER); comm2.addData(false); AbstractDeviceManager.executeCommand(comm2); //EBookSpeechRecognizer.setAudioStreamType(1); //StoryLogger.enable(false); List <string> grammarList = storyManager.getCommandGrammars(); Command comm3 = new Command(CommandType.LOAD_COMMAND_GRAMMAR); comm3.addData(grammarList); AbstractDeviceManager.executeCommand(comm3); storyManager.changeStoryMode(Mode.REALTIME); storyManager.start(); //storyManager.changeStoryMode(Mode.REALTIME,null, true); //AbstractEBookEvent.raise(new ChangeStoryModeEvent(Mode.REALTIME, true)); } else if (mode == Mode.REPLAY) { string voicePath = storyManager.getCurrentStoryPath() + "\\" + EBookInteractiveSystem.voice_dir + "\\" + act.getRecordVoiceName(); Command comm = new Command(CommandType.ASK_USER_CHOOSE_VOICE); comm.addData(voicePath); AbstractDeviceManager.executeCommand(comm); Command comm2 = new Command(CommandType.ENABLE_STORY_LOGGER); comm2.addData(false); AbstractDeviceManager.executeCommand(comm2); //EBookBrowserDisplayDevice.chooseVoice(); //StoryLogger.enable(false); } else if (mode == Mode.RECORD) { string voiceName = act.getRecordVoiceName(); if (Directory.Exists(storyManager.getCurrentStoryPath() + "\\" + EBookInteractiveSystem.voice_dir + "\\" + voiceName)) { //same voice already exist, ask user to overwrite or choose other name //EBookBrowserDisplayDevice.askOverwriteExistVoiceName(); Command comm = new Command(CommandType.ASK_USER_OVERWRITE_VOICE); AbstractDeviceManager.executeCommand(comm); } else { //OverwriteAndRecord(); ActivityExecutor.add(new UserStartRecordingActivity()); } } } }