Пример #1
0
        /**To check if the row datas is intact.*/
        private bool isRowDataCorrect(int index)
        {
            RowData currRowData = currentMeasData.rowDataList[index];

            if (currRowData.Cycle == "")
            {
                return(false);
            }
            else if (currRowData.Source == (Source)(-1))
            {
                return(false);
            }
            else if (currRowData.Mode == (Mode)(-1))
            {
                return(false);
            }
            return(true);
        }
Пример #2
0
        /**Set the specified row's item.
         * @param father the specified row's father panel
         * @param rowData the data source
         */
        private bool setRowItem(Panel father, RowData rowData)
        {
            bool isCycelChanged = false;

            foreach (Control control in father.Controls)
            {
                if (control is ComboBox)
                {
                    if (((ComboBox)control).Name.Contains("cbCycle"))
                    {
                        if (((ComboBox)control).Items.IndexOf(rowData.Cycle) == -1)
                        {
                            isCycelChanged = true;
                            continue;
                        }
                        ((ComboBox)control).Text = rowData.Cycle;
                    }
                    else if (((ComboBox)control).Name.Contains("cbSource"))
                    {
                        ((ComboBox)control).SelectedIndex = (int)rowData.Source;
                    }
                    else if (((ComboBox)control).Name.Contains("cbMode"))
                    {
                        ((ComboBox)control).SelectedIndex = (int)rowData.Mode;
                    }
                }
                else if (control is Panel)
                {
                    foreach (Control subControl in control.Controls)
                    {
                        if (subControl is CheckBox)
                        {
                            ((CheckBox)subControl).Checked = rowData.activity;
                        }
                    }
                }
            }
            return(isCycelChanged);
        }
Пример #3
0
        /**When the button of AddRow clicked, this function is called to add a new row.*/
        private void buttonAddRow_Click(object sender, EventArgs e)
        {
            if (++currentRow > MAXROWCOUNT)
            {
                MessageShow.show("The row is out of range!", "行数超过最大限定!");
                currentRow--;
                return;
            }

            string  controlName = "panelRow" + currentRow;
            Control control     = splitContainer2.Panel1.Controls[controlName];

            if (control is Panel)
            {
                initRowItem(control as Panel);
                (control as Panel).Visible = true;
            }
            currentMeasData.isChagesSaved = false;

            RowData newRowData = new RowData();

            currentMeasData.rowDataList.Add(newRowData);
        }