本文整理汇总了C#中MxitTestApp.UserSession类的典型用法代码示例。如果您正苦于以下问题:C# UserSession类的具体用法?C# UserSession怎么用?C# UserSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserSession类属于MxitTestApp命名空间,在下文中一共展示了UserSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleDisplayMessageLinks
protected InputHandlerResult handleDisplayMessageLinks(
UserSession user_session,
string input,
String error_message)
{
return handleDisplayMessageLinks(user_session, input, error_message, false);
}
示例2: getOutputScreenMessage
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;
}
示例3: handleInput
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
}
示例4: getOptionList
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;
}
示例5: addLinksToMessageFromList
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++;
}
}
示例6: getOptionList
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;
}
示例7: addQuickFilterLinksToMessageFromList
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");
}
}
示例8: handleInput
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
}
示例9: handleShortcutLinks
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);
}
示例10: parseInput
//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;
}
示例11: addLinksToMessageFromList
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++;
}
}
示例12: handleExtraCommandInput
public virtual InputHandlerResult handleExtraCommandInput(UserSession us, String input)
{
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
示例13: handleInput
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
}
示例14: BookmarkManager
public BookmarkManager(
UserProfile user_profile,
UserSession user_session)
{
bookmark_verse = null;
loadVBookMarkFromDB(user_profile, user_session);//load history at start.
}
示例15: addLinksToMessageFromList
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++;*/
}
}