Пример #1
0
        private IScrapedElement GetContent(HtmlDocument htmlDoc)
        {
            var textHandler     = new TextHandler();
            var pictureHandler  = new PictureHandler();
            var passwordHandler = new PasswordHandler();
            var deletedHandler  = new DeletedHandler();

            textHandler.SetNext(pictureHandler)
            .SetNext(passwordHandler)
            .SetNext(deletedHandler);

            return(textHandler.Handle(htmlDoc, "Content"));
        }
Пример #2
0
 void BotOnMessageReceived(object sender, MessageEventArgs mea)
 {
     if (mea.Message == null)
     {
         return;
     }
     switch (mea.Message.Type)
     {
     case MessageType.Text:
         _textHandler.Handle(mea.Message);
         break;
     }
 }
Пример #3
0
        public void HandleInput(ConsoleKeyInfo input)
        {
            if (m_traverser.Handles(input))
            {
                m_traverser.Handle(input);
            }
            else if (m_textHandler.Handles(input))
            {
                m_textHandler.Handle(input);
                UpdateCurrentItems();
            }
            else if (input.Key == ConsoleKey.Escape)
            {
                m_textHandler.Clear();
                UpdateCurrentItems();
                LogService.Clear();
            }
            else if (input.Key == ConsoleKey.Tab)
            {
                LogService.Clear();
                Program.Reset();
            }
            else if (input.Key == ConsoleKey.Enter && m_currentItems.Count > 0)
            {
                var item    = m_currentItems[m_traverser.Current];
                var actions = m_currentItems[m_traverser.Current].ActionsFactory();
                if (actions.Length == 1)
                {
                    actions[0].Action();
                }
                else
                {
                    Viewer.Push(new ActionSelectionViewModel(item, actions));
                }

                m_textHandler.Clear();
                UpdateCurrentItems();
            }
        }
Пример #4
0
 public void HandleInput(ConsoleKeyInfo input)
 {
     if (m_traverser.Handles(input))
     {
         m_traverser.Handle(input);
     }
     else if (m_textHandler.Handles(input))
     {
         m_textHandler.Handle(input);
         UpdateCurrentItems();
     }
     else if (input.Key == ConsoleKey.Escape)
     {
         m_textHandler.Clear();
         UpdateCurrentItems();
     }
     else if (input.Key == ConsoleKey.Enter)
     {
         Viewer.Push(new ActionSelectionViewModel(m_currentItems[m_traverser.Current]));
         UpdateCurrentItems();
     }
 }