예제 #1
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;
             }
         }
     }
 }
예제 #2
0
        void DelGroup(string name)
        {
            Server.Group g = null;
            int          n = 0;

            foreach (TreeNode node in treeGroup.Nodes)
            {
                if (node.Tag != null)
                {
                    g = node.Tag as Server.Group;
                    if (g.name == name)
                    {
                        break;
                    }
                }
                n++;
            }
            if (g != null)
            {
                treeGroup.Nodes.RemoveAt(n);
                if (servers.Count == 0)
                {
                    return;
                }
                servers[0].CM_DelGroup(g.id);
            }
        }
예제 #3
0
 void UpdateGroup(string name)
 {
     if (treeGroup.SelectedNode == null || treeGroup.SelectedNode.Index == 0)
     {
         return;
     }
     Server.Group g = treeGroup.SelectedNode.Tag as Server.Group;
     g.name = name;
     treeGroup.SelectedNode.Text = name;
     if (servers.Count > 0)
     {
         servers[0].CM_UpdateGroup(g.id, name);
     }
 }
예제 #4
0
        void itemToGroupItem_Click(object sender, EventArgs e)
        {
            ToolStripButton item = sender as ToolStripButton;
            int             id   = 0;

            if (item.Tag != null)
            {
                Server.Group g = item.Tag as Server.Group;
                id = g.id;
            }
            if (currBot != null)
            {
                currBot.server.CM_SetBotGroup(currBot.id, currBot.uid, id);
            }
        }
예제 #5
0
        void AddGroup(string name)
        {
            if (servers.Count == 0)
            {
                return;
            }
            int id = servers[0].CM_AddGroup(name);

            if (id > 0)
            {
                Server.Group g = new Server.Group();
                g.id   = id;
                g.name = name;
                TreeNode node = new TreeNode(name);
                node.Tag = g;
                treeGroup.Nodes.Add(node);
            }
        }
예제 #6
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;
                 }
             }
         }
     }
 }