コード例 #1
0
        /// <summary>
        /// 点击"输出为Word表格"按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OutputToWordButton_Click(object sender, RoutedEventArgs e)
        {
            // 实例化BearingAndModulusToWord窗口类,启动窗口
            BearingAndModulusToWord output = new BearingAndModulusToWord(CurrentStandard);

            output.ShowDialog();

            // 点击"确认并输出"按钮后,启动输出程序
            if (output.DialogResult == true)
            {
                // 计算统计结果
                CalcuOutput(output.dtLayer, RstStatisticList, CptStatisticList, NTestStatisticList);

                // 选择输出目录
                string folderPath;
                System.Windows.Forms.FolderBrowserDialog programPathBrowser = new System.Windows.Forms.FolderBrowserDialog();
                if (programPathBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    folderPath = programPathBrowser.SelectedPath;
                }
                else
                {
                    return;
                }
                string path = folderPath + @"\" + Program.currentProject + @"-承载力和压缩模量综合统计表.doc";

                // 启动输出窗体
                ShowProgressBar(path);
            }
        }
コード例 #2
0
        /// <summary>
        /// 点击"确定"按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CommitButton_Click(object sender, RoutedEventArgs e)
        {
            // 读取选中的输出项
            CheckedTable.Clear();
            foreach (CheckBox item in this.SelectTableListBox.Items)
            {
                if (item.IsChecked == true)
                {
                    CheckedTable.Add(item.Content.ToString());
                }
            }

            // 没有选中时退出
            if (CheckedTable.Count == 0)
            {
                MessageBox.Show("亲,您没有选中任何项哦!");
                return;
            }

            // 同时选中"承载力和压缩模量综合取值"和"抗剪强度综合取值"时
            if (CheckedTable.Contains("承载力和压缩模量综合取值") && CheckedTable.Contains("抗剪强度综合取值"))
            {
                // 实例化土质类型对话框
                BearingAndModulusToWord bamType = new BearingAndModulusToWord(CurrentStandard);
                bamType.Title = "确认 承载力和压缩模量计算 的土质类型选项";

                // "确定"按钮替换为"下一步"
                bamType.CommitButton.Content = "下一步";
                bamType.ShowDialog();
                if (bamType.DialogResult == true)
                {
                    // 初始化DataTable
                    dtBam.Clear();
                    dtBam = bamType.dtLayer;

                    // 实例化计算中窗体,计算承载力和压缩模量统计数据
                    ShowCalculatingProgress(OutputProgress.OutputType.BearingAndModulus);

                    // 实例化土质类型对话框
                    ShearingStrengthToWord ssType = new ShearingStrengthToWord(CurrentStandard);
                    ssType.Title = "确认 抗剪强度计算 的土质类型选项";
                    ssType.ShowDialog();

                    // 计算抗剪强度统计数据
                    if (ssType.DialogResult == true)
                    {
                        // 初始化DataTable
                        dtSs.Clear();
                        dtSs = ssType.dtLayer;

                        // 实例化计算中窗体,计算抗剪强度统计数据
                        ShowCalculatingProgress(OutputProgress.OutputType.ShearingStrength);
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            // 只选中"抗剪强度综合取值"时
            else if (!CheckedTable.Contains("承载力和压缩模量综合取值") && CheckedTable.Contains("抗剪强度综合取值"))
            {
                ShearingStrengthToWord ssType = new ShearingStrengthToWord(CurrentStandard);
                ssType.Title = "确认 抗剪强度计算 的土质类型选项";
                ssType.ShowDialog();
                if (ssType.DialogResult == true)
                {
                    // 初始化DataTable
                    dtSs.Clear();
                    dtSs = ssType.dtLayer;

                    // 实例化计算中窗体,计算抗剪强度统计数据
                    ShowCalculatingProgress(OutputProgress.OutputType.ShearingStrength);
                }
                else
                {
                    return;
                }
            }
            // 只选中"承载力和压缩模量综合取值"时
            else if (CheckedTable.Contains("承载力和压缩模量综合取值") && !CheckedTable.Contains("抗剪强度综合取值"))
            {
                BearingAndModulusToWord bamType = new BearingAndModulusToWord(CurrentStandard);
                bamType.Title = "确认 承载力和压缩模量计算 的土质类型选项";
                bamType.ShowDialog();
                if (bamType.DialogResult == true)
                {
                    // 初始化DataTable
                    dtBam.Clear();
                    dtBam = bamType.dtLayer;

                    // 实例化计算中窗体,计算抗剪强度统计数据
                    ShowCalculatingProgress(OutputProgress.OutputType.BearingAndModulus);
                }
                else
                {
                    return;
                }
            }

            // 选择输出目录
            string folderPath;

            System.Windows.Forms.FolderBrowserDialog programPathBrowser = new System.Windows.Forms.FolderBrowserDialog();
            if (programPathBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                folderPath = programPathBrowser.SelectedPath;
            }
            else
            {
                return;
            }
            string path = folderPath + @"\" + Program.currentProject + @"-参数统计表格.doc";

            // 启动输出窗体
            ShowProgressBar(path);
        }