本文整理汇总了C#中MxitTestApp.UserSession类的典型用法代码示例。如果您正苦于以下问题:C# UserSession类的具体用法?C# UserSession怎么用?C# UserSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserSession类属于MxitTestApp命名空间,在下文中一共展示了UserSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: handleDisplayMessageLinks
protected InputHandlerResult handleDisplayMessageLinks(
UserSession user_session,
string input,
String error_message)
{
return handleDisplayMessageLinks(user_session, input, error_message, false);
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:7,代码来源:AInputHandler.cs
示例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;
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:34,代码来源:OptionScreenOutputAdapter.cs
示例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
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:25,代码来源:FriendHandler.cs
示例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;
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:32,代码来源:VerseEmotionOptionSet.cs
示例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++;
}
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:35,代码来源:ChooseFriendScreenOutputAdapter.cs
示例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;
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:25,代码来源:BibleTopicOptionSet.cs
示例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");
}
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:26,代码来源:FriendScreenOutputAdapter.cs
示例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
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:33,代码来源:ChooseSearchTypeHandler.cs
示例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);
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:34,代码来源:ColourThemeHandler.cs
示例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;
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:32,代码来源:SearchBookOptionSet.cs
示例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++;
}
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:26,代码来源:FriendScreenOutputAdapter.cs
示例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);
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:7,代码来源:AMenuDynamicOptionSet.cs
示例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
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:33,代码来源:VerseMessageSendHandler.cs
示例14: BookmarkManager
public BookmarkManager(
UserProfile user_profile,
UserSession user_session)
{
bookmark_verse = null;
loadVBookMarkFromDB(user_profile, user_session);//load history at start.
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:7,代码来源:BookmarkManager.cs
示例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++;*/
}
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:34,代码来源:DailyVerseListScreenOutputAdapter.cs
示例16: addThreadLinks
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);
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:26,代码来源:MessageInboxScreenOutputAdapter.cs
示例17: getRecieverString
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;
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:35,代码来源:MessageInboxScreenOutputAdapter.cs
示例18: handleStdNavLinks
/*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);
}
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:58,代码来源:HelpMenuHandler.cs
示例19: 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].link_val)
return list[i].menu_option_id;
}
return input;
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:10,代码来源:BibleTopicCategoryOptionSet.cs
示例20: getOutputScreenMessage
//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;
}
开发者ID:rowan84,项目名称:BibleApp,代码行数:58,代码来源:FriendRequestScreenOutputAdapter.cs
注:本文中的MxitTestApp.UserSession类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论