예제 #1
0
        /// <summary>
        /// 点击"编辑标贯/动探"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditNTestButton_Click(object sender, RoutedEventArgs e)
        {
            int selectIndex = this.NTestListDataGrid.SelectedIndex;

            // 传递历史取样深度列表和历史取样编号列表
            List <string> lastNumberList = new List <string>();
            List <double> lastDepthList  = new List <double>();

            if (this.NTestListDataGrid.Items.Count > 0)
            {
                for (int i = 0; i < this.NTestListDataGrid.Items.Count; i++)
                {
                    if (i != selectIndex)
                    {
                        DataRowView drv0 = (DataRowView)this.NTestListDataGrid.Items[i];
                        lastNumberList.Add(drv0[0].ToString());
                        lastDepthList.Add((double)drv0[1]);
                    }
                }
            }

            // 赋值传递数据
            DataRowView drv    = (DataRowView)this.NTestListDataGrid.SelectedItem;
            string      number = (string)drv[0];
            double      depth  = (double)drv[1];
            double      value  = (double)drv[2];

            ZkNTest.ntype type = (ZkNTest.ntype)drv[3];

            // 实例化窗口
            ZkNTestDetail editNTest = new ZkNTestDetail(lastDepthList, number, depth, value, type);

            editNTest.ShowDialog();
            if (editNTest.DialogResult == true)
            {
                number = editNTest.NTestNumberTextBox.Text;
                depth  = Convert.ToDouble(editNTest.NTestDepthTextBox.Text);
                value  = Convert.ToDouble(editNTest.NTestValueTextBox.Text);
                if (editNTest.typeN.IsChecked == true)
                {
                    type = ZkNTest.ntype.N;
                }
                else if (editNTest.typeN10.IsChecked == true)
                {
                    type = ZkNTest.ntype.N10;
                }
                else if (editNTest.typeN635.IsChecked == true)
                {
                    type = ZkNTest.ntype.N635;
                }
                else
                {
                    type = ZkNTest.ntype.N120;
                }
                EditRowNTestListDataTable(selectIndex, number, depth, value, type);

                // 绘图
                DrawZk();
            }
        }
예제 #2
0
        /// <summary>
        /// 点击"添加标贯/动探"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddNTestButton_Click(object sender, RoutedEventArgs e)
        {
            // 传递历史取样编号列表
            List <double> lastDepthList = new List <double>();

            if (this.NTestListDataGrid.Items.Count > 0)
            {
                for (int i = 0; i < this.NTestListDataGrid.Items.Count; i++)
                {
                    DataRowView drv = (DataRowView)this.NTestListDataGrid.Items[i];
                    lastDepthList.Add((double)drv[1]);
                }
            }

            // 传递试验编号
            string testNumber = (dtNTest.Rows.Count + 1).ToString();

            // 实例化窗口
            ZkNTestDetail newNTest = new ZkNTestDetail(lastDepthList, testNumber);

            newNTest.ShowDialog();
            if (newNTest.DialogResult == true)
            {
                string        number = newNTest.NTestNumberTextBox.Text;
                double        depth  = Convert.ToDouble(newNTest.NTestDepthTextBox.Text);
                double        value  = Convert.ToDouble(newNTest.NTestValueTextBox.Text);
                ZkNTest.ntype type;
                if (newNTest.typeN.IsChecked == true)
                {
                    type = ZkNTest.ntype.N;
                }
                else if (newNTest.typeN10.IsChecked == true)
                {
                    type = ZkNTest.ntype.N10;
                }
                else if (newNTest.typeN635.IsChecked == true)
                {
                    type = ZkNTest.ntype.N635;
                }
                else
                {
                    type = ZkNTest.ntype.N120;
                }
                AddRowToNTestListDataTable(number, depth, value, type);

                // 绘图
                DrawZk();
            }
        }