Ejemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            _window = new UpcomingEventsWindow();

            _eventMonitor = new EventMonitor(Util.Configuration.Instance.Api);
            _eventMonitor.Interval = Util.Configuration.Instance.MonitorInterval;
            _eventMonitor.EventsChanged += new EventHandler<EventsChangedEventArgs>(EventsArrived);
            _eventMonitor.Start();
        }
Ejemplo n.º 2
0
        public void StartRepl()
        {
            _screenManager.PrintHeader();
            _screenManager.PrintUsage();
            _screenManager.PrintLine();

            ReadLine.AutoCompletionHandler = new AutoCompleteWithRegisteredCommand(_commands.Select(c => c.Name).ToList());

            while (true)
            {
                //string command = _screenManager.GetCommand();
                string command = ReadLine.Read("aelf> ");


                if (string.IsNullOrWhiteSpace(command))
                {
                    continue;
                }

                ReadLine.AddHistory(command);

                // stop the repl if "quit", "Quit", "QuiT", ... is encountered
                if (command.Equals(ExitReplCommand, StringComparison.OrdinalIgnoreCase))
                {
                    Stop();
                    break;
                }

                if (command.StartsWith("sub events"))
                {
                    string[] splitOnSpaces = command.Split(' ');

                    if (splitOnSpaces.Length == 3)
                    {
                        EventMonitor mon = new EventMonitor(_port, splitOnSpaces[2]);
                        mon.Start().GetResult();
                        Console.ReadKey();
                    }
                    else
                    {
                        Console.WriteLine("Sub events - incorrect arguments");
                    }
                }

                CmdParseResult       parsedCmd = _cmdParser.Parse(command);
                CliCommandDefinition def       = GetCommandDefinition(parsedCmd.Command);

                if (def == null)
                {
                    _screenManager.PrintCommandNotFound(command);
                }
                else
                {
                    ProcessCommand(parsedCmd, def);
                }
            }
        }
Ejemplo n.º 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     eventMonitor.Start();
 }