本文整理汇总了C#中MxitTestApp.UserSession.recordVerseSelection方法的典型用法代码示例。如果您正苦于以下问题:C# UserSession.recordVerseSelection方法的具体用法?C# UserSession.recordVerseSelection怎么用?C# UserSession.recordVerseSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MxitTestApp.UserSession
的用法示例。
在下文中一共展示了UserSession.recordVerseSelection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleDirectVerseInput
protected InputHandlerResult handleDirectVerseInput(
UserSession us,
string input)
{
try
{
int verse_id = -1;
VerseSection vs = (VerseSection)us.getVariableObject("Browse.verse_section");
if (vs == null)
{
Console.WriteLine("Expected Browse.verse_section present, but not found");
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
if (Int32.TryParse(input, out verse_id))
{
Verse curr_start_verse = vs.start_verse;
Verse end_verse = vs.end_verse;
Verse start_verse = curr_start_verse.chapter.getVerse(verse_id);
if (start_verse != null)
{
//end_verse = getDefaultEndVerse(start_verse);
end_verse = start_verse;
vs = new VerseSection(start_verse, end_verse);//we set end verse to distinguish browsing from direct input
us.setVariable("Browse.verse_section", vs);
us.recordVerseSelection(start_verse, end_verse);
return new InputHandlerResult(InputHandlerResult.NEW_MENU_ACTION,
us.current_menu_loc,
InputHandlerResult.DEFAULT_PAGE_ID);
}
else
{
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
}
else
{
VerseSection vs1 = (VerseSection)us.getVariableObject("Browse.verse_section");
if (vs1 == null)
{
Console.WriteLine("Expected Browse.verse_section present, but not found");
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
String current_book = "";
String current_chapter = "";
input = input.Replace(".", ":");
if(vs1 != null && vs1.start_verse != null)
{
current_book = vs1.start_verse.book.name;
current_chapter = vs1.start_verse.chapter.chapter_id.ToString(); // TODO: check the taking of chapter from start verse and not end verse
}
VerseSection vsection = Verse_Handler.getVerseSection(us, input, current_book, current_chapter);
if (vsection != null)
{
us.setVariable("Browse.verse_section", vsection);
Verse start_verse = vsection.start_verse;
Verse end_verse = vsection.end_verse;
us.recordVerseSelection(start_verse, end_verse);
return new InputHandlerResult(
InputHandlerResult.NEW_MENU_ACTION,
us.current_menu_loc,
InputHandlerResult.DEFAULT_PAGE_ID);
}
else
{
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
}
}
catch (Exception e)
{
return new InputHandlerResult(
InputHandlerResult.UNDEFINED_MENU_ACTION,
InputHandlerResult.DEFAULT_MENU_ID,
InputHandlerResult.DEFAULT_PAGE_ID);
}
}
示例2: init
public override void init(UserSession us)
{
//Console.WriteLine("Init Browse Interaction");
//first we need a way to know if the screen should be cleared.
us.setVariable(BROWSE_CLEAR_SCREEN, true);
//now this is one big hack
Boolean direct_select;
try
{
Object o = us.removeVariable("Browse.directSelect");
if(o==null)
direct_select = false;
else
direct_select = (Boolean)o;
}catch(Exception e)
{
direct_select = false;
}
int verse_history_index = getVerseHistoryIndex(us);
//Verse was selected from history of verses
if (verse_history_index > -1)
{
ReadOnlyCollection<VerseHistoryRecord> history_list = us.verse_history.getHistoryListForDisplay();
VerseHistoryRecord vhr = history_list[verse_history_index];
Verse start_verse = Verse_Handler.getStartingVerse(us.user_profile.getDefaultTranslationId(), vhr.start_verse);
Verse end_verse;
if (vhr.end_verse == null || vhr.start_verse.Equals(vhr.end_verse))
end_verse = start_verse;
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);
VerseSection vs = new VerseSection(start_verse, end_verse);
us.setVariable("Browse.verse_section", vs);
}
else
{
String top_fav_verse = getTopFavouriteSelectedVerse(us);
if (top_fav_verse != null)
{
VerseSection vs = Verse_Handler.getVerseSection(us, top_fav_verse, null, null);
if (vs != null)
{
us.setVariable("Browse.verse_section", vs);
us.recordVerseSelection(vs.start_verse, vs.end_verse);
}
}
else
{
int fav_verse_index = getFavouriteVerseIndex(us);
//Verse was selected from history of verses
if (fav_verse_index > -1)
{
ReadOnlyCollection<FavouriteVerseRecord> favourite_list = us.favourite_verses.getFavouriteListForDisplay();
FavouriteVerseRecord fvr = favourite_list[fav_verse_index];
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 = start_verse;
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);
VerseSection vs = new VerseSection(start_verse, end_verse);
us.setVariable("Browse.verse_section", vs);
us.recordVerseSelection(vs.start_verse, vs.end_verse);
}
else{
String bookmark_verse = getBookmarkVerse(us);
if (bookmark_verse != null)
{
VerseSection vs = Verse_Handler.getVerseSection(us, bookmark_verse, null, null);
if (vs != null)
{
us.setVariable("Browse.verse_section", vs);
us.recordVerseSelection(vs.start_verse, vs.end_verse);
}
}
else
{
String daily_verse = getDailyVerseSelected(us);
if (daily_verse != null)
{
VerseSection vs = Verse_Handler.getVerseSection(us, daily_verse, null, null);
if (vs != null)
{
us.setVariable("Browse.verse_section", vs);
us.recordVerseSelection(vs.start_verse, vs.end_verse);
}
}
else
{
String topic_verse = getTopicVerse(us);
if (topic_verse != null)
{
//.........这里部分代码省略.........