Esempio n. 1
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();
            }
        }
Esempio n. 2
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();
     }
 }