当前位置: 首页>>代码示例>>C#>>正文


C# UserSession.recordFavouriteSelection方法代码示例

本文整理汇总了C#中MxitTestApp.UserSession.recordFavouriteSelection方法的典型用法代码示例。如果您正苦于以下问题:C# UserSession.recordFavouriteSelection方法的具体用法?C# UserSession.recordFavouriteSelection怎么用?C# UserSession.recordFavouriteSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MxitTestApp.UserSession的用法示例。


在下文中一共展示了UserSession.recordFavouriteSelection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: handleFavouriteLinks

        protected InputHandlerResult handleFavouriteLinks(
            UserSession us,
            string input)
        {
            if (ADD_TO_FAV.Equals(input.Trim().ToUpper()))
            {
                VerseSection vs = (VerseSection)us.getVariableObject("Browse.verse_section");
                if (vs == null)
                {
                    return new InputHandlerResult(
                             InputHandlerResult.UNDEFINED_MENU_ACTION,
                             InputHandlerResult.DEFAULT_MENU_ID,
                             InputHandlerResult.DEFAULT_PAGE_ID);
                }
                Verse start_verse = vs.start_verse;
                if (start_verse == null)
                {
                    return new InputHandlerResult(
                             InputHandlerResult.UNDEFINED_MENU_ACTION,
                             InputHandlerResult.DEFAULT_MENU_ID,
                             InputHandlerResult.DEFAULT_PAGE_ID);
                }
                Verse end_verse = vs.end_verse;
                if (us.favourite_verses.isFavouriteListFull())
                {
                    return new InputHandlerResult(
                                    "Your favourite list is full. Please first delete an existing favourite verse"); //invalid choice
                }
                int output = us.recordFavouriteSelection(start_verse, end_verse);
                if(output == FavouriteVerseManager.FAVOURITE_VERSE_ADDED_SUCCCESS)
                {
                    //end verse should never be null
                    String verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(start_verse, end_verse);
                    return new InputHandlerResult(
                                   InputHandlerResult.FAVOURITE_ADDED_ACTION,
                                   us.current_menu_loc,
                                   verse_ref + " has been added to your favourites"); //invalid choice
                }else if(output == FavouriteVerseManager.FAVOURITE_ALREADY_ADDED)
                {
                       return new InputHandlerResult(
                                   "This is already a favourite. You can't add duplicate favourites."); //invalid choice

                }
            }
            else if (SEND_TO_BUDDY.Equals(input.Trim().ToUpper()))
            {
                return new InputHandlerResult(
                             InputHandlerResult.NEW_MENU_ACTION,
                             MenuIDConstants.SEND_VERSE_MESSAGE_ID,
                             InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else if (TAG_VERSE.Equals(input.Trim().ToUpper()))
            {
                return new InputHandlerResult(
                             InputHandlerResult.NEW_MENU_ACTION,
                             MenuIDConstants.TAG_VERSE_ID,
                             InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else if (".".Equals(input.Trim().ToUpper()))
            {
                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);
                }
                String verse_ref = BibleHelper.getVerseSectionReferenceWithoutTranslation(vs.start_verse, vs.end_verse);
                return handleDirectVerseInput(us, verse_ref);
            }
            return new InputHandlerResult(
                         InputHandlerResult.UNDEFINED_MENU_ACTION,
                         InputHandlerResult.DEFAULT_MENU_ID,
                         InputHandlerResult.DEFAULT_PAGE_ID);
        }
开发者ID:rowan84,项目名称:BibleApp,代码行数:77,代码来源:Browse_Bible_Handler.cs


注:本文中的MxitTestApp.UserSession.recordFavouriteSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。