Beispiel #1
0
        private void CreateMatrix()
        {
            bool enabled;
            int  pix_Size;
            int  pix_Margin;
            int  pix_H;
            int  pix_V;
            int  matrix_H;
            int  matrix_V;
            int  net;
            int  subnet;
            int  ports;
            int  port;

            main.artnetManager.PauseMode = true;
            main.artnetManager.Nodes.Clear();
            main.clientWindow.Controls.Clear();

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                if (!row.IsNewRow)
                {
                    enabled = Convert.ToBoolean(row.Cells["Enabled"].Value);
                    if (enabled)
                    {
                        pix_Size   = Convert.ToInt32(row.Cells["Pix_Size"].Value);
                        pix_Margin = Convert.ToInt32(row.Cells["Pix_Margin"].Value);
                        pix_H      = Convert.ToInt32(row.Cells["Pix_H"].Value);
                        pix_V      = Convert.ToInt32(row.Cells["Pix_V"].Value);
                        matrix_H   = Convert.ToInt32(row.Cells["Matrix_H"].Value);
                        matrix_V   = Convert.ToInt32(row.Cells["Matrix_V"].Value);
                        net        = Convert.ToInt32(row.Cells["Net"].Value);
                        subnet     = Convert.ToInt32(row.Cells["Subnet"].Value);
                        ports      = Convert.ToInt32(row.Cells["Ports"].Value);

                        ArtNetNode node = new ArtNetNode(net, subnet, ports);
                        main.artnetManager.Nodes.Add(node);

                        port = 0;
                        for (int y = 0; y < matrix_V; y++)
                        {
                            int y1 = y * (pix_V * pix_Size - 1 + pix_Margin) + pix_Margin;

                            for (int x = 0; x < matrix_H; x++)
                            {
                                int x1 = x * (pix_H * pix_Size - 1 + pix_Margin) + pix_Margin;

                                ArtUI_Matrix matrix = new ArtUI_Matrix(node, port++, new Size(pix_H, pix_V), new Point(x1, y1), new Size(pix_Size, pix_Size), Color.Gray);
                                matrix.Create();
                                matrix.Start(ArtUI_Matrix.UPDATE_ULTRA_FAST);
                                main.clientWindow.Controls.Add(matrix);
                            }
                        }
                    }
                }
            }
            main.artnetManager.PauseMode = false;
        }
        private void SelectionUpdate(int rowIndex)
        {
            DataGridViewCell cellNet;
            DataGridViewCell cellSubnet;

            bool selected;

            int net    = -1;
            int subnet = -1;

            if ((rowIndex >= 0) && (!isClosing))
            {
                cellNet    = dataGridView.Rows[rowIndex].Cells[1];
                cellSubnet = dataGridView.Rows[rowIndex].Cells[2];

                net    = Convert.ToInt32(cellNet.Value);
                subnet = Convert.ToInt32(cellSubnet.Value);

                try
                {
                    foreach (Control c in main.clientWindow.Controls)
                    {
                        selected = false;
                        if (c.GetType() == typeof(ArtUI_Matrix))
                        {
                            ArtUI_Matrix matrix = (ArtUI_Matrix)c;
                            selected |= ((matrix.node.Net == net) && (matrix.node.Subnet == subnet));
                            ((ArtUI_Matrix)c).isTagged = selected;
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }