Example #1
0
        public void setData(oFunction functionBase, oSingleData measuredData)
        {
            this.functionBase = functionBase;
            this.measuredData = measuredData;
            if (functionBase == null)
            {
                this.Rows.Clear();
                return;
            }
            this.argumentClasses = functionBase.getArgumentList();



            // Cleanup this datagridview)
            this.Rows.Clear();

            // Build the combobox selection options
            string[] options = Enum.GetNames(typeof(DISPLAY_TYPE));

            // Fill out this datagridview based on the supplied data
            ARGUMENT_STRING_COLLECTION stringData = functionBase.getArgumentString(measuredData);

            DataGridViewRow[] newRows = new DataGridViewRow[argumentClasses.Count];
            for (int i = 0; i < argumentClasses.Count; i++)
            {
                // Add this row
                newRows[i] = new DataGridViewRow();

                // Add the name cell
                newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.names[i];

                // Add the type cell combobox
                DataGridViewComboBoxCell comboBox = new DataGridViewComboBoxCell();
                comboBox.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;
                comboBox.Value        = Enum.GetName(typeof(DISPLAY_TYPE), argumentClasses[i].displayMethod);
                comboBox.Items.AddRange(options);
                newRows[i].Cells.Add(comboBox);

                // Add the value cell
                newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.values[i];
            }

            // Add the new rows
            this.Rows.AddRange(newRows);
        }
        public void setData(oFunction functionBase, oSingleData measuredData)
        {
            this.functionBase = functionBase;
            this.measuredData = measuredData;
            if (functionBase == null)
            {
                this.Rows.Clear();
                return;
            }
            this.argumentClasses = functionBase.getArgumentList();

            // Cleanup this datagridview)
            this.Rows.Clear();

            // Build the combobox selection options
            string[] options = Enum.GetNames(typeof(DISPLAY_TYPE));

            // Fill out this datagridview based on the supplied data
            ARGUMENT_STRING_COLLECTION stringData = functionBase.getArgumentString(measuredData);
            DataGridViewRow[] newRows = new DataGridViewRow[argumentClasses.Count];
            for( int i = 0; i < argumentClasses.Count; i++ )
            {
                // Add this row
                newRows[i] = new DataGridViewRow();

                // Add the name cell
                newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.names[i];

                // Add the type cell combobox
                DataGridViewComboBoxCell comboBox = new DataGridViewComboBoxCell();
                comboBox.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;
                comboBox.Value = Enum.GetName(typeof(DISPLAY_TYPE), argumentClasses[i].displayMethod);
                comboBox.Items.AddRange(options);
                newRows[i].Cells.Add(comboBox);

                // Add the value cell
                newRows[i].Cells[newRows[i].Cells.Add(new DataGridViewTextBoxCell())].Value = stringData.values[i];
            }

            // Add the new rows
            this.Rows.AddRange(newRows);
        }
Example #3
0
        void DataGridViewCall_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            // A value has changed
            if (this.Rows.Count > 0)
            {
                if (e.ColumnIndex == 0)
                {
                    // Changed the name of the argument
                    argumentClasses[e.RowIndex].setStrongName((string)this.Rows[e.RowIndex].Cells[0].Value);
                    this.Rows[e.RowIndex].Cells[0].Value = argumentClasses[e.RowIndex].getName();

                    // Tell the main grid to redraw the argument column
                    if (mainGrid != null)
                    {
                        mainGrid.InvalidateColumn(3);
                    }
                }
                else if (e.ColumnIndex == 1)
                {
                    // Changed the type of the argument

                    // Update the type
                    argumentClasses[e.RowIndex].setType(
                        (DISPLAY_TYPE)Enum.Parse(typeof(DISPLAY_TYPE), (string)this.Rows[e.RowIndex].Cells[1].EditedFormattedValue));

                    // Update the cell data interpretation
                    ARGUMENT_STRING_COLLECTION stringData = functionBase.getArgumentString(measuredData);
                    this.Rows[e.RowIndex].Cells[2].Value = stringData.values[e.RowIndex];

                    // Tell the main grid to redraw the argument column
                    if (mainGrid != null)
                    {
                        mainGrid.InvalidateColumn(3);
                    }
                }
            }
        }