Ejemplo n.º 1
0
        private static void StopBots(IEnumerable <string> tokens = null)
        {
            int total = Bots.Count();
            int count = 0;

            foreach (var tBot in Bots.Keys)
            {
                tBot.StopReceiving();
                Bots[tBot].Status = BotStatus.Offline;

                count++;
                BotStopped?.Invoke(null, new BotStoppedArgs(Bots[tBot], (double)count / total * 100));
            }
        }
Ejemplo n.º 2
0
        public static void Init()
        {
            Form = new MainForm();
            Form.OnLaunchAllButtonClick       += delegate(object sender, EventArgs e) { OnLaunchAllButtonClick?.Invoke(sender, null); };
            Form.OnClientsButtonClick         += delegate(object sender, EventArgs e) { OnClientsButtonClick?.Invoke(sender, null); };
            Form.OnStopAllButtonClick         += delegate(object sender, EventArgs e) { OnStopAllButtonClick?.Invoke(sender, null); };
            Form.OnLaunchContextMenuItemClick += delegate(object sender, LaunchSeveralBotsArgs e) { OnLaunchContextMenuItemClick?.Invoke(sender, e); };
            Form.OnStopContextMenuItemClick   += delegate(object sender, StopSeveralBotsArgs e) { OnStopContextMenuItemClick?.Invoke(sender, e); };
            Form.Show();

            DBHelper.CheckDB();

            BotController.BotLaunched += delegate(object sender, BotLaunchedArgs e) { BotLaunched?.Invoke(sender, e); };
            BotController.BotStopped  += delegate(object sender, BotStoppedArgs e) { BotStopped?.Invoke(sender, e); };
            BotController.BotChecked  += delegate(object sender, BotCheckedArgs e) { BotChecked?.Invoke(sender, e); };
            BotController.Init();

            ClientController.Init();

            Form.Hide();
            Form.ShowDialog();
        }
Ejemplo n.º 3
0
 public void Handle(BotStopped @event)
 {
     Console.ForegroundColor = ConsoleColor.Green;
     Console.WriteLine("The bot stopped.");
     Console.ResetColor();
 }