protected InputHandlerResult handleDisplayMessageLinks( UserSession user_session, string input, String error_message) { return handleDisplayMessageLinks(user_session, input, error_message, false); }
public override MessageToSend getOutputScreenMessage( UserSession us, MenuPage mp, MessageToSend ms, InputHandlerResult ihr) { ms.Append(MessageBuilder.Elements.CreateClearScreen()); if (!mp.GetType().FullName.Equals("MxitTestApp.OptionMenuPage"))//TODO: Should be constant throw new Exception("Invalid menu page passed into getScreen method "); OptionMenuPage omp = (OptionMenuPage)mp; ms.Append(omp.title + "\r\n", TextMarkup.Bold); if (ihr.action == InputHandlerResult.INVALID_MENU_ACTION && ihr.error != null) { ms.Append((string)ihr.error + "\r\n"); } else { ms.Append(parseMessage(us, omp.message) + "\r\n"); } List<MenuOptionItem> options = omp.options; int count =1 ; foreach (MenuOptionItem option in options) { ms.Append(createMessageLink(MENU_LINK_NAME, count + ") ", option.link_val)); ms.Append(option.display_text + "\r\n"); count++; } appendBackMainLinks(us, ms); appendMessageConfig(true, ms); return ms; //return output; }
protected InputHandlerResult handleDisplayMessageLinks( UserSession user_session, string input, String error_message, Boolean back_without_init) { bool message_page = user_session.getVariable(DISPLAY_MESSAGE) != null; if (message_page == true) { user_session.removeVariable(DISPLAY_MESSAGE); } InputHandlerResult output = handleStdNavLinks(user_session, input, back_without_init); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; //if this was a messsage then the only options is the std Nav links. any other input is invalid so reshow message if (message_page) { user_session.setVariable(DISPLAY_MESSAGE, "Message sent");//you must be sure to remove this from hash table in handler. return new InputHandlerResult( InputHandlerResult.DISPLAY_MESSAGE, InputHandlerResult.DEFAULT_MENU_ID, //not used error_message); } else { return new InputHandlerResult( InputHandlerResult.UNDEFINED_MENU_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID ); } }
public override InputHandlerResult handleInput(UserSession user_session, MessageReceived message_recieved) { string input = extractReply(message_recieved); //Console.WriteLine("in input handler: " + input); Console.WriteLine("User with ID: " + user_session.user_profile.id + " Entered: " + input); //get reply string curr_user_page = user_session.current_menu_loc; InputHandlerResult output = handleStdNavLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; output = handleStdPageLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; output = handleFriendLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; //handle back or home here. return new InputHandlerResult( "Invalid entry...Please enter a valid input"); //invalid choice }
public override List<MenuOptionItem> getOptionList(UserSession us) { List<VerseTagEmotion> emotion_list = VerseTagManager.getInstance().getListOfEmotions(); if (emotion_list != null) { List<MenuOptionItem> final_list = new List<MenuOptionItem>(); foreach(var emotion in emotion_list) { int tag_count = VerseTagManager.getInstance().getVerseTagCountOnEmotion(emotion.id); String tag_m = ""; if(tag_count > 0) tag_m += " (" + tag_count + " tag"; if (tag_count > 1) tag_m += "s"; if (tag_count > 0) tag_m += ")"; MenuOptionItem m_o = new MenuOptionItem( "*", (emotion.id).ToString(), target_page, emotion.emotion + tag_m); final_list.Add(m_o); } return final_list; } return null; }
public override void addLinksToMessageFromList( UserSession us, List<MenuOptionItem> list, MessageToSend ms) { ms.AppendLine(); int count = (us.current_menu_page * MenuDefinition.PAGE_ITEM_COUNT) + 1; int starting_index = us.current_menu_page * MenuDefinition.PAGE_ITEM_COUNT; FriendRelationMenuOptionItem an_option; FriendRelation fr; List<long> recipient_list = null; if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST)) { recipient_list = (List<long>)us.getVariableObject(ChooseFriendHandler.RECIPIENT_LIST); } for (int i = starting_index; i < list.Count && i < starting_index + MenuDefinition.PAGE_ITEM_COUNT; i++) { an_option = (FriendRelationMenuOptionItem)list.ElementAt(i); fr = an_option.fr; if (recipient_list == null || (recipient_list != null && !recipient_list.Contains(long.Parse(an_option.display_text)))) { ms.Append(" " + UserNameManager.getInstance().getUserName(long.Parse(an_option.display_text)) + " "); ms.Append(createMessageLink(MENU_LINK_NAME, "[+]", "ADD_" + an_option.display_text)); /*ms.Append(" "); ms.Append(createMessageLink(MENU_LINK_NAME, "[-]", "REMOVE_" + an_option.display_text));*/ ms.Append("\r\n"); } count++; } }
public override List<MenuOptionItem> getOptionList(UserSession us) { String current_category_id = us.getVariable(CATEGORY_ID_VAR_NAME); if(current_category_id == null) { return null; } int cat_id = Int32.Parse(current_category_id); List<Topic> topic_list = BibleTopicManager.getInstance().getCategory(cat_id).topics; if (topic_list != null) { List<MenuOptionItem> final_list = new List<MenuOptionItem>(); for (int i = 0; i < topic_list.Count; i++) { final_list.Add( new MenuOptionItem( (topic_list[i].verse_ref).ToString(), (i+1).ToString(), target_page, topic_list[i].topic + " - " + topic_list[i].verse_ref)); } return final_list; } return null; }
public void addQuickFilterLinksToMessageFromList( UserSession us, MessageToSend ms) { List<char> starting_chars = us.friend_manager.getStartingCharacters(); //.. starting_chars starting_chars.Sort(); if (starting_chars.Count() > 1) { int i = 0; foreach (var a_char in starting_chars) { if (i == 0) { i++; ms.Append("\r\nFilter - "); ms.Append(createMessageLink(MENU_LINK_NAME, "[ALL]", FriendHandler.FILTER_LIST + "ALL")); ms.Append(" "); } ms.Append(createMessageLink(MENU_LINK_NAME, "[" + a_char.ToString().ToUpper() + "]", FriendHandler.FILTER_LIST + a_char)); ms.Append(" "); } ms.Append("\r\n\r\n"); } }
public override InputHandlerResult handleInput(UserSession user_session, MessageReceived message_recieved) { string input = extractReply(message_recieved); //Console.WriteLine("in input handler: " + input); Console.WriteLine("User with ID: " + user_session.user_profile.id + " Entered: " + input); //get reply string curr_user_page = user_session.current_menu_loc; InputHandlerResult output = handleStdNavLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; output = handleStdPageLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; MenuManager mm = MenuManager.getInstance(); //for now we assume this. must correct this later OptionMenuPage omp = (OptionMenuPage)mm.menu_def.getMenuPage(curr_user_page); List<MenuOptionItem> options = omp.options; foreach (MenuOptionItem option in options) { if (option.link_val.Equals(input)) return new InputHandlerResult( InputHandlerResult.NEW_MENU_ACTION, option.select_action, InputHandlerResult.DEFAULT_PAGE_ID); } //handle back or home here. return new InputHandlerResult( "Invalid entry...Please enter a valid input"); //invalid choice }
protected InputHandlerResult handleShortcutLinks( UserSession us, string input) { if (input == RESET) { us.user_profile.user_profile_custom.setColourTheme(UserColourTheme.NO_THEME); us.setVariable(AScreenOutputAdapter.COLOUR_CHANGED, "COLOUR_CHANGED"); return new InputHandlerResult( InputHandlerResult.DO_NOTHING_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); } int colour_theme = -1; if (!Int32.TryParse(input, out colour_theme)) { return new InputHandlerResult( InputHandlerResult.INVALID_MENU_ACTION, "Invalid Input..."); } //colour_theme -= 1; if (!UserColourTheme.isColourThemeValid(colour_theme)) { return new InputHandlerResult( InputHandlerResult.INVALID_MENU_ACTION, "Invalid Input..."); } us.user_profile.user_profile_custom.setColourTheme(colour_theme); us.setVariable(AScreenOutputAdapter.COLOUR_CHANGED, "COLOUR_CHANGED"); return new InputHandlerResult( InputHandlerResult.DO_NOTHING_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); }
//too many returns in this method public override string parseInput(String input, UserSession us) { for (int i = 0; i < list.Count; i++) { if(input==list[i].display_text) return list[i].link_val; } int starting_index = 0;//us.current_menu_page * MenuDefinition.PAGE_ITEM_COUNT; string test_id = (String)us.getVariable(SearchTestamentHandler.SEARCH_TESTAMENT_VAR_NAME); if (test_id == "1") starting_index += 39; try{ int book_id = starting_index + Int32.Parse(input) - 1 ; if (book_id < book_list.Count) { return book_list.ElementAt(book_id).name; } else { return input; } }catch(Exception e) { input = BibleHelper.getFullBookName(input); return input; } //return input; }
public override void addLinksToMessageFromList( UserSession us, List<MenuOptionItem> list, MessageToSend ms) { int count = (us.current_menu_page * MenuDefinition.PAGE_ITEM_COUNT) + 1; int starting_index = us.current_menu_page * MenuDefinition.PAGE_ITEM_COUNT; FriendRelationMenuOptionItem an_option; FriendRelation fr; for (int i = starting_index; i < list.Count && i < starting_index + MenuDefinition.PAGE_ITEM_COUNT; i++) { an_option = (FriendRelationMenuOptionItem)list.ElementAt(i); fr = an_option.fr; ms.Append("* " + UserNameManager.getInstance().getUserName(long.Parse(an_option.display_text))); ms.Append(" "); ms.Append(createMessageLink(MENU_LINK_NAME, "[REMOVE]", "DELETE_" + an_option.display_text)); ms.Append(" "); ms.Append(createMessageLink(MENU_LINK_NAME, "[BLOCK]", "BLOCK_" + an_option.display_text)); ms.Append(" "); ms.Append("\r\n"); count++; } }
public virtual InputHandlerResult handleExtraCommandInput(UserSession us, String input) { return new InputHandlerResult( InputHandlerResult.UNDEFINED_MENU_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); }
public override InputHandlerResult handleInput(UserSession user_session, MessageReceived message_recieved) { string input = extractReply(message_recieved); //Console.WriteLine("in input handler: " + input); Console.WriteLine("User with ID: " + user_session.user_profile.id + " Entered: " + input); //get reply string curr_user_page = user_session.current_menu_loc; InputHandlerResult output = handleDisplayMessageLinks( user_session, input, "Your input was invalid. You message has been sent already but please click Back/Main to continue", true); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) { if(output.action == InputHandlerResult.BACK_WITHOUT_INIT_MENU_ACTION) user_session.setVariable(Browse_Bible_Handler.BROWSE_CLEAR_SCREEN, true); return output; } output = handleStdNavLinks(user_session, input,true); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; output = handleMyProfileLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; //handle back or home here. return new InputHandlerResult( "Invalid entry...Please enter a valid input"); //invalid choice }
public BookmarkManager( UserProfile user_profile, UserSession user_session) { bookmark_verse = null; loadVBookMarkFromDB(user_profile, user_session);//load history at start. }
public override void addLinksToMessageFromList( UserSession us, List<MenuOptionItem> list, MessageToSend ms) { int count = (us.current_menu_page * MenuDefinition.PAGE_ITEM_COUNT) + 1; int starting_index = us.current_menu_page * MenuDefinition.PAGE_ITEM_COUNT; MenuOptionItem an_option; String summary = ""; for (int i = starting_index; i < list.Count && i < starting_index + MenuDefinition.PAGE_ITEM_COUNT; i++) { /* an_option = (MenuOptionItem)list.ElementAt(i); ms.Append(createMessageLink(MENU_LINK_NAME, count + ") ", an_option.link_val)); ms.Append(an_option.display_text); String start_verse = "";//an_option.fvr.start_verse; Verse verse_summ = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), an_option.fvr.start_verse); //NetBible method should not be used because this is not always a NET Bible if (an_option.is_valid && verse_summ != null) { summary = BibleContainer.getSummaryOfVerse(verse_summ, SUMMARY_WORD_COUNT); ms.Append(" - " + summary + "..."); } else { ms.Append(" - The verse is not available in this translation", TextMarkup.Bold); } //ms.Append(createMessageLink(MENU_LINK_NAME, "[x]", "del:"+ count)); ms.Append("\r\n"); count++;*/ } }
public void addThreadLinks( UserSession us, MessageToSend ms) { int current_page = Int32.Parse(us.getVariable(MessageInboxHandler.CURRENT_MESSAGE_THREAD)); int count = (current_page * THREAD_COUNT_PER_PAGE) + 1; VerseMessageThread vmt; int starting_index = current_page * THREAD_COUNT_PER_PAGE; List<VerseMessageThread> threads = us.verse_messaging_manager.getParticipatingThreads(); if (threads.Count() == 0) { ms.Append("Your inbox is empty"); return; } for (int i = starting_index; i < threads.Count && i < starting_index + THREAD_COUNT_PER_PAGE; i++) { vmt = threads.ElementAt(i); if (vmt == null) continue; appendMessageThread(us, ms, vmt); } appendPaginateLinks(us, ms, threads.Count, THREAD_COUNT_PER_PAGE); }
public static String getRecieverString(UserSession us, List<VerseMessageParticipant> vmp, long sender_id) { String receiver_list = ""; int count = 0; foreach (var participant in vmp) { if (participant.user_id != sender_id) { if (count == 0) { if (us.user_profile.id == participant.user_id) { receiver_list += "You"; } else { receiver_list += UserNameManager.getInstance().getUserName(participant.user_id); } } else { if (us.user_profile.id == participant.user_id) { receiver_list += ", You"; } else { receiver_list += ", " + UserNameManager.getInstance().getUserName(participant.user_id); } } count++; } } return receiver_list; }
/*this method either returns the new screen id or the main or prev command string*/ protected override InputHandlerResult handleStdNavLinks( UserSession user_session, string input) { string curr_user_page = user_session.current_menu_loc; String entry = input.ToUpper(); if (PREV_MENU.Equals(entry) || PREVIOUS_MENU.Equals(entry)) { //check if MenuManager mm = MenuManager.getInstance(); MenuPage mp; mp = mm.menu_def.getMenuPage(user_session.current_menu_loc); //only allow back input if back link is enabled. if (mp.isBackLinkEnabled()) { return new InputHandlerResult( InputHandlerResult.BACK_WITHOUT_INIT_MENU_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); //the menu id is retreived from the session in this case. } else { return new InputHandlerResult( InputHandlerResult.UNDEFINED_MENU_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); } } else if (MAIN_MENU.Equals(entry)) { MenuManager mm = MenuManager.getInstance(); MenuPage mp; mp = mm.menu_def.getMenuPage(user_session.current_menu_loc); if (mp.isMainLinkEnabled()) { return new InputHandlerResult( InputHandlerResult.ROOT_MENU_ACTION, MenuDefinition.ROOT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID);//return root menu } else { return new InputHandlerResult( InputHandlerResult.UNDEFINED_MENU_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); } } else { return new InputHandlerResult( InputHandlerResult.UNDEFINED_MENU_ACTION, InputHandlerResult.DEFAULT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); } }
//too many returns in this method public override string parseInput(String input, UserSession us) { for (int i = 0; i < list.Count; i++) { if(input==list[i].link_val) return list[i].menu_option_id; } return input; }
//in here we should rather call a this method and from here call the implemented output screen //message method so that we can do common things in here. anyway too late now. public override MessageToSend getOutputScreenMessage( UserSession us, MenuPage mp, MessageToSend ms, InputHandlerResult ihr) { ms.Append(MessageBuilder.Elements.CreateClearScreen()); if (!mp.GetType().FullName.Equals("MxitTestApp.DynMenuPage"))//TODO: Should be constant throw new Exception("Invalid menu page passed into getScreen method "); DynMenuPage dmp = (DynMenuPage)mp; ms.Append(dmp.title + "\r\n", TextMarkup.Bold); if (ihr.action == InputHandlerResult.CONF_PAGE_ACTION && ihr.message != null) { ms.Append(ihr.message + "\r\n"); ms.Append(createMessageLink(MENU_LINK_NAME, "Y", "Yes")); ms.Append(" | "); ms.Append(createMessageLink(MENU_LINK_NAME, "N", "No")); } else { if (ihr.action == InputHandlerResult.INVALID_MENU_ACTION && ihr.error != null) { ms.Append((string)ihr.error + "\r\n"); } else { ms.Append(parseMessage(us, dmp.message) + "\r\n"); } /*List<MenuOptionItem> options = dmp.options; int count =1 ; foreach (MenuOptionItem option in options) { ms.Append(createMessageLink(MENU_LINK_NAME, count + ") ", option.link_val)); ms.Append(option.display_text + "\r\n"); count++; }*/ List<MenuOptionItem> dyn_options = dmp.dynamic_set.getOptionList(us); if (dyn_options.Count() == 0) { String empty_msg = dmp.dynamic_set.getListEmptyMessage(); if (empty_msg != null && empty_msg != "") ms.Append(dmp.dynamic_set.getListEmptyMessage() + "\r\n"); } addLinksToMessageFromList(us, dyn_options, ms); appendPaginateLinks(us, ms, dyn_options.Count); appendExtraCommandLinks(dmp.dynamic_set.getExtraCommandString(), ms); appendBackMainLinks(us, ms); appendMessageConfig(true, ms); } return ms; //return output; }
public override List<MenuOptionItem> getOptionList(UserSession us) { ReadOnlyCollection<FavouriteVerseRecord> favourite_list = us.favourite_verses.getFavouriteListForDisplay(); if (favourite_list != null) { String verse_ref = ""; FavouriteVerseRecord fvr = null; List<MenuOptionItem> final_list = new List<MenuOptionItem>(); MenuOptionItem m_o = null; for (int i = 0; i < favourite_list.Count; i++) { if (favourite_list[i] != null) { fvr = favourite_list[i]; //call methods in a handler...not so good. I should of moved this method into a common class Verse start_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), fvr.start_verse); Verse end_verse; if (fvr.end_verse == null || fvr.start_verse.Equals(fvr.end_verse)) end_verse = null; else if ("NULL".Equals(fvr.end_verse)) end_verse = BrowseBibleScreenOutputAdapter.getDefaultEndVerse(start_verse); else end_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), fvr.end_verse); if (start_verse == null || (!(fvr.end_verse == null || fvr.start_verse.Equals(fvr.end_verse)) && end_verse == null)) { m_o = new VerseMenuOptionItem( fvr.id.ToString(), (i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, "N/A", fvr); m_o.is_valid = false; final_list.Add(m_o); } else { verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(start_verse, end_verse); m_o = new VerseMenuOptionItem( fvr.id.ToString(), (i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, verse_ref + " (" + fvr.datetime.ToString("dd/MM/yyyy") + ")", fvr); m_o.is_valid = true; final_list.Add(m_o); } } } return final_list; } return null; }
//too many returns in this method public override string parseInput(String input, UserSession us) { List<MenuOptionItem> list = getOptionList(us); for (int i = 0; i < list.Count; i++) { if (input == list[i].link_val) return list[i].menu_option_id; } return input; }
public override List<MenuOptionItem> getOptionList(UserSession us) { ReadOnlyCollection<VerseHistoryRecord> history_list = us.verse_history.getHistoryListForDisplay(); //LinkedList<VerseHistoryRecord> if (history_list != null) { String verse_ref = ""; VerseHistoryRecord vhr = null; MenuOptionItem m_o = null; List<MenuOptionItem> final_list = new List<MenuOptionItem>(); for (int i = 0; i < history_list.Count; i++) { if (history_list[i] != null) { vhr = history_list[i]; //call methods in a handler...not so good. I should of moved this method into a common class Verse start_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), vhr.start_verse); if (start_verse != null) { Verse end_verse; if (vhr.end_verse == null || vhr.start_verse.Equals(vhr.end_verse)) end_verse = null; else if ("NULL".Equals(vhr.end_verse)) end_verse = BrowseBibleScreenOutputAdapter.getDefaultEndVerse(start_verse); else end_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), vhr.end_verse); verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(start_verse, end_verse); m_o = new VerseMenuOptionItem( vhr.id.ToString(), (i + 1).ToString()/*(book_list[i].name).ToString()*/, target_page, verse_ref + " (" + vhr.datetime.ToString("dd/MM/yyyy") + ")", vhr); final_list.Add(m_o); } else { m_o = new VerseMenuOptionItem( vhr.id.ToString(), (i + 1).ToString(), target_page, vhr.start_verse + " (" + vhr.datetime.ToString("dd/MM/yyyy") + ")", vhr); m_o.is_valid = false; final_list.Add(m_o); } } } return final_list; } return null; }
public override InputHandlerResult handleInput(UserSession user_session, MessageReceived message_recieved) { string input = extractReply(message_recieved); input = input.Trim(); Console.WriteLine("User with ID: " + user_session.user_profile.id + " Entered: " + input); //get reply string curr_user_page = user_session.current_menu_loc; InputHandlerResult output = handleStdNavLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; /*output = handleStdPageLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output;*/ MenuManager mm = MenuManager.getInstance(); //for now we assume this. must correct this later VerseMenuPage vmp = (VerseMenuPage)mm.menu_def.getMenuPage(curr_user_page); if (input.Count() > UserNameManager.MAX_USER_NAME_LENGTH) { return new InputHandlerResult( "Your user name is too long, please keep it less than " + UserNameManager.MAX_USER_NAME_LENGTH + " characters.\r\n"); //invalid choice } else if (input.Equals("") || input.Equals(MyProfileHandler.USER_NAME_CHANGE)) { return new InputHandlerResult( "You entered a blank user name, this is not allowed. please try again.\r\n"); //blank input } else if (!UserNameManager.getInstance().isUserNameUnique(input)) { return new InputHandlerResult( "Sorry but that user name is already taken. Please try again.\r\n"); //blank input } else { try { user_session.user_profile.setUserName(input); return new InputHandlerResult( InputHandlerResult.NEW_MENU_ACTION, vmp.input_item.target_page, InputHandlerResult.DEFAULT_PAGE_ID); } catch (Exception e) { Console.WriteLine(e.StackTrace); return new InputHandlerResult( "Your user name is invalid or has been taken already, please try again."); //invalid choice } } }
public MessageToSend getScreenMessage( UserSession us, MessageToSend ms, InputHandlerResult ihr) { string page_id = us.current_menu_loc; return ScreenOutputAdapterFactory.getScreenOutputAdapter(page_id).getOutputScreenMessage( us, menu_def.getMenuPage(page_id), ms, ihr); }
public override void init(UserSession us) { //at the moment leaving this variable in the session even if user returns to main menu. We should remove it then also. if (us.getVariableObject(SearchTestamentHandler.SEARCH_TESTAMENT_VAR_NAME) != null) { us.deleteVariable(SearchTestamentHandler.SEARCH_TESTAMENT_VAR_NAME); } if (us.getVariableObject(SearchHandler.BOOK_SEARCH_VAR_NAME) != null) { us.deleteVariable(SearchHandler.BOOK_SEARCH_VAR_NAME); } }
public override InputHandlerResult handleInput(UserSession user_session, MessageReceived message_recieved) { string input = extractReply(message_recieved); Console.WriteLine("User with ID: " + user_session.user_profile.id + " Entered: " + input); //get reply string curr_user_page = user_session.current_menu_loc; MenuManager mm = MenuManager.getInstance(); MenuPage mp = mm.menu_def.getMenuPage(curr_user_page); //for now we assume this. must correct this later DynMenuPage dmp = (DynMenuPage)mm.menu_def.getMenuPage(curr_user_page); //handle extra commands InputHandlerResult output = dmp.dynamic_set.handleExtraCommandInput(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; output = handleStdNavLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; output = handleStdPageLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; output = handleShortcutLinks(user_session, input); if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION)) return output; /* List<MenuOptionItem> options = mp.getOptionList(user_session); string output_var = dmp.output_var; //this is a waste, if we do change input then its found so we can already return. input = dmp.dynamic_set.parseInput(input, user_session); foreach (MenuOptionItem option in options) { if (option.is_valid && option.link_val.Equals(input)) { user_session.setVariable(output_var, input); return new InputHandlerResult( InputHandlerResult.NEW_MENU_ACTION, option.select_action, InputHandlerResult.DEFAULT_PAGE_ID); } } */ return new InputHandlerResult( "Invalid entry...Please enter a valid input"); //invalid choice }
public FriendManager( UserProfile user_profile, UserSession user_session) { this.us = user_session; lock (thisLock) { if (user_list.ContainsKey(user_profile.id)) { user_list.Remove(user_profile.id); } user_list.Add(user_profile.id, new FriendMap(us)); } }
public VerseBookMarkTask( UserSession us, UserProfile user_profile, Verse start, Verse end, DateTime datetime, BookmarkVerseRecord bvr) { this.us = us; this.user_profile = user_profile; this.start = start; this.end = end; this.datetime = datetime; this.bvr = bvr; }