Ejemplo n.º 1
0
        /**Add a new measurement data to the list and inital the table.*/
        private void addNewMeasurementDataToList()
        {
            string  controlName;
            Control control;

            for (int i = currentRow; i > 0; i--)
            {
                controlName = "panelRow" + i;
                control     = splitContainer2.Panel1.Controls[controlName];
                if (control is Panel)
                {
                    initRowItem((Panel)control);
                    (control as Panel).Visible = false;
                }
            }
            panelRow1.Visible = true;

            currentMeasData = new MeasurementData();
            measurementDataList.Add(currentMeasData);
            currentIndex++;
            currentRow = 1;
            RowData newRowData = new RowData();

            currentMeasData.rowDataList.Add(newRowData);
            currentMeasData.isChagesSaved = false;
        }
Ejemplo n.º 2
0
        /**When the datas are loaded from the file, this funcion make the table lists and show it.*/
        public bool formReload()
        {
            bool           isCycelChanged = false;
            bool           setResult;
            string         controlName;
            List <RowData> rowList;
            Control        control;

            isResponse = false;
            clearDatas();
            for (int j = 1; j <= measurementDataList.Count; j++)
            {
                currentMeasData = measurementDataList[j - 1];
                rowList         = currentMeasData.rowDataList;
                currentIndex    = j;
                currentRow      = rowList.Count;

                for (int i = 1; i <= MAXROWCOUNT; i++)
                {
                    controlName = "panelRow" + i;
                    control     = splitContainer2.Panel1.Controls[controlName];
                    if (control is Panel)
                    {
                        if (i <= currentRow)
                        {
                            setResult = setRowItem((Panel)control, rowList[i - 1]);
                            if (setResult)
                            {
                                isCycelChanged = true;
                            }
                            (control as Panel).Visible = true;
                        }
                        else
                        {
                            (control as Panel).Visible = false;
                        }
                    }
                }
            }
            setCurrentRadionButtonChecked();
            isResponse = true;
            return(isCycelChanged);
        }
Ejemplo n.º 3
0
        public MapRowDatas(TableLayoutPanel tableLayout, MeasurementData measurementData, List <List <SingleGateSeries> > singleList, List <List <DoubleGatesSeries> > doubleList)
        {
            this.tableLayout     = tableLayout;
            this.measurementData = measurementData;
            rowIndex             = tableLayout.RowCount - 1;

            initControls();

            if (!measurementData.isDoubleGates)
            {
                tchartSeries = new SingleGateSeries(newTchart);
                tchartSeries.bindToList(measurementData.rowDataList, singleList, doubleList);
            }
            else
            {
                tchartSeries = new DoubleGatesSeries(newTchart);
                tchartSeries.bindToList(measurementData.rowDataList, singleList, doubleList);
            }
        }
Ejemplo n.º 4
0
        private void clearDatas()
        {
            string  controlName;
            Control control;

            for (int i = 1; i <= MAXROWCOUNT; i++)
            {
                controlName = "panelRow" + i;
                control     = splitContainer2.Panel1.Controls[controlName];
                if (control is Panel)
                {
                    initRowItem(control as Panel);
                    (control as Panel).Visible = false;
                }
            }
            currentMeasData = null;
            currentIndex    = 0;
            currentRow      = 0;
            refreshMeasureList();
        }
Ejemplo n.º 5
0
        /**When the measurementData is changed, just update it and the text, fastline.
         * We must clear the cycelList before using this function.
         */
        public void updataSource(MeasurementData measurementData, List <List <SingleGateSeries> > singleList, List <List <DoubleGatesSeries> > doubleList)
        {
            this.measurementData = measurementData;

            if (!measurementData.isDoubleGates)
            {
                if (tchartSeries is SingleGateSeries)
                {
                    tchartSeries.clear();
                    tchartSeries.bindToList(measurementData.rowDataList, singleList, doubleList);
                }
                else
                {
                    tchartSeries.removeSeries();

                    tchartSeries = new SingleGateSeries(newTchart);
                    tchartSeries.bindToList(measurementData.rowDataList, singleList, doubleList);
                }
            }
            else
            {
                if (tchartSeries is SingleGateSeries)
                {
                    tchartSeries.removeSeries();

                    tchartSeries = new DoubleGatesSeries(newTchart);
                    tchartSeries.bindToList(measurementData.rowDataList, singleList, doubleList);
                }
                else
                {
                    tchartSeries.clear();
                    tchartSeries.bindToList(measurementData.rowDataList, singleList, doubleList);
                }
            }
            addGridItems();
        }
Ejemplo n.º 6
0
        /**Change the datas of the table accroding to the specified radionbutton.*/
        private void showSelectedTable(object sender, EventArgs e)
        {
            string         controlName;
            int            tableIndex;
            List <RowData> rowList;
            Control        control;
            RadioButton    radionButton;

            if (sender is RadioButton)
            {
                radionButton = (RadioButton)sender;
            }
            else
            {
                return;
            }
            if (!radionButton.Checked)
            {
                return;  // If the button is unchecked, we just do nothing beacuse we use radioButton.
            }
            if (!isResponse)
            {
                return;  // If isResponse is false, it means we just ignorge the change.
            }
            if (!currentMeasData.isChagesSaved)
            {
                isResponse = false;
                setCurrentRadionButtonChecked();
                MessageShow.show("Please save current datas first!", "请先保存当前配置!");
                isResponse = true;
                return;
            }

            try
            {
                string str = radionButton.Tag.ToString();
                tableIndex = Convert.ToInt32(str);
                if (tableIndex > measurementDataList.Count)
                {
                    return;
                }
            }
            catch
            {
                MessageShow.show("Error of CheckBox CheckedChanged!", "列表TAG值异常!");
                return;
            }

            isResponse      = false;
            currentMeasData = measurementDataList[tableIndex - 1];
            rowList         = currentMeasData.rowDataList;
            currentIndex    = tableIndex;
            currentRow      = rowList.Count;

            for (int i = 1; i <= MAXROWCOUNT; i++)
            {
                controlName = "panelRow" + i;
                control     = splitContainer2.Panel1.Controls[controlName];
                if (control is Panel)
                {
                    if (i <= currentRow)
                    {
                        setRowItem((Panel)control, rowList[i - 1]);
                        (control as Panel).Visible = true;
                    }
                    else
                    {
                        (control as Panel).Visible = false;
                    }
                }
            }

            setCurrentRadionButtonChecked();
            isResponse = true;
        }