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")); }
void BotOnMessageReceived(object sender, MessageEventArgs mea) { if (mea.Message == null) { return; } switch (mea.Message.Type) { case MessageType.Text: _textHandler.Handle(mea.Message); break; } }
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(); } }
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(); } }