Пример #1
0
        private void UpdateStatus()
        {
            //20141124 取消此規格
            //constantFlowRdo.Enabled = !p.IsMovableBedMode();
            //if (p.IsMovableBedMode())
            //{   //使用者選動床模組,則此處一定為變量流
            //    p.flowType = RiverSimulationProfile.FlowType.VariableFlow;
            //}

            //模擬功能如果為定量流,則總模擬時間與時間間距相同,使用者不輸入。
            //20150224修改規格為僅定量流且水理模式時不輸入
            if (p.IsConstantFlowType() && p.IsWaterModelingMode())
            {
                totalSimulationTimeTxt.Enabled = false;
            }
            else
            {
                totalSimulationTimeTxt.Enabled = true;
            }

            structureSetGrp.Enabled = p.structureSetFunction;

            //timeSpan2dTxt.Enabled = !p.IsConstantFlowType();
            outputFrequencyTxt.Enabled = !p.IsConstantFlowType(); //模擬功能如果為定量流,則輸出頻率為1,使用者不輸入。

            manningNBtn.Enabled              = (p.roughnessType == RiverSimulationProfile.RoughnessType.ManningN);
            chezyBtn.Enabled                 = (p.roughnessType == RiverSimulationProfile.RoughnessType.Chezy);
            roughnessHeightKsBtn.Enabled     = p.Is3DMode();
            roughnessHeightKsHelpBtn.Enabled = p.Is3DMode();

            tvInMainstreamDirectionTxt.Enabled = (p.turbulenceViscosityType == RiverSimulationProfile.TurbulenceViscosityType.UserDefine);
            tvInSideDirectionTxt.Enabled       = (p.turbulenceViscosityType == RiverSimulationProfile.TurbulenceViscosityType.UserDefine) && (p.Is3DMode()); //20150731介面測試問題 4.
            zeroEquationTypeCombo.Enabled      = (p.turbulenceViscosityType == RiverSimulationProfile.TurbulenceViscosityType.ZeroEquation);
            twinEquationRdo.Enabled            = p.Is3DMode();
            zeroEquationTypeCombo.Enabled      = p.Is3DMode();

            if (p.Is2DMode())
            {   //二維只有 1 種選項:constant,其他則灰掉
                zeroEquationTypeCombo.SelectedIndex = 0;
            }

            secFlowEffectGrp.Enabled = p.Is2DMode() && p.secondFlowEffectFunction;    //二維 only。

            tBarNumberTxt.Enabled              = p.tBarSet;
            bridgePierNumberTxt.Enabled        = p.bridgePierSet;
            groundsillWorkNumberTxt.Enabled    = p.groundsillWorkSet;
            sedimentationWeirNumberTxt.Enabled = p.sedimentationWeirSet;

            UpdateActiveFunctions();
        }
Пример #2
0
        private void UpdateStatus()
        {
            secondFlowEffectFunctionChk.Enabled = p.Is2DMode();
            movableBedPanel.Enabled             = p.IsMovableBedMode();
            if (p.IsMovableBedMode())
            {   //如果是動床模式,則動床高含砂效應與水理高含砂效應連動
                waterHighSandContentEffectFunctionChk.Checked = movableBedHighSandContentEffectFunctionChk.Checked;
            }
            waterPanel.Enabled = p.IsWaterModelingMode() || p.IsMovableBedMode();
            waterHighSandContentEffectFunctionChk.Enabled = p.IsWaterModelingMode();

            UpdateActiveFunctions();
        }
Пример #3
0
        void BwDoWork(object sender, DoWorkEventArgs e)
        {
            if (simDebugForm.runMode == SimDebugForm.RunMode.OutputFile)
            {
                simProcess.StartInfo.FileName               = Environment.CurrentDirectory + "\\DumpOutput.exe";
                simProcess.StartInfo.WorkingDirectory       = Environment.CurrentDirectory;
                simProcess.StartInfo.Arguments              = simDebugForm.inputFile + " " + simDebugForm.dataFile;
                simProcess.StartInfo.UseShellExecute        = false;
                simProcess.StartInfo.RedirectStandardOutput = true;
                simProcess.StartInfo.CreateNoWindow         = true;
                simProcess.Start();
            }
            else if (simDebugForm.runMode == SimDebugForm.RunMode.InputData)
            {
                simProcess.StartInfo.FileName               = Environment.CurrentDirectory + "\\resed.exe";
                simProcess.StartInfo.WorkingDirectory       = Environment.CurrentDirectory;
                simProcess.StartInfo.Arguments              = simDebugForm.inputFile + " 123 3D " + simDebugForm.dataFile + " out";
                simProcess.StartInfo.UseShellExecute        = false;
                simProcess.StartInfo.RedirectStandardOutput = true;
                simProcess.StartInfo.CreateNoWindow         = true;
                simProcess.Start();
            }
            else if (simDebugForm.runMode == SimDebugForm.RunMode.ExternalFile)
            {
                simProcess.StartInfo.FileName               = Program.currentPath + "\\" + simDebugForm.inputFile;
                simProcess.StartInfo.WorkingDirectory       = Program.currentPath;
                simProcess.StartInfo.Arguments              = simDebugForm.dataFile;
                simProcess.StartInfo.UseShellExecute        = false;
                simProcess.StartInfo.RedirectStandardOutput = true;
                simProcess.StartInfo.CreateNoWindow         = true;
                simProcess.Start();
            }
            else if (simDebugForm.runMode == SimDebugForm.RunMode.UseProfile)
            {
                string resedExe = Program.GetProjectFileWorkingPath() + Program.resedName;
                if (!File.Exists(resedExe))
                {   //如果沒有主程式則複製一個。
                    File.Copy(Environment.CurrentDirectory + @"\resed.exe", resedExe);
                }

                simProcess.StartInfo.FileName         = resedExe;
                simProcess.StartInfo.WorkingDirectory = Program.GetProjectFileWorkingPath();

                //二維水理:resed.exe resed.i 123
                //三維水理:resed.exe resed.i 123 3D 3Dinput.dat out
                //二維動床:resed.exe resed.i 123 SED sed.dat
                //三維動床:resed.exe resed.i 123 3DSED 3Dinput.dat out sed.dat
                if (p.Is2DMode() && p.IsWaterModelingMode())
                {
                    simProcess.StartInfo.Arguments = simDebugForm.inputFile + " 123";
                }
                else if (p.Is3DMode() && p.IsWaterModelingMode())
                {
                    simProcess.StartInfo.Arguments = simDebugForm.inputFile + " 123 3D 3Dinput.dat out";
                }
                else if (p.Is2DMode() && p.IsMovableBedMode())
                {
                    simProcess.StartInfo.Arguments = simDebugForm.inputFile + " 123 SED sed.dat";
                }
                else if (p.Is3DMode() && p.IsMovableBedMode())
                {
                    simProcess.StartInfo.Arguments = simDebugForm.inputFile + " 123 3DSED 3Dinput.dat out sed.dat";
                }

                simProcess.StartInfo.UseShellExecute        = false;
                simProcess.StartInfo.RedirectStandardOutput = true;
                simProcess.StartInfo.CreateNoWindow         = true;

                using (StreamWriter outfile = new StreamWriter(Program.GetProjectFileWorkingPath() + @"\run.bat"))
                {
                    outfile.Write(resedExe + " " + simProcess.StartInfo.Arguments + "\r\n");
                    outfile.Close();
                }
                simProcess.Start();
            }
            //else
            //{
            //    string strInputFile = "IamReadyNow.i";
            //    RiverSimulationProfile.profile.GenerateInputFile(Environment.CurrentDirectory + "\\" + strInputFile);
            //    simProcess.StartInfo.FileName = Environment.CurrentDirectory + "\\resed.exe";
            //    simProcess.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
            //    simProcess.StartInfo.Arguments = strInputFile + " 123 3D " + simDebugForm.dataFile + " out";
            //    simProcess.StartInfo.UseShellExecute = false;
            //    simProcess.StartInfo.RedirectStandardOutput = true;
            //    simProcess.StartInfo.CreateNoWindow = true;
            //    simProcess.Start();
            //}
            inRunning = false;
            StreamReader reader = simProcess.StandardOutput; //截取輸出流
            string       line   = reader.ReadLine();         //每次讀取一行

            while (!reader.EndOfStream)
            {
                ParsingResult(line);
                line = reader.ReadLine();
            }
            ParsingResult(line);
            simProcess.WaitForExit();
        }