예제 #1
0
 void BM_AccountListChanged(object sender, BotsManager.ChangesType e)
 {
     Account account = (Account)sender;
     switch (e)
     {
         case BotsManager.ChangesType.Added:
             ListViewItem lviAdd = new ListViewItem(account.charName);
             if (account.Start)
                 lviAdd.ForeColor = AccountAutoStartEnabledColor;
             else
                 lviAdd.ForeColor = AccountAutoStartDisabledColor;
             lvAccount.Items.Add(lviAdd);
             break;
         case BotsManager.ChangesType.Updated:
             ListViewItem lviUpdate = lvAccount.SelectedItems[0];
             lviUpdate.Text = account.charName;
             if (account.Start)
                 lviUpdate.ForeColor = AccountAutoStartEnabledColor;
             else
                 lviUpdate.ForeColor = AccountAutoStartDisabledColor;
             break;
         case BotsManager.ChangesType.Deleted:
             foreach (ListViewItem item in lvAccount.Items)
             {
                 if (item.Text == account.charName)
                 {
                     item.Remove();
                     break;
                 }
             }
             break;
     }
 }
예제 #2
0
 static void Init()
 {
     try
     {
         DM = new DataManager();
         BM = new BotsManager(DM);
         LM = new Manager.CtrLayoutManager(DataManager.LayoutDataPath);
         //DM.LoadServerList();
         DM.LoadSettings();
         dbOperations = new Core.db();
     }
     catch (Exception ex)
     { dbOperations.SaveToEx("Program", ex.Message, ex.StackTrace);}
 }
예제 #3
0
 void BM_BotListChanged(object sender, BotsManager.ChangesType e)
 {
     MethodInvoker action = new MethodInvoker(() =>
         {
             SBot bot = (SBot)sender;
             switch (e)
             {
                 case BotsManager.ChangesType.Added:
                     ListViewItem lvi = new ListViewItem(bot.CharName);
                     if (bot.Visable)
                         lvi.SubItems.Add("V");
                     else
                         lvi.SubItems.Add("H");
                     lvi.SubItems.Add(bot.ID.ToString());
                     lvi.StateImageIndex = 0;
                     LVBots.Items.Add(lvi);
                     bot.StateChanged += bot_StateChanged;
                     bot.PropertyChanged += bot_PropertyChanged;
                     bot.LogAdded += bot_LogAdded;
                     break;
                 case BotsManager.ChangesType.Deleted:
                     foreach (ListViewItem item in LVBots.Items)
                     {
                         if (item.Text == bot.CharName)
                         {
                             item.Remove();
                             break; ;
                         }
                     }
                     break;
             }
         });
     this.Invoke(action);
 }