Example #1
0
        private bool ArticleList_OnItemKeyHandler(ConsoleKeyInfo key, FeedItem selectedItem, Picklist <FeedItem> parent)
        {
            //Open article
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.OpenArticle))
            {
                return(OpenArticle(selectedItem, parent));
            }
            //Mark selected item as read
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.MarkRead))
            {
                if (selectedItem != null)
                {
                    selectedItem.MarkAsRead();
                    selectedItem.DisplayText = selectedItem.DisplayLine;
                }
            }
            //Mark all read
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.MarkAllRead))
            {
                return(MarkAllRead());
            }
            //Mark selected item as unread
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.MarkUnread))
            {
                if (selectedItem != null && !selectedItem.IsNew)
                {
                    selectedItem.MarkUnread();
                    selectedItem.DisplayText = selectedItem.DisplayLine;
                }
            }
            //Mark current item for deletion
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.Delete))
            {
                if (selectedItem != null)
                {
                    selectedItem.MarkDeleted();
                    selectedItem.DisplayText = selectedItem.DisplayLine;
                }
            }

            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.DeleteAll))
            {
                return(DeleteAllArticles());
            }

            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.StepBack))
            {
                return(false);
            }

            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.Reload))
            {
                return(Reload(parent));
            }
            //Download selected item content to local storage
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.Download))
            {
                return(Download(selectedItem));
            }
            //Delete locally stored content
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.DeleteContent))
            {
                return(DeleteContent(selectedItem));
            }
            //open in browser
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.OpenBrowser))
            {
                return(OpenArticleInBrowser(selectedItem));
            }
            //search
            if (key.VerifyKey((ConfigObject)Config.Global.Shortcuts.Search))
            {
                parent.IsDisplayed = false;
                var result = GlobalMethods.Search(_mainView);
                parent.IsDisplayed = true;
                return(result);
            }
            return(true);
        }