Пример #1
0
 private void addMCell_Click(object sender, EventArgs e)
 {
     mCellForm m = new mCellForm(GetNamesOfCells());
     if(m.ShowDialog() == DialogResult.OK)
     {
         rowCount++;
         appListView.Items.Add(new ListViewItem(new string[] { rowCount.ToString, m.name, "M", m.digits, m.precision, m.connection }));
     }
 }
Пример #2
0
        private void addMCell_Click(object sender, EventArgs e)
        {
            mCellForm m = new mCellForm(GetNamesOfCells());

            if (m.ShowDialog() == DialogResult.OK)
            {
                rowCount++;
                appListView.Items.Add(new ListViewItem(new string[] { rowCount.ToString, m.name, "M", m.digits, m.precision, m.connection }));
            }
        }
Пример #3
0
        private void editCellButton_Click(object sender, EventArgs e)
        {
            string type, name, digits, precision, connection;
            int rowIndex;
            ListViewItem row;

            try
            {
                rowIndex = appListView.SelectedIndices[0];
                row = appListView.Items[rowIndex];

                //2 is index of TYPE
                name = row.SubItems[1].Text;
                type = row.SubItems[2].Text;
                digits = row.SubItems[3].Text;
                precision = row.SubItems[4].Text;
                connection = row.SubItems[5].Text;
            }
            catch (Exception)
            {
                MessageBox.Show("No row selected. Please select a row the list of APP items.", "Error");
                return;
            }

            switch (type)
            {
                case "K":
                    kCellForm k = new kCellForm(connection, name, precision, digits);

                    if(k.ShowDialog() == DialogResult.OK)
                    {
                        name = k.name;
                        digits = k.digits;
                        precision = k.precision;
                        connection = k.connection;
                    }

                    break;

                case "W":
                    wCellForm w = new wCellForm(connection, name, precision, digits, GetNamesOfCells());

                    if (w.ShowDialog() == DialogResult.OK)
                    {
                        name = w.name;
                        digits = w.digits;
                        precision = w.precision;
                        connection = w.connection;
                    }

                    break;

                case "C":
                    cCellForm c = new cCellForm(connection, name, precision, digits, GetNamesOfCells());

                    if(c.ShowDialog() == DialogResult.OK)
                    {
                        name = c.name;
                        digits = c.digits;
                        precision = c.precision;
                        connection = c.connection;
                    }
                    break;

                case "M":
                    mCellForm m = new mCellForm(connection, name, precision, digits, GetNamesOfCells());

                    if(m.ShowDialog() == DialogResult.OK)
                    {
                        name = m.name;
                        digits = m.digits;
                        precision = m.precision;
                        connection = m.connection;
                    }
                    break;

                case "Multi":
                    break;
            }

            row.SubItems[1].Text = name;
            row.SubItems[3].Text = digits;
            row.SubItems[4].Text = precision;
            row.SubItems[5].Text = connection;
        }
Пример #4
0
        private void editCellButton_Click(object sender, EventArgs e)
        {
            string       type, name, digits, precision, connection;
            int          rowIndex;
            ListViewItem row;

            try
            {
                rowIndex = appListView.SelectedIndices[0];
                row      = appListView.Items[rowIndex];

                //2 is index of TYPE
                name       = row.SubItems[1].Text;
                type       = row.SubItems[2].Text;
                digits     = row.SubItems[3].Text;
                precision  = row.SubItems[4].Text;
                connection = row.SubItems[5].Text;
            }
            catch (Exception)
            {
                MessageBox.Show("No row selected. Please select a row the list of APP items.", "Error");
                return;
            }


            switch (type)
            {
            case "K":
                kCellForm k = new kCellForm(connection, name, precision, digits);

                if (k.ShowDialog() == DialogResult.OK)
                {
                    name       = k.name;
                    digits     = k.digits;
                    precision  = k.precision;
                    connection = k.connection;
                }

                break;

            case "W":
                wCellForm w = new wCellForm(connection, name, precision, digits, GetNamesOfCells());

                if (w.ShowDialog() == DialogResult.OK)
                {
                    name       = w.name;
                    digits     = w.digits;
                    precision  = w.precision;
                    connection = w.connection;
                }

                break;

            case "C":
                cCellForm c = new cCellForm(connection, name, precision, digits, GetNamesOfCells());

                if (c.ShowDialog() == DialogResult.OK)
                {
                    name       = c.name;
                    digits     = c.digits;
                    precision  = c.precision;
                    connection = c.connection;
                }
                break;

            case "M":
                mCellForm m = new mCellForm(connection, name, precision, digits, GetNamesOfCells());

                if (m.ShowDialog() == DialogResult.OK)
                {
                    name       = m.name;
                    digits     = m.digits;
                    precision  = m.precision;
                    connection = m.connection;
                }
                break;

            case "Multi":
                break;
            }

            row.SubItems[1].Text = name;
            row.SubItems[3].Text = digits;
            row.SubItems[4].Text = precision;
            row.SubItems[5].Text = connection;
        }