Exemple #1
0
        void AddBots(List <Server.IdUid> lb, Server server)
        {
            BindingSource       bs    = (BindingSource)gridBots.DataSource;
            List <Server.IdUid> bots2 = bots.FindAll(bot2 => bot2.server == server);            //берем боты которые принадлежат серверу от которого данные

            //добавляем и обновляем
            foreach (Server.IdUid bot in lb)
            {
                Server.IdUid b = bots2.Find(bot2 => bot2.id == bot.id);
                if (b == null)
                {
                    bs.Add(bot);
                }
                else
                {
                    b.Update(bot);
                    bots2.Remove(b);
                    if (b == currBot)
                    {
                        SelectBot(b);                                   //обновление содержимого выбранного бота
                    }
                }
            }
            //удаляем те что остались, они на сервере пропали
            foreach (Server.IdUid bot in bots2)
            {
                bs.Remove(bot);
            }
            gridBots.Refresh();
        }
Exemple #2
0
 private void treeGroup_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (treeGroup.SelectedNode != null)
     {
         tbNameGroup.Text = treeGroup.SelectedNode.Text;
         int id = 0;
         if (treeGroup.SelectedNode.Tag != null)
         {
             Server.Group g = treeGroup.SelectedNode.Tag as Server.Group;
             id = g.id;
         }
         gridBots.CurrentCell = null;
         foreach (DataGridViewRow r in gridBots.Rows)
         {
             Server.IdUid bot = (Server.IdUid)r.DataBoundItem;
             if (bot.idGroup == id || id == 0)
             {
                 r.Visible = true;
             }
             else
             {
                 r.Visible = false;
             }
         }
     }
 }
Exemple #3
0
 public ControlCmd(Server.IdUid bot, bool user)
 {
     InitializeComponent();
     this.bot        = bot;
     funcInited      = new DelegateInited(Inited);
     funcPrintOutput = new DelegatePrintOutput(PrintOutput);
     funcSetError    = new DelegateSetError(SetError);
     this.user       = user;
 }
Exemple #4
0
 void SelectBot(Server.IdUid bot)
 {
     tbUID.Text     = bot.uid;
     tbIP.Text      = bot.ip;
     tbComment.Text = bot.comment;
     tbInfo.Text    = bot.info;
     tbState.Text   = bot.ports;
     currBot        = bot;
 }
        public void Init(Server.IdUid currBot, int style)
        {
            BotPage ret = botPages.Find(b => b.bot == currBot);

            if (ret == null)
            {
                ret     = new BotPage();
                ret.bot = currBot;
                if (GetTabs().TabPages.Count == 1 && botPages.Count == 0) //вставляем 1-ю вкладку (одна пустая вкладка уже есть, для красоты)
                {
                    ret.page = GetTabs().TabPages[0];
                }
                else
                {
                    ret.page = new TabPage();
                    GetTabs().TabPages.Add(ret.page);
                }
                botPages.Add(ret);
                ret.page.Text = currBot.uid;
            }
            if (style == 0)
            {
                ControlVideo cv = new ControlVideo(ret.bot);
                if (ret.controls == null)
                {
                    ret.controls      = new ControlBotPages();
                    ret.controls.Dock = DockStyle.Fill;
                    ret.page.Controls.Add(ret.controls);
                    ret.controls.Start();
                }
                ret.controls.AddPage(cv, "Видео");
            }
            if (style == 1)
            {
                RemoteControl rc = new RemoteControl();
                rc.host = currBot.server.IP;                // "127.0.0.1";//currBot.ip;
                string [] ports;
                ports   = currBot.ports.Split(' ');
                rc.port = Convert.ToInt32(ports[0]);
                if (ret.controls == null)
                {
                    ret.controls      = new ControlBotPages();
                    ret.controls.Dock = DockStyle.Fill;
                    ret.page.Controls.Add(ret.controls);
                    ret.controls.Start();
                }
                ret.controls.AddPage(rc, "VNC");
            }
            GetTabs().SelectedTab = ret.page;
        }
Exemple #6
0
        public ControlFileTransfer(Server.IdUid bot)
        {
            InitializeComponent();
            this.bot = bot;

            funcUpdateListView    = UpdateListView;
            funcSetInfoCopy       = SetInfoCopy;
            funcAddHistory        = AddHistory;
            funcUpdateMyFileList  = UpdateMyFileList;
            funcUpdateBotFileList = UpdateBotFileList;

            InitListImage(lvFilesBot);
            InitListImage(lvFilesMy);

            queueFiles = new Queue <TaskFile>();
        }
Exemple #7
0
 private void gridBots_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.ColumnIndex == 0)
     {
         Server.IdUid bot = (Server.IdUid)gridBots.Rows[e.RowIndex].DataBoundItem;
         e.Value = string.Empty;
         foreach (TreeNode node in treeGroup.Nodes)
         {
             if (node.Tag != null)
             {
                 Server.Group g = (Server.Group)node.Tag;
                 if (g.id == bot.idGroup)
                 {
                     e.Value = g.name;
                     break;
                 }
             }
         }
     }
 }
Exemple #8
0
 public ControlVideo(Server.IdUid bot)
 {
     InitializeComponent();
     this.bot      = bot;
     funcSetBitmap = new DelegateSetBitmap(SetBitmap);
 }
Exemple #9
0
 public StarterCmd(ControlCmd control, Server.IdUid bot)
 {
     this.control = control;
     this.bot     = bot;
 }
Exemple #10
0
 private void gridBots_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     Server.IdUid bot = (Server.IdUid)gridBots.Rows[e.RowIndex].DataBoundItem;
     SelectBot(bot);
 }