Exemplo n.º 1
0
        /// <summary>
        /// 点击"编辑取样"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditSampleButton_Click(object sender, RoutedEventArgs e)
        {
            int selectIndex = this.SampleListDataGrid.SelectedIndex;

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

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

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

            // 实例化窗口
            ZkSampleDetail editSample = new ZkSampleDetail(lastDepthList, number, depth, isDisturbed);

            editSample.ShowDialog();
            if (editSample.DialogResult == true)
            {
                number      = editSample.SampleNumberTextBox.Text;
                depth       = Convert.ToDouble(editSample.SampleDepthTextBox.Text);
                isDisturbed = false;
                if (editSample.UnDisturbed.IsChecked == true)
                {
                    isDisturbed = false;
                }
                else
                {
                    isDisturbed = true;
                }
                EditRowSampleListDataTable(selectIndex, number, depth, isDisturbed);

                // 绘图
                DrawZk();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 点击"添加取样"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddSampleButton_Click(object sender, RoutedEventArgs e)
        {
            // 传递历史取样深度列表和历史取样编号列表
            List <string> lastNumberList = new List <string>();
            List <double> lastDepthList  = new List <double>();

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

            // 传递取样编号
            string sampleNumber = (dtSample.Rows.Count + 1).ToString();

            // 实例化窗口
            ZkSampleDetail newSample = new ZkSampleDetail(lastDepthList, sampleNumber);

            newSample.ShowDialog();
            if (newSample.DialogResult == true)
            {
                string number      = newSample.SampleNumberTextBox.Text;
                double depth       = Convert.ToDouble(newSample.SampleDepthTextBox.Text);
                bool   isDisturbed = false;
                if (newSample.UnDisturbed.IsChecked == true)
                {
                    isDisturbed = false;
                }
                else
                {
                    isDisturbed = true;
                }
                AddRowToSampleListDataTable(number, depth, isDisturbed);

                // 绘图
                DrawZk();
            }
        }