private void structureSetBtn_Click(object sender, EventArgs e) { RiverSimulationProfile p = RiverSimulationProfile.profile; if (!ConvertStructureSetNumber()) { return; } if (p.tBarNumber + p.bridgePierNumber + p.groundsillWorkNumber + p.sedimentationWeirNumber == 0) { MessageBox.Show("請設置結構物數量!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } bool alreadyShow = false; RiverSimulationProfile.StructureChangeType tp = p.CheckStructurerChanged(p.tBarSet, ref p.tBarSets, p.tBarNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } tp = p.CheckStructurerChanged(p.bridgePierSet, ref p.bridgePierSets, p.bridgePierNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } tp = p.CheckStructurerChanged(p.groundsillWorkSet, ref p.groundsillWorkSets, p.groundsillWorkNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } tp = p.CheckStructurerChanged(p.sedimentationWeirSet, ref p.sedimentationWeirSets, p.sedimentationWeirNumber, true); if (!alreadyShow && tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch) { MessageBox.Show("結構物數量或設置已變更,請重新設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; } p.ResizeStructureSets(p.tBarNumber, p.bridgePierNumber, p.groundsillWorkNumber, p.sedimentationWeirNumber); StructureSetForm form = new StructureSetForm(); form.SetFormMode(structureSetGrp.Text, (p.tBarSet) ? p.tBarNumber : 0, tBarSetChk.Text, (p.bridgePierSet) ? p.bridgePierNumber : 0, bridgePierSetChk.Text, (p.groundsillWorkSet) ? p.groundsillWorkNumber : 0, groundsillWorkSetChk.Text, (p.sedimentationWeirSet) ? p.sedimentationWeirNumber : 0, sedimentationWeirSetChk.Text); DialogResult r = form.ShowDialog(); NoticeStructureChange(); structFirstSetting = true; }
private bool DoConvert() { if (p.GetFlowType() == RiverSimulationProfile.FlowType.None) { MessageBox.Show("請選取定/變量流設定!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } if (!ConvertValueParam()) { return(false); } if (!ConvertPhysicalParam()) { return(false); } if (!ConvertStructureSetNumber()) { return(false); } if (p.structureSetFunction) { bool alreadyShow = false; RiverSimulationProfile.StructureChangeType tp = p.CheckStructurerChanged(p.tBarSet, ref p.tBarSets, p.tBarNumber, true); if (!alreadyShow && (tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch || tp == RiverSimulationProfile.StructureChangeType.NotAllDataSet || tp == RiverSimulationProfile.StructureChangeType.HasSelectButNoData)) { MessageBox.Show("結構物設置已變更或未設定,請設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; return(false); } tp = p.CheckStructurerChanged(p.bridgePierSet, ref p.bridgePierSets, p.bridgePierNumber, true); if (!alreadyShow && (tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch || tp == RiverSimulationProfile.StructureChangeType.NotAllDataSet || tp == RiverSimulationProfile.StructureChangeType.HasSelectButNoData)) { MessageBox.Show("結構物設置已變更或未設定,請設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; return(false); } tp = p.CheckStructurerChanged(p.groundsillWorkSet, ref p.groundsillWorkSets, p.groundsillWorkNumber, true); if (!alreadyShow && (tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch || tp == RiverSimulationProfile.StructureChangeType.NotAllDataSet || tp == RiverSimulationProfile.StructureChangeType.HasSelectButNoData)) { MessageBox.Show("結構物設置已變更或未設定,請設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; return(false); } tp = p.CheckStructurerChanged(p.sedimentationWeirSet, ref p.sedimentationWeirSets, p.sedimentationWeirNumber, true); if (!alreadyShow && (tp == RiverSimulationProfile.StructureChangeType.SelectionAndDataNoMatch || tp == RiverSimulationProfile.StructureChangeType.NotAllDataSet || tp == RiverSimulationProfile.StructureChangeType.HasSelectButNoData)) { MessageBox.Show("結構物設置已變更或未設定,請設定結構物!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); alreadyShow = true; return(false); } } return(true); }