Exemple #1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            //Настраиваем кнопки

            cycleToolStripMenuItem.Enabled   = false;
            folderToolStripMenuItem.Enabled  = false;
            signalToolStripMenuItem.Enabled  = false;
            deleteToolStripButton2.Enabled   = true;
            удалитьToolStripMenuItem.Enabled = true;
            dublToolStripButton3.Enabled     = false;

            //******************************************

            curPropShowMode = PropShowMode.showProperties;

            TempTabPage curTmp;

            if (Program.TemplatesPages.ContainsKey(tabControl2.SelectedIndex))
            {
                curTmp = Program.TemplatesPages[tabControl2.SelectedIndex];
            }
            else
            {
                return;
            }
            TreeNode TrNdSel = curTmp.TreeView.SelectedNode;

            if (TrNdSel is null)
            {
                return;
            }
            TrNdSel.SelectedImageIndex = TrNdSel.ImageIndex;
            object obj = Program.getObjectFromTree(TrNdSel.Name, tabControl2.SelectedIndex);

            if (obj.GetType().ToString() == "VisualTemplate.Cycle")
            {
                folderToolStripMenuItem.Enabled = true;
                signalToolStripMenuItem.Enabled = true;
                cycleToolStripMenuItem.Enabled  = true;
                dublToolStripButton3.Enabled    = true;
                curTmp.dgProps.Columns.Clear();
                curTmp.dgProps.Columns.Add("Name", "Name");
                curTmp.dgProps.Columns.Add("Value", "Value");
                curTmp.dgProps.Columns.Add("Step", "Step");
                curTmp.dgProps.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                curTmp.dgProps.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
                curTmp.dgProps.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
                Cycle c = obj as Cycle;
                Program.getSettings(c, curTmp);
                Program.getVariants(c, curTmp.dgProps);

                curTempTabPage.dgVariants.Rows.Clear();

                if (c.Variatns.Count > 0)
                {
                    toolStripButton1.Enabled = true;
                    toolStripButton2.Enabled = true;
                }
                else
                {
                    toolStripButton1.Enabled = false;
                    toolStripButton2.Enabled = false;
                }
            }
            if (obj.GetType().ToString() == "VisualTemplate.Signal")
            {
                cycleToolStripMenuItem.Enabled  = true;
                folderToolStripMenuItem.Enabled = true;
                signalToolStripMenuItem.Enabled = true;
                dublToolStripButton3.Enabled    = true;

                getSignalProperties(obj);
            }
            if (obj.GetType().ToString() == "VisualTemplate.Template")
            {
                //Настраиваем кнопки
                cycleToolStripMenuItem.Enabled = true;
                deleteToolStripButton2.Enabled = false;

                toolStripButton1.Enabled = false;
                toolStripButton2.Enabled = false;
                toolStripButton3.Enabled = false;


                удалитьToolStripMenuItem.Enabled = false;

                //****************************


                Template t = obj as Template;
                curTmp.dgProps.Columns.Clear();
                curTmp.dgProps.Columns.Add("Name", "Name");
                curTmp.dgProps.Columns.Add("Path", "Path");
                curTmp.dgProps.Columns.Add("Separator", "Separator");
                curTmp.dgProps.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                curTmp.dgProps.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
                curTmp.dgProps.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;

                DataGridViewComboBoxColumn EncType = new DataGridViewComboBoxColumn();

                EncType.Items.Add("ASCII");
                EncType.Items.Add("Default");
                EncType.Items.Add("UTF8");
                EncType.HeaderText = "Кодировка";
                curTmp.dgProps.Columns.Add(EncType);
                curTmp.dgProps.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;

                curTmp.dgProps.Columns.Add(new DataGridViewButtonColumn()
                {
                    Text = "Edit", UseColumnTextForButtonValue = true
                });
                curTmp.dgProps.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;

                curTempTabPage.dgVariants.Rows.Clear();

                if (t.CsvVars.Count > 0)
                {
                    toolStripButton1.Enabled = true;
                    toolStripButton2.Enabled = true;
                }
                else
                {
                    toolStripButton1.Enabled = false;
                    toolStripButton2.Enabled = false;
                }

                Program.getCsvVars(curTmp);
                Program.getSettings(t, TrNdSel, curTmp.dgSettings);
            }

            toolStrip2.Enabled = true;
            toolStrip3.Enabled = true;
        }
 public void Add(Cycle c)
 {
     Cycles.Add(c);
     c.tParent = this;
 }
Exemple #3
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            treeView1.SelectedNode.SelectedImageIndex = treeView1.SelectedNode.ImageIndex;
            object obj = Program.getObjectFromTree(treeView1.SelectedNode.Name);

            if (obj.GetType().ToString() == "VisualTemplate.Cycle")
            {
                dataGridProps.Columns.Clear();
                dataGridProps.Columns.Add("Name", "Name");
                dataGridProps.Columns.Add("Value", "Value");
                dataGridProps.Columns.Add("Step", "Step");
                dataGridProps.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridProps.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridProps.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
                Cycle c = obj as Cycle;
                Program.getSettings(c, treeView1.SelectedNode, dataGridSettings);
                Program.getVariants(c, dataGridProps);
            }
            if (obj.GetType().ToString() == "VisualTemplate.Signal")
            {
                dataGridProps.Columns.Clear();
                DataGridViewComboBoxColumn cmbID = new DataGridViewComboBoxColumn();
                cmbID.HeaderText = "ID";
                DataGridViewComboBoxColumn cmbType = new DataGridViewComboBoxColumn();
                cmbType.HeaderText = "Type";
                foreach (string str in Program.TypeOfProperty.Keys)
                {
                    cmbID.Items.Add(str);
                }

                foreach (string str in Program.Types.Values)
                {
                    cmbType.Items.Add(str);
                }

                dataGridProps.Columns.Add(cmbID);
                dataGridProps.Columns.Add(cmbType);
                dataGridProps.Columns.Add("Value", "Value");
                dataGridProps.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridProps.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridProps.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
                Signal s = obj as Signal;
                Program.getSettings(s, treeView1.SelectedNode, dataGridSettings);
                Program.getProperties(s, dataGridProps, treeView1.SelectedNode);



                dataGridVariants.Columns.Clear();
                dataGridVariants.Columns.Add("Name", "Name");
                dataGridVariants.Columns.Add("Value", "Value");
                dataGridVariants.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridVariants.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;

                Program.getVariants(Program.getParentCycle(s), dataGridVariants);
            }



            if (obj.GetType().ToString() == "VisualTemplate.Template")
            {
                Template t = obj as Template;
                dataGridProps.Columns.Clear();
                dataGridProps.Columns.Add("Name", "Name");
                dataGridProps.Columns.Add("Path", "Path");
                dataGridProps.Columns.Add("Separator", "Separator");
                dataGridProps.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridProps.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
                dataGridProps.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
                DataGridViewComboBoxColumn EncType = new DataGridViewComboBoxColumn();
                EncType.Items.Add("ASCII");
                EncType.Items.Add("Default");
                EncType.Items.Add("UTF8");
                EncType.HeaderText = "Кодировка";
                dataGridProps.Columns.Add(EncType);
                dataGridProps.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;

                Program.getCsvVars(dataGridProps);
                Program.getSettings(t, treeView1.SelectedNode, dataGridSettings);
            }
        }