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


C# UserSession.removeVariable方法代码示例

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


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

示例1: handleDisplayMessageLinks

        protected InputHandlerResult handleDisplayMessageLinks(
            UserSession user_session,
            string input,
            String error_message,
            Boolean back_without_init)
        {
            bool message_page = user_session.getVariable(DISPLAY_MESSAGE) != null;
            if (message_page == true)
            {
                user_session.removeVariable(DISPLAY_MESSAGE);
            }

            InputHandlerResult output = handleStdNavLinks(user_session, input, back_without_init);
            if (output.action != (InputHandlerResult.UNDEFINED_MENU_ACTION))
                return output;

            //if this was a messsage then the only options is the std Nav links. any other input is invalid so reshow message
            if (message_page)
            {
                user_session.setVariable(DISPLAY_MESSAGE, "Message sent");//you must be sure to remove this from hash table in handler.
                return new InputHandlerResult(
                    InputHandlerResult.DISPLAY_MESSAGE,
                    InputHandlerResult.DEFAULT_MENU_ID, //not used
                    error_message);
            }
            else
            {
                return new InputHandlerResult(
                    InputHandlerResult.UNDEFINED_MENU_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                    InputHandlerResult.DEFAULT_PAGE_ID
                    );
            }
        }
开发者ID:rowan84,项目名称:BibleApp,代码行数:34,代码来源:AInputHandler.cs

示例2: getFavouriteVerseIndex

 /*returns -1 if there favourite option wasnt chosen*/
 public int getFavouriteVerseIndex(UserSession us)
 {
     try
     {
         Object o = us.removeVariable("FavouriteVersesOptionSet.verse_from_favourites");
         if (o == null)
             return -1;
         int fav_verse_index = Int32.Parse((String)o);
         return fav_verse_index - 1;
     }
     catch (Exception e)
     {
         return -1;
     }
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:16,代码来源:Browse_Bible_Handler.cs

示例3: getDailyVerseSelected

 /*returns null if the bookmark option wasnt chosen*/
 public String getDailyVerseSelected(UserSession us)
 {
     try
     {
         Object o = us.removeVariable("DailyVerseOptionSet.daily_verse_selected");
         if (o == null)
             return null;
         String search_verse = (String)o;
         return search_verse;
     }
     catch (Exception e)
     {
         return null;
     }
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:16,代码来源:Browse_Bible_Handler.cs

示例4: getBookmarkVerse

 /*returns null if the bookmark option wasnt chosen*/
 public String getBookmarkVerse(UserSession us)
 {
     try
     {
         Object o = us.removeVariable(MainMenuHandler.BOOKMARK_VERSE_VAR_NAME);
         if (o == null)
             return null;
         String bookmark_verse = (String)o;
         return bookmark_verse;
     }
     catch (Exception e)
     {
         return null;
     }
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:16,代码来源:Browse_Bible_Handler.cs

示例5: 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);
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:21,代码来源:VerseMessageSendHandler.cs

示例6: handleExtraCommandInput

        public override InputHandlerResult handleExtraCommandInput(UserSession us, String input)
        {
            if (getExtraCommandString() != null && getExtraCommandString() != "")
            {

              //  Boolean confirmed_delete;
                Boolean is_confirming = false;
                try
                {
                    Object o = us.removeVariable("ConfirmedHistoryDelete");
                    if (o != null)
                    {
                        is_confirming = (Boolean)o;
                    }
                    else
                    {
                        is_confirming = false;
                    }
                    /*is_confirming = true;*/
                }
                catch (Exception e)
                {
                    is_confirming = false;
                    /*is_confirming = false;*/
                }

                if (!is_confirming && CLEAR_HISTORY.Equals(input.ToUpper()))
                {
                    us.setVariable("ConfirmedHistoryDelete", true);
                    return new InputHandlerResult(
                            InputHandlerResult.CONF_PAGE_ACTION,
                            InputHandlerResult.DEFAULT_MENU_ID,
                           "Are you sure that you want to clear the history (Y/N)?");
                }
                if (is_confirming)
                {
                    if (CONFIRMED_DELETE.Equals(input.ToUpper()) || CONFIRMED_DELETE_2.Equals(input.ToUpper()))
                    {
                        us.verse_history.clearHistory(us.user_profile);
                        return new InputHandlerResult("The history has been cleared");
                    }
                    else if (CANCELLED_DELETE.Equals(input.ToUpper()) || CANCELLED_DELETE_2.Equals(input.ToUpper()))
                    {
                        return new InputHandlerResult();
                    }
                }
                if (!is_confirming)
                {
                    return new InputHandlerResult(
                           InputHandlerResult.UNDEFINED_MENU_ACTION,
                           InputHandlerResult.DEFAULT_MENU_ID,
                           InputHandlerResult.DEFAULT_PAGE_ID);
                }
            }
            return new InputHandlerResult(
                   InputHandlerResult.UNDEFINED_MENU_ACTION,
                   InputHandlerResult.DEFAULT_MENU_ID,
                   InputHandlerResult.DEFAULT_PAGE_ID);
        }
开发者ID:rowan84,项目名称:BibleApp,代码行数:59,代码来源:VerseHistoryOptionSet.cs

示例7: getSearchVerse

 /*returns null if the bookmark option wasnt chosen*/
 public String getSearchVerse(UserSession us)
 {
     try
     {
         Object o = us.removeVariable(SearchHandler.SEARCH_VERSE_VAR_NAME);
         if (o == null)
             return null;
         String search_verse = (String)o;
         return search_verse;
     }
     catch (Exception e)
     {
         return null;
     }
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:16,代码来源:Browse_Bible_Handler.cs

示例8: 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)
                                {
//.........这里部分代码省略.........
开发者ID:rowan84,项目名称:BibleApp,代码行数:101,代码来源:Browse_Bible_Handler.cs

示例9: getVerseHistoryIndex

        /*returns -1 if there history option wasnt chosen*/
        public int getVerseHistoryIndex(UserSession us)
        {
            // we assume that if the session variable MxitTestApp.VerseHistoryOptionSet exists then history
            // verse was selected.
            try
            {
                Object o = us.removeVariable("VerseHistoryOptionSet.verse_from_history");
                if (o == null)
                    return -1;
                int verse_history_index = Int32.Parse((String)o);
                return verse_history_index - 1;
            }
            catch (Exception e)
            {
                return -1;

            }
        }
开发者ID:rowan84,项目名称:BibleApp,代码行数:19,代码来源:Browse_Bible_Handler.cs

示例10: getTopicVerse

 /*returns null if the bookmark option wasnt chosen*/
 public String getTopicVerse(UserSession us)
 {
     try
     {
         Object o = us.removeVariable("Bible_Topic.topic_id");
         if (o == null)
             return null;
         String verse_ref = (String)o;
         return verse_ref;
     }
     catch (Exception e)
     {
         return null;
     }
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:16,代码来源:Browse_Bible_Handler.cs

示例11: getTopFavouriteSelectedVerse

 /*returns null if there favourite option wasnt chosen*/
 public String getTopFavouriteSelectedVerse(UserSession us)
 {
     try
     {
         Object o = us.removeVariable("TopFavouriteVersesOptionSet.verse_from_top_favourites");
         if (o == null)
             return null;
         String top_fav_verse = (String)o;
         return top_fav_verse;
     }
     catch (Exception e)
     {
         return null;
     }
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:16,代码来源:Browse_Bible_Handler.cs

示例12: init

 public override void init(UserSession us)
 {
     Object curr_page = us.getVariableObject(TAGGED_VERSE_CURRENT_PAGE);
     if (curr_page != null)
     {
         int curr_page_i = (int)curr_page;
         us.removeVariable(TAGGED_VERSE_CURRENT_PAGE);
         us.current_menu_page = curr_page_i;
     }
 }
开发者ID:rowan84,项目名称:BibleApp,代码行数:10,代码来源:TaggedVersesHandler.cs

示例13: handleFriendLinks

        /*this method either returns the new screen id or the main or prev command string*/
        protected InputHandlerResult handleFriendLinks(
            UserSession user_session,
            string input)
        {
            string curr_user_page = user_session.current_menu_loc;
            String entry = input.ToUpper();
            long friend_id = -1;
            if (entry.StartsWith(BLOCK_FRIEND))
            {
                user_session.setVariable(ORIGINAL_ACTION, entry);
                friend_id = long.Parse(entry.Split('_')[1]);
                String user_name = UserNameManager.getInstance().getUserName(friend_id);

                return new InputHandlerResult(
                    InputHandlerResult.CONF_PAGE_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                   "Are you sure that you want block " + user_name +"?");
            }
            else if (entry.StartsWith(DELETE_FRIEND))
            {
                user_session.setVariable(ORIGINAL_ACTION, entry);
                friend_id = long.Parse(entry.Split('_')[1]);
                String user_name = UserNameManager.getInstance().getUserName(friend_id);

                return new InputHandlerResult(
                    InputHandlerResult.CONF_PAGE_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                   "Are you sure that you want remove " + user_name + " from your buddy list?");
            }
            if (entry.ToUpper().Equals(CONF_YES) || entry.ToUpper().Equals(CONF_Y))
            {
                String original_action = user_session.getVariable(ORIGINAL_ACTION);
                if(original_action != null)
                {
                    user_session.removeVariable(ORIGINAL_ACTION);
                    if (original_action.StartsWith(BLOCK_FRIEND))
                    {
                        friend_id = long.Parse(original_action.Split('_')[1]);
                        String user_name = UserNameManager.getInstance().getUserName(friend_id);
                        user_session.friend_manager.blockFriend(friend_id);
                        user_session.setVariable(BLOCKED_FRIEND_NAME, user_name);
                    }else if(original_action.StartsWith(DELETE_FRIEND))
                    {
                        friend_id = long.Parse(original_action.Split('_')[1]);
                        user_session.friend_manager.deleteFriendRequest(friend_id);
                        String user_name = UserNameManager.getInstance().getUserName(friend_id);
                        user_session.setVariable(DELETED_FRIEND_NAME, user_name);
                    }

                    return new InputHandlerResult(
                        InputHandlerResult.BACK_MENU_ACTION,
                        InputHandlerResult.DEFAULT_MENU_ID,
                        InputHandlerResult.DEFAULT_PAGE_ID); //the menu id is retreived from the session in this case.
                }
                return new InputHandlerResult(
                    InputHandlerResult.UNDEFINED_MENU_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                    InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else if (entry.ToUpper().Equals(CONF_NO) || entry.ToUpper().Equals(CONF_N))
            {
                    String original_action = user_session.getVariable(ORIGINAL_ACTION);
                    if(original_action != null)
                    {
                        user_session.removeVariable(ORIGINAL_ACTION);
                    }
                    return new InputHandlerResult(
                        InputHandlerResult.DO_NOTHING_ACTION,
                        InputHandlerResult.DEFAULT_MENU_ID,
                        InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else if (entry.StartsWith(FILTER_LIST))
            {
                String filter = entry.Split('_')[1];
                user_session.setVariable(FRIEND_LIST_FILTER, filter);

                    return new InputHandlerResult(
                        InputHandlerResult.DO_NOTHING_ACTION,
                        InputHandlerResult.DEFAULT_MENU_ID,
                        InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else
            {
                String original_action = user_session.getVariable(ORIGINAL_ACTION);
                if (original_action != null)
                {
                    user_session.removeVariable(ORIGINAL_ACTION);
                }
                return new InputHandlerResult(
                    InputHandlerResult.UNDEFINED_MENU_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                    InputHandlerResult.DEFAULT_PAGE_ID);
            }
        }
开发者ID:rowan84,项目名称:BibleApp,代码行数:95,代码来源:FriendHandler.cs

示例14: handleMessageInboxLinks

        /*this method either returns the new screen id or the main or prev command string*/
        protected InputHandlerResult handleMessageInboxLinks(
            UserSession user_session,
            string input)
        {
            string curr_user_page = user_session.current_menu_loc;
            String entry = input.ToUpper();
            String thread_id = "";
            long t_id = -1;
            if (entry.StartsWith(OPEN_THREAD))
            {
                thread_id = entry.Split('_')[1];
                user_session.setVariable(CURRENTLY_VIEWING_TRHEAD, thread_id);

                return new InputHandlerResult(
                    InputHandlerResult.NEW_MENU_ACTION,
                    MenuIDConstants.VIEW_THREAD_ID,
                    InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else if (entry.StartsWith(DELETE_THREAD))
            {
                user_session.setVariable(ORIGINAL_ACTION, entry);
                return new InputHandlerResult(
                    InputHandlerResult.CONF_PAGE_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                   "Are you sure that you want remove this message from your inbox?");
            }
            if (entry.ToUpper().Equals(CONF_YES) || entry.ToUpper().Equals(CONF_Y))
            {
                String original_action = user_session.getVariable(ORIGINAL_ACTION);
                if (original_action != null)
                {
                    user_session.removeVariable(ORIGINAL_ACTION);
                    if (original_action.StartsWith(DELETE_THREAD))
                    {
                        t_id= long.Parse(original_action.Split('_')[1]);
                        VerseMessageThread vmt = VerseThreadManager.getInstance().getVerseMessageThread(t_id);
                        if(vmt != null)
                        {
                            user_session.verse_messaging_manager.removeParticipantFromThread(vmt);
                            return new InputHandlerResult("Message Deleted..");
                        }
                        else{
                            return new InputHandlerResult("Something went wrong when attempting to delete the message from your inbox. Please let us know so that we can look into the issue.");
                        }
                    }

                    return new InputHandlerResult(
                        InputHandlerResult.BACK_MENU_ACTION,
                        InputHandlerResult.DEFAULT_MENU_ID,
                        InputHandlerResult.DEFAULT_PAGE_ID); //the menu id is retreived from the session in this case.
                }
                return new InputHandlerResult(
                    InputHandlerResult.UNDEFINED_MENU_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                    InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else if (entry.ToUpper().Equals(CONF_NO) || entry.ToUpper().Equals(CONF_N))
            {
                String original_action = user_session.getVariable(ORIGINAL_ACTION);
                if (original_action != null)
                {
                    user_session.removeVariable(ORIGINAL_ACTION);
                }
                return new InputHandlerResult(
                    InputHandlerResult.DO_NOTHING_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                    InputHandlerResult.DEFAULT_PAGE_ID);
            }
            else if (entry.ToUpper().Equals(REFRESH_INBOX))
            {
                return new InputHandlerResult(
                    InputHandlerResult.DO_NOTHING_ACTION,
                    InputHandlerResult.DEFAULT_MENU_ID,
                    user_session.current_menu_page);
            }
            return new InputHandlerResult(
                InputHandlerResult.UNDEFINED_MENU_ACTION,
                InputHandlerResult.DEFAULT_MENU_ID,
                InputHandlerResult.DEFAULT_PAGE_ID);
        }
开发者ID:rowan84,项目名称:BibleApp,代码行数:81,代码来源:MessageInboxHandler.cs


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