本文整理汇总了C#中MxitTestApp.UserSession.hasVariable方法的典型用法代码示例。如果您正苦于以下问题:C# UserSession.hasVariable方法的具体用法?C# UserSession.hasVariable怎么用?C# UserSession.hasVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MxitTestApp.UserSession
的用法示例。
在下文中一共展示了UserSession.hasVariable方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: init
public override void init(UserSession us)
{
if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT))
{
us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT);
}
if (us.hasVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID))
{
us.deleteVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID);
}
if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT))
{
us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT);
}
}
示例2: 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++;
}
}
示例3: init
public override void init(UserSession us)
{
if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT))
{
us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT);
}
if (us.hasVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID))
{
us.deleteVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID);
}
if (us.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT))
{
us.deleteVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT);
}
if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST))
{
us.deleteVariable(ChooseFriendHandler.RECIPIENT_LIST);
}
if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST))
us.removeVariable(ChooseFriendHandler.RECIPIENT_LIST);
}
示例4: getCurrentSendList
public String getCurrentSendList(UserSession us)
{
String send_list = "";
if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST))
{
List<long> recipient_list = (List<long>)us.getVariableObject(ChooseFriendHandler.RECIPIENT_LIST);
for (int i = 0; i < recipient_list.Count; i++)
{
send_list += (UserNameManager.getInstance().getUserName(recipient_list[i]));
if (recipient_list.Count > 1 && (i != recipient_list.Count - 1))
send_list+=", ";
}
}
return send_list;
}
示例5: addQuickFilterLinksToMessageFromList
public void addQuickFilterLinksToMessageFromList(
UserSession us,
MessageToSend ms)
{
List<char> starting_chars = us.friend_manager.getStartingCharacters();
//.. starting_chars
starting_chars.Sort();
String filter = "";
if (us.hasVariable(ChooseFriendHandler.FRIEND_LIST_FILTER))
{
filter = us.getVariable(ChooseFriendHandler.FRIEND_LIST_FILTER);
}
if (starting_chars.Count() > 1)
{
int i = 0;
foreach (var a_char in starting_chars)
{
if (i == 0)
{
i++;
ms.Append("\r\nFilter - ");
if (filter.Equals("") || filter.Equals("ALL"))
{
ms.Append("[ALL]");
}
else
{
ms.Append(createMessageLink(MENU_LINK_NAME, "[ALL]", FriendHandler.FILTER_LIST + "ALL"));
}
ms.Append(" ");
}
if (filter.Equals(a_char.ToString().ToUpper()))
{
ms.Append("[" + a_char.ToString().ToUpper() + "]");
}
else
{
ms.Append(createMessageLink(MENU_LINK_NAME, "[" + a_char.ToString().ToUpper() + "]", FriendHandler.FILTER_LIST + a_char));
}
ms.Append(" ");
}
ms.Append("\r\n\r\n");
}
}
示例6: handleMyProfileLinks
/*this method either returns the new screen id or the main or prev command string*/
protected InputHandlerResult handleMyProfileLinks(
UserSession user_session,
string input)
{
string curr_user_page = user_session.current_menu_loc;
String entry = input.ToUpper();
if (CHOOSE_FRIEND_ID.Equals(entry))
{
return new InputHandlerResult(
InputHandlerResult.NEW_MENU_ACTION,
MenuIDConstants.SEND_VERSE_CHOOSE_FRIEND_ID); //the menu id is retreived from the session in this case.
}
else if (ENTER_MESSAGE_SUBJECT.Equals(entry))
{
return new InputHandlerResult(
InputHandlerResult.NEW_MENU_ACTION,
MenuIDConstants.SEND_VERSE_ENTER_SUBJECT); //the menu id is retreived from the session in this case.
}
else if (ENTER_MESSAGE.Equals(entry))
{
return new InputHandlerResult(
InputHandlerResult.NEW_MENU_ACTION,
MenuIDConstants.SEND_VERSE_ENTER_MESSAGE); //the menu id is retreived from the session in this case.
}
else if (SEND_MESSAGE.Equals(entry))
{
String message_text = "";
//String recip_id_s = "";
long recip_id = -1;
String start_verse = "";
String end_verse = "";
String subject = "";
if (user_session.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT))
message_text = user_session.getVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT);
if (user_session.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT))
subject = user_session.getVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT);
/*if (user_session.hasVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID))
recip_id= long.Parse(user_session.getVariable(VerseMessageSendOutputAdapter.FRIEND_TO_SEND_ID));
else
return new InputHandlerResult("There is a problem in sending the message. Please let us know about this problem by using the feedback option");
*/ //old style sing recipient.
//new multip recipient.
List<long> recipient_list;
if (user_session.hasVariable(ChooseFriendHandler.RECIPIENT_LIST))
recipient_list = (List<long>)user_session.getVariableObject(ChooseFriendHandler.RECIPIENT_LIST);
else
return new InputHandlerResult("There is a problem in sending the message. Please let us know about this problem by using the feedback option");
VerseSection vs = (VerseSection)user_session.getVariableObject("Browse.verse_section");
if (vs == null)
{
Console.WriteLine("Expected Browse.verse_section present, but not found in VerseMessageSendHandler.");
return new InputHandlerResult("There is a problem in sending the message. Please let us know about this problem by using the feedback option");
}
else
{
Verse start = vs.start_verse;
Verse end = vs.end_verse;
if (end == null)
{
end = BrowseBibleScreenOutputAdapter.getDefaultEndVerse(start);
}
start_verse = start.getVerseReference();
end_verse = end.getVerseReference();
}
user_session.verse_messaging_manager.createThreadAndAddPrivateMessage(
message_text,
recipient_list,
start_verse,
end_verse,
subject);
return new InputHandlerResult(
InputHandlerResult.DISPLAY_MESSAGE,
InputHandlerResult.DEFAULT_MENU_ID, //not used
"Your Message has been sent...");
}
else
{
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
}
示例7: getOutputScreenMessage
public override MessageToSend getOutputScreenMessage(
UserSession us,
MenuPage mp,
MessageToSend ms,
InputHandlerResult ihr)
{
ms.Append(MessageBuilder.Elements.CreateClearScreen());
if (!mp.GetType().FullName.Equals("MxitTestApp.VerseMenuPage"))//TODO: Should be constant
throw new Exception("Invalid menu page passed into getScreen method ");
VerseMenuPage omp = (VerseMenuPage)mp;
ms.Append(omp.title + "\r\n", TextMarkup.Bold);
ms.Append("\r\n");
ms.Append("\r\n");
if (ihr.error != null && ihr.action == InputHandlerResult.INVALID_MENU_ACTION)
{
ms.Append((string)ihr.error + "\r\n");
}
Boolean should_display_conf_message = displayMessage(us, ms, ihr);
if (should_display_conf_message)
{
return ms;
}
ms.Append(parseMessage(us, omp.message) + "\r\n");
/*else if (us.getVariable(FriendHandler.DELETED_FRIEND_NAME) != null)
{
friend_name = (String)us.removeVariable(FriendHandler.DELETED_FRIEND_NAME);
ms.Append("You have removed " + friend_name + " from you buddy list.");
ms.Append("\r\n");
ms.Append("\r\n");
}*/
if (us.friend_manager.getFriends().Count <= 0)
{
ms.Append("You dont have any buddies added, you need to first invite buddies in order to send Verses to them.");
ms.Append("\r\n");
ms.Append("\r\n");
}
else
{
Boolean recip_is_set = false;
//check if recipient is set already
if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST) && ((List<long>)us.getVariableObject(ChooseFriendHandler.RECIPIENT_LIST)).Count > 0)
{
String friend_list = getCurrentSendList(us);
ms.Append("To: ");
ms.Append(friend_list);
ms.Append(" ");
ms.Append(createMessageLink(MENU_LINK_NAME, "[ edit ]", VerseMessageSendHandler.CHOOSE_FRIEND_ID));
recip_is_set = true;
}
else
{
ms.Append("To: ");
ms.Append(createMessageLink(MENU_LINK_NAME, "[ edit ]", VerseMessageSendHandler.CHOOSE_FRIEND_ID));
ms.Append(" *");
}
ms.Append("\r\n");
ms.Append("\r\n");
VerseSection vs = (VerseSection)us.getVariableObject("Browse.verse_section");
if (vs == null)
{
Console.WriteLine("Expected Browse.verse_section present, but not found");
}
else
{
Verse start_verse = vs.start_verse;
Verse end_verse = vs.end_verse;
if (end_verse == null)
{
end_verse = BrowseBibleScreenOutputAdapter.getDefaultEndVerse(start_verse);
}
ms.Append("Verse: ");
ms.Append(BibleHelper.getVerseSectionReference(start_verse, end_verse), TextMarkup.Bold);
ms.Append("\r\n");
ms.Append("\r\n");
}
if (us.hasVariable(MESSAGE_SUBJECT))
{
String subject = us.getVariable(MESSAGE_SUBJECT);
ms.Append("Subject: ");
ms.Append(subject);
ms.Append(" ");
}
else
{
ms.Append("Subject: ");
}
ms.Append(createMessageLink(MENU_LINK_NAME, "[ edit ]", VerseMessageSendHandler.ENTER_MESSAGE_SUBJECT));
ms.Append("\r\n");
ms.Append("\r\n");
if (us.hasVariable(MESSAGE_TEXT))
//.........这里部分代码省略.........
示例8: getOutputScreenMessage
public override MessageToSend getOutputScreenMessage(
UserSession us,
MenuPage mp,
MessageToSend ms,
InputHandlerResult ihr)
{
ms.Append(MessageBuilder.Elements.CreateClearScreen());
if (!mp.GetType().FullName.Equals("MxitTestApp.VerseMenuPage"))//TODO: Should be constant
throw new Exception("Invalid menu page passed into getScreen method ");
VerseMenuPage omp = (VerseMenuPage)mp;
ms.Append(omp.title + "\r\n", TextMarkup.Bold);
ms.Append("\r\n");
ms.Append("\r\n");
if (ihr.error != null && ihr.action == InputHandlerResult.INVALID_MENU_ACTION)
{
ms.Append((string)ihr.error + "\r\n");
}
Boolean should_display_conf_message = displayMessage(us, ms, ihr);
if (should_display_conf_message)
{
return ms;
}
ms.Append(parseMessage(us, omp.message) + "\r\n");
/*else if (us.getVariable(FriendHandler.DELETED_FRIEND_NAME) != null)
{
friend_name = (String)us.removeVariable(FriendHandler.DELETED_FRIEND_NAME);
ms.Append("You have removed " + friend_name + " from you buddy list.");
ms.Append("\r\n");
ms.Append("\r\n");
}*/
Boolean recip_is_set = false;
//check if recipient is set already
if (us.hasVariable(RECIPIENT_ID))
{
String friend_id = us.getVariable(RECIPIENT_ID);
long l_friend_id = long.Parse(friend_id);
String user_name = UserNameManager.getInstance().getUserName(l_friend_id);
ms.Append("To: ");
ms.Append(user_name, TextMarkup.Bold);
ms.Append(" ");
ms.Append(createMessageLink(MENU_LINK_NAME, "[ edit ]", NotifMessageSendHandler.CHOOSE_FRIEND_ID));
recip_is_set = true;
}
else
{
ms.Append("To: ");
ms.Append(createMessageLink(MENU_LINK_NAME, "[ edit ]", NotifMessageSendHandler.CHOOSE_FRIEND_ID));
ms.Append(" *");
}
ms.Append("\r\n");
ms.Append("\r\n");
if (us.hasVariable(MESSAGE_SUBJECT))
{
String subject = us.getVariable(MESSAGE_SUBJECT);
ms.Append("Subject: ");
ms.Append(subject);
ms.Append(" ");
}
else
{
ms.Append("Subject: ");
}
ms.Append(createMessageLink(MENU_LINK_NAME, "[ edit ]", NotifMessageSendHandler.ENTER_MESSAGE_SUBJECT));
ms.Append("\r\n");
ms.Append("\r\n");
if (us.hasVariable(MESSAGE_TEXT))
{
String message = us.getVariable(MESSAGE_TEXT);
ms.Append("Message: ");
ms.Append(message);
ms.Append(" ");
}
else
{
ms.Append("Message: ");
}
ms.Append(createMessageLink(MENU_LINK_NAME, "[ edit ]", NotifMessageSendHandler.ENTER_MESSAGE));
ms.Append("\r\n");
ms.Append("\r\n");
if (!recip_is_set)
ms.AppendLine("Fields marked with * has to be set before you can send the message");
else
ms.AppendLine(createMessageLink(MENU_LINK_NAME, "Send Message", NotifMessageSendHandler.SEND_MESSAGE));
ms.AppendLine("");
appendBackMainLinks(us, ms);
appendMessageConfig(true, ms);
return ms;
//return output;
}
示例9: 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");
}
ms.AppendLine("Refer a friend to the BibleApp on MXit by using the link below. ");
ms.AppendLine(createMessageLink(MENU_LINK_NAME, "Spread The Word", MainMenuHandler.REFER_A_FRIEND));
ms.AppendLine();
if (us.user_profile.is_suspended)
{
ms.Append("\r\n");
ms.Append("You have been suspended from this application. Please email us at [email protected]");
ms.Append("\r\n");
ms.Append("\r\n");
return ms;
}
if (us.hasVariable(UserSession.GUEST_USER_NAME_ASSIGNED))
{
ms.Append("\r\n");
ms.Append("You have been assigned a guest user name. To remove this message please change your user name in the profile option below.");
ms.Append("\r\n");
ms.Append("\r\n");
}
if (us.bookmark_manager.bookmark_verse != null)
{
ms.Append("To continue reading where you left off ");
ms.Append(createMessageLink(MENU_LINK_NAME, "Click Here", "BOOKMARK"));
ms.Append("\r\n");
ms.Append("\r\n");
ms.Append("Or choose an option below...\r\n");
}
else
{
ms.Append("Choose an option below...\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));
if (option.menu_option_id == MY_PROFILE_OPTION_ID)
{
if (us.hasNewEvent())
{
ms.Append(option.display_text + " (!)\r\n", TextMarkup.Bold);
}
else
{
ms.Append(option.display_text + "\r\n");
}
}
else
{
ms.Append(option.display_text + "\r\n");
}
count++;
}
appendBackMainLinks(us, ms);
appendMessageConfig(true, ms);
ms.AppendLine("");
ms.AppendLine("");
ms.AppendLine("Shortcuts...", TextMarkup.Bold);
ms.Append(createMessageLink(MENU_LINK_NAME, "Inbox", MainMenuHandler.MESSAGE_INBOX));
if (us.hasNewMessageEvent())
{
ms.Append(" (NEW)", TextMarkup.Bold);
}
if (us.hasNewFriendRequest())
{
ms.Append(" | ");
ms.Append(createMessageLink(MENU_LINK_NAME, "Buddy Requests", MainMenuHandler.BUDDY_REQUESTS));
ms.Append(" (NEW)", TextMarkup.Bold);
}
//.........这里部分代码省略.........
示例10: handleMyProfileLinks
/*this method either returns the new screen id or the main or prev command string*/
protected InputHandlerResult handleMyProfileLinks(
UserSession user_session,
string input)
{
string curr_user_page = user_session.current_menu_loc;
String entry = input.ToUpper();
if (CHOOSE_FRIEND_ID.Equals(entry))
{
return new InputHandlerResult(
InputHandlerResult.NEW_MENU_ACTION,
MenuIDConstants.ENTER_RECIP_ID_NOTIF_MESSAGE); //the menu id is retreived from the session in this case.
}
else if (ENTER_MESSAGE_SUBJECT.Equals(entry))
{
return new InputHandlerResult(
InputHandlerResult.NEW_MENU_ACTION,
MenuIDConstants.SEND_VERSE_ENTER_SUBJECT); //the menu id is retreived from the session in this case.
}
else if (ENTER_MESSAGE.Equals(entry))
{
return new InputHandlerResult(
InputHandlerResult.NEW_MENU_ACTION,
MenuIDConstants.SEND_VERSE_ENTER_MESSAGE); //the menu id is retreived from the session in this case.
}
else if (SEND_MESSAGE.Equals(entry))
{
String message_text = "";
//String recip_id_s = "";
long recip_id = -1;
String start_verse = "";
String end_verse = "";
String subject = "";
if (user_session.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT))
message_text = user_session.getVariable(VerseMessageSendOutputAdapter.MESSAGE_TEXT);
if (user_session.hasVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT))
subject = user_session.getVariable(VerseMessageSendOutputAdapter.MESSAGE_SUBJECT);
if (user_session.hasVariable(NotifMessageSendOutputAdapter.RECIPIENT_ID))
recip_id= long.Parse(user_session.getVariable(NotifMessageSendOutputAdapter.RECIPIENT_ID));
else
return new InputHandlerResult("There is a problem in sending the message. Please let us know about this problem by using the feedback option");
start_verse = VerseMessageThread.NOTIFICATION_THREAD;
end_verse = VerseMessageThread.NOTIFICATION_THREAD;
user_session.verse_messaging_manager.createThreadAndAddPrivateMessage(
message_text,
recip_id,
start_verse,
end_verse,
subject);
return new InputHandlerResult(
InputHandlerResult.DISPLAY_MESSAGE,
InputHandlerResult.DEFAULT_MENU_ID, //not used
"Your Message has been sent...");
}
else
{
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
}
示例11: appendCurrentSendList
public void appendCurrentSendList(
UserSession us,
MessageToSend ms)
{
if (us.hasVariable(ChooseFriendHandler.RECIPIENT_LIST))
{
List<long> recipient_list = (List<long>)us.getVariableObject(ChooseFriendHandler.RECIPIENT_LIST);
ms.AppendLine();
ms.Append("Recipients: ", TextMarkup.Bold);
if (recipient_list.Count > 0)
{
for (int i = 0; i < recipient_list.Count; i++)
{
ms.Append(UserNameManager.getInstance().getUserName(recipient_list[i]) + " ");
ms.Append(createMessageLink(MENU_LINK_NAME, "[-]", "REMOVE_" + recipient_list[i]));
if (recipient_list.Count > 1 && (i != recipient_list.Count - 1))
ms.Append(", ");
}
}
else
{
ms.Append("Empty");
}
ms.AppendLine();
}
else
{
ms.Append("Recipients: ", TextMarkup.Bold);
ms.Append("Empty");
ms.AppendLine();
}
}