當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。