示例#1
0
        public override Task StopAsync(CancellationToken cancellationToken)
        {
            botEngine?.Stop();
            grabber?.Stop();

            return(Task.CompletedTask);
        }
示例#2
0
        private static void RunBotEngine()
        {
            _botEngine = _container.Resolve <BotEngine>();
            _botEngine.Start();

            JobManager.Initialize();
            JobManager.AddJob(() => _container.Resolve <IStatService>().Publish(), (s) => s.ToRunEvery(1).Days().At(00, 00));

            Console.CancelKeyPress += (o, e) =>
            {
                _botEngine.Stop();
                _container.Dispose();

                WaitHandle.Set();
            };

            WaitHandle.WaitOne();
        }
示例#3
0
        private static void Main()
        {
            var engine = new BotEngine();
            engine.Start();
            Console.WriteLine("Bot is running. Press any key to stop him!");
            while (true)
            {
                if (Console.KeyAvailable)
                {
                    Console.ReadKey();
                    Console.WriteLine("Stopping...");
                    engine.Stop();
                    return;
                }

                Thread.Sleep(100);
                Application.DoEvents();
            }
        }