| | |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using DPumpHydr.WinFrmUI.Volute.ViewModel; |
| | | using static System.Runtime.InteropServices.JavaScript.JSType; |
| | | |
| | | namespace DPumpHydr.WinFrmUI.Volute |
| | | { |
| | |
| | | public ctrlSetOutflowParas() |
| | | { |
| | | InitializeComponent(); |
| | | |
| | | |
| | | BuildAllTips(); |
| | | } |
| | | eOutflowStyle _stype = eOutflowStyle.æªç¥; |
| | | //ViewModel.OtuflowParas _otuflowParas = null; |
| | | ViewModel.OtuflowParas _otuflowParas = new OtuflowParas() { Offset = 10, High = 420, Dia = 80, TopValue_left = 80, BtmValue_left = 80, BtmValue_reight = 80, TopValue_reight = 80, H1 = 10, H2 = 10, Septalradius = 10 }; |
| | | public Func<OtuflowParas, bool> OnRefreshShape = null; |
| | | ViewModel.OtuflowParas _outflowParas = null; |
| | | |
| | | //æ§ä»¶ |
| | | sidelineExitControl _sidelineExitControl = null; |
| | | sideCurveExitControl _sideCurveExitControl = null; |
| | | public void SetBindingData(eOutflowStyle style) |
| | | public void SetOutflowStyle(eOutflowStyle style) |
| | | { |
| | | if(_stype == style) |
| | | if (_stype == style) |
| | | return; |
| | | |
| | | _stype = style; |
| | | |
| | | var control = InitialParasControl( ); |
| | | if (control is sidelineExitControl) |
| | | { |
| | | _sidelineExitControl = (sidelineExitControl)control; |
| | | _stype = style; |
| | | |
| | | _sidelineExitControl.SetBindingData(_otuflowParas); |
| | | if (_stype == eOutflowStyle.ä¸å¿åºå£_åç´æ³å
°é¢æµåº) |
| | | { |
| | | _sidelineExitControl.SetA_state(false); |
| | | } |
| | | else |
| | | { |
| | | _sidelineExitControl.SetA_state(true); |
| | | } |
| | | } |
| | | if (control is sideCurveExitControl) |
| | | { |
| | | _sideCurveExitControl = (sideCurveExitControl)control; |
| | | _sideCurveExitControl.SetBindingData(_otuflowParas); |
| | | } |
| | | |
| | | } |
| | | public ViewModel.OtuflowParas GetBindingData(out string error) |
| | | { |
| | | error = ""; |
| | | if(_stype == eOutflowStyle.ä¾§é¢åºå£_ç´çº¿è¿æ¥) |
| | | { |
| | | _otuflowParas = _sideCurveExitControl.GetBindingData(out error); |
| | | if(_otuflowParas == null) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _otuflowParas = _sidelineExitControl.GetBindingData(out error); |
| | | if (_otuflowParas == null) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | return _otuflowParas; |
| | | } |
| | | private Control InitialParasControl( ) |
| | | { |
| | | |
| | | Control newControl = null; |
| | | panel.Controls.Clear(); |
| | | switch (_stype) |
| | | { |
| | | case eOutflowStyle.ä¸å¿åºå£_åç´æ³å
°é¢æµåº: |
| | | newControl = new sidelineExitControl(); |
| | | metroTileæ©æ£ç®¡å½¢ç¶.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238); |
| | | break; |
| | | |
| | | if (_sidelineExitControl == null) |
| | | _sidelineExitControl = new sidelineExitControl(); |
| | | _sidelineExitControl.SetA_state(false); |
| | | _sidelineExitControl.Dock = DockStyle.Top; |
| | | panel.Controls.Add(_sidelineExitControl); |
| | | return; |
| | | case eOutflowStyle.ä¾§é¢åºå£_æ²çº¿è¿æ¥: |
| | | newControl = new sidelineExitControl(); |
| | | metroTileæ©æ£ç®¡å½¢ç¶.BackgroundImage = GlobalResource.BuildImage("Side-exit-curve.png", 878, 238); |
| | | break; |
| | | if (_sidelineExitControl == null) |
| | | _sidelineExitControl = new sidelineExitControl(); |
| | | _sidelineExitControl.Dock = DockStyle.Top; |
| | | _sidelineExitControl.SetA_state(true); |
| | | panel.Controls.Add(_sidelineExitControl); |
| | | return; |
| | | case eOutflowStyle.ä¾§é¢åºå£_ç´çº¿è¿æ¥: |
| | | newControl = new sideCurveExitControl(); |
| | | metroTileæ©æ£ç®¡å½¢ç¶.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238); |
| | | break; |
| | | |
| | | if (_sideCurveExitControl == null) |
| | | _sideCurveExitControl = new sideCurveExitControl(); |
| | | _sideCurveExitControl.Dock = DockStyle.Top; |
| | | panel.Controls.Add(_sideCurveExitControl); |
| | | return; |
| | | default: |
| | | throw new ArgumentException("Invalid control type"); |
| | | } |
| | | } |
| | | |
| | | panel.Controls.Clear(); |
| | | panel.Controls.Add(newControl); |
| | | newControl.Dock = DockStyle.Top; |
| | | return newControl; |
| | | public void InitialParas( |
| | | eOutflowStyle style, |
| | | ViewModel.HdrBaseInfo hdrBaseInfo , |
| | | ViewModel.GeomBaseInfo geomBaseInfo , |
| | | ViewModel.SectionBundleInfo sectionBundleInfo ) |
| | | { |
| | | SetOutflowStyle(style); |
| | | //åºå£ç´å¾æ åå |
| | | double outer_dia = 4.5 * Math.Pow(hdrBaseInfo.Q / 3600 / hdrBaseInfo.n, 1 / 3.0) * 1000; |
| | | double height = 10 * (int)((geomBaseInfo.D3 * 1.3 + sectionBundleInfo.H[8] + 15) / 10); |
| | | |
| | | double a = 0; |
| | | if (style == eOutflowStyle.ä¸å¿åºå£_åç´æ³å
°é¢æµåº) |
| | | { |
| | | a = 0; |
| | | } |
| | | else |
| | | { |
| | | a = (int)((geomBaseInfo.D3 + sectionBundleInfo.H[8]) / 2); |
| | | } |
| | | |
| | | _outflowParas = new OtuflowParas(); |
| | | _outflowParas.Offset = a; |
| | | _outflowParas.Heigh = height; |
| | | _outflowParas.H1 = 5; |
| | | _outflowParas.H2 = 5; |
| | | _outflowParas.Dia = GetStdDia(outer_dia); |
| | | _outflowParas.Septalradius = 10; |
| | | if (_stype == eOutflowStyle.ä¾§é¢åºå£_ç´çº¿è¿æ¥) |
| | | { |
| | | _sideCurveExitControl.SetBindingData(_outflowParas); |
| | | } |
| | | else |
| | | { |
| | | _sidelineExitControl.SetBindingData(_outflowParas); |
| | | } |
| | | } |
| | | |
| | | private static double GetStdDia(double mm) |
| | | { |
| | | var iFlangeCodeList = new int[] {10,15,20,25,32, |
| | | 40,50,65,80,100, |
| | | 125,150,200,250,300, |
| | | 350,400,450,500,600, |
| | | 700,800,900,1000,1200, |
| | | 1400,1600,1800,2000,5000,100000}; |
| | | |
| | | for (int i = 0; i < iFlangeCodeList.Count() - 1; i++) |
| | | { |
| | | if (mm < iFlangeCodeList[i]) |
| | | return iFlangeCodeList[i]; |
| | | } |
| | | |
| | | |
| | | return iFlangeCodeList.Last(); |
| | | } |
| | | // |
| | | public ViewModel.OtuflowParas GetBindingData(out string error) |
| | | { |
| | | error = ""; |
| | | if (_stype == eOutflowStyle.ä¾§é¢åºå£_ç´çº¿è¿æ¥) |
| | | { |
| | | _outflowParas = _sideCurveExitControl.GetBindingData(out error); |
| | | } |
| | | else |
| | | { |
| | | _outflowParas = _sidelineExitControl.GetBindingData(out error); |
| | | } |
| | | |
| | | return _outflowParas; |
| | | } |
| | | |
| | | |
| | | public Func<bool> OnRefreshShape = null; |
| | | |
| | | |
| | | |
| | | private void BuildAllTips() |
| | | { |
| | |
| | | |
| | | public void ShowPage() |
| | | { |
| | | OnRefreshShape(); |
| | | OnRefreshShape(_outflowParas); |
| | | } |
| | | |
| | | |
| | | |
| | | private void mBtnæ´æ°æ¨¡å_Click(object sender, EventArgs e) |
| | | { |
| | | OnRefreshShape(); |
| | | string error; |
| | | OnRefreshShape(GetBindingData(out error)); |
| | | } |
| | | } |
| | | } |