Пример #1
0
 public void AddAccount(Account account)
 {
     try
     {
         //Program.DM.Accounts.Add(account);
         if (AccountListChanged != null)
             AccountListChanged(account, ChangesType.Added);
         //should replace ManagerOnline with
         //_managerStatus == ManagerStatusType.Started
         if (account.Start && ManagerOnline)
             AddBot(account);
     }
     catch (Exception ex)
     { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
 }
Пример #2
0
 public void RemoveAccount(Account account)
 {
     try
     {
         if (account.bot != null)
         {
             MessageBox.Show("Can't delete bot already processed.", "Warning...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (AccountListChanged != null)
             AccountListChanged(account, ChangesType.Deleted);
         Program.DM.Accounts.Remove(account);
     }
     catch (Exception ex)
     { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
 }
Пример #3
0
 private void Dm_AccountListChanged(Account sender, DataManager.ChangesType e)
 {
     try
     {
         switch (e)
         {
             case DataManager.ChangesType.Added:
                 AddAccount(sender);
                 break;
             case DataManager.ChangesType.Deleted:
                 RemoveAccount(sender);
                 break;
             case DataManager.ChangesType.ActiveTrue:
                 if (sender.Start && ManagerOnline)
                     AddBot(sender);
                 break;
             case DataManager.ChangesType.ActiveFalse:
                 break;
             default:
                 break;
         }
     }
     catch (Exception ex)
     {
         Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace);
     }
 }
Пример #4
0
 public void AddBot(Account account)
 {
     lock (this)
     {
         try
         {
             if (SearchBot(account.charName) != null)
                 return;
             SBot bot = SBot.CreateSbot();
             account.bot = bot; bot.BotAccount = account;
             //AddBot(bot);
             _queAutoStart.Enqueue(bot);
         }
         catch (Exception ex)
         { Program.dbOperations.SaveToEx(this.GetType().ToString(), ex.Message, ex.StackTrace); }
     }
 }