private void UpdateActiveFunctions() { //數值參數 輸出控制3D 面板 outputCtrl3DGrp.Enabled = p.Is3DMode(); //擴散公式是3D Only, 20150121 diffusionFormulaUseChk.Enabled = p.Is3DMode(); diffusionFormulaCombo.Enabled = p.Is3DMode(); bedrockGrp.Enabled = RiverSimulationProfile.profile.bedrockFunction; quayStableAnalysisGrp.Enabled = RiverSimulationProfile.profile.quayStableAnalysisFunction; highSandContentFlowGrp.Enabled = p.waterHighSandContentEffectFunction; if (p.waterHighSandContentEffectFunction) { this.normalSandMethodText.Visible = false; this.normalSandMethodPanel.Visible = false; this.highSandMethodText.Visible = true; this.highSandMethodPanel.Visible = true; this.highSandMethodText.Top = this.normalSandMethodText.Location.Y; this.highSandMethodPanel.Top = this.normalSandMethodPanel.Location.Y; this.highSandMethodPanel.Enabled = true; } else { this.normalSandMethodText.Visible = true; this.normalSandMethodPanel.Visible = true; this.highSandMethodText.Visible = false; this.highSandMethodPanel.Visible = false; } if (Program.programVersion.LiteVersion) { fullPanel.Visible = false; } }
private void InitPreviewCombo() { previewCombo.Items.Add("格網預覽圖"); if (p.Is3DMode()) { //3D Mode才有垂向格網分布圖 previewCombo.Items.Add("垂向格網分布圖"); } else { previewCombo.Enabled = false; } }
private void UpdateActiveFunctions() { if (!p.IsMovableBedMode()) { //水理模式不支援動床模組設定 movableTypeGroup.Enabled = false; } if (!p.IsVariableFlowType()) { boundaryTimeNumberTxt.Enabled = false; //定量流不輸入 boundaryTimeBtn.Enabled = false; //suspendedLoadDepthAvgConcentrationBtn.Enabled = false; //定量流不支援 20150121, 20150303 改為要輸入 //subBoundaryConditionNumberTxt.Enabled = false; //定量流不輸入 //superMainFlowQuantityBtn.Enabled = false; //superWaterLevelBtn.Enabled = false; //subMainFlowQuantityBtn.Enabled = false; //downSuperWaterLevelBtn.Enabled = false; } if (!p.Is3DMode()) { verticalVelocityDistributionChk.Enabled = false; //垂向流速分布(3D) verticalVelocityDistributionBtn.Enabled = false; //垂向流速分布(3D) waterSurfacePanel.Enabled = false; //水面,三維only。(”即時互動處”不放圖示) bottomBedPanel.Enabled = false; //底床,三維only。(”即時互動處”不放圖示) //boundaryUpVerticalDistributionBtn.Enabled = false; boundaryUpVerticalDistributionPanel.Enabled = false; //boundaryDownVerticalDistributionBtn.Enabled = false; boundaryDownVerticalDistributionPanel.Enabled = false; nearBedBoundaryPanel.Enabled = false; } if (!p.sideInOutFlowFunction) //模擬功能之特殊功能中如有勾選側出/入流,則4.1.3.2 才會出現於介面中。 { sideInFlowChk.Enabled = p.sideInOutFlowFunction; sideInFlowBtn.Enabled = p.sideInOutFlowFunction; sideOutFlowChk.Enabled = p.sideInOutFlowFunction; sideOutFlowBtn.Enabled = p.sideInOutFlowFunction; } if (Program.programVersion.DemoVersion) { //bottomBedLoadFluxInputRdo.Enabled = false; //bottomBedLoadFluxInputBtn.Enabled = false; //upBoundaryElevationInputRdo.Enabled = false; //upBoundaryElevationInputBtn.Enabled = false; movableBedDownInputRdo.Enabled = false; movableBedDownInputBtn.Enabled = false; } }
private bool DoConvert() { if (!p.depthAverageFlowSpeedU.HasInputed()) { MessageBox.Show("請輸入水深平均流速-U!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (!p.depthAverageFlowSpeedV.HasInputed()) { MessageBox.Show("請輸入水深平均流速-V!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (!p.waterLevel.HasInputed()) { MessageBox.Show("請輸入水位!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (p.Is3DMode() && p.verticalVelocitySlice == RiverSimulationProfile.VerticalVelocitySliceType.None) { MessageBox.Show("請選取垂向流速剖面!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (p.IsMovableBedMode()) { if (!p.depthAverageConcentration.HasInputed()) { MessageBox.Show("請輸入水深平均濃度!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (p.Is3DMode() && p.verticalConcentrationSlice == RiverSimulationProfile.VerticalConcentrationSliceType.None) { MessageBox.Show("請選取垂向濃度剖面!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } return(true); }
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(); }
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(); }