tangxu
2025-01-13 4f7cb65b079d88d5a829688b24d26d5145c5df47
WinFrmUI/DPumpHydr.WinFrmUI.Volute/³öË®Éè¼Æ/ctrlSetOutflowParas.cs
@@ -5,11 +5,9 @@
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text;
using System.Windows.Forms;
using DPumpHydr.WinFrmUI.Volute.ViewModel;
using static System.Runtime.InteropServices.JavaScript.JSType;
using DPumpHydr.WinFrmUI.Volute.ViewModel;
namespace DPumpHydr.WinFrmUI.Volute
{
@@ -29,7 +27,7 @@
                }
            }; 
        }
        eOutflowStyle _stype = eOutflowStyle.未知;
        public Func<ViewModel.OtuflowParas, ViewModel.OtuflowParasCalcReponse> OnRefreshShape3D = null;
        public Func<ViewModel.OtuflowParas, ViewModel.OtuflowParasCalcReponse> OnRefreshShape2D = null;
        ViewModel.OtuflowParas _outflowParas = null;
@@ -37,6 +35,15 @@
        //控件
        SetOutflowParasCtrl1 _sidelineExitControl = null;
        SetOutflowParasCtrl2 _sideCurveExitControl = null;
        eOutflowStyle _stype = eOutflowStyle.未知;
        public eOutflowStyle CurrentOutflowStyle
        {
            get
            {
                return _stype;
            }
        }
        public void SetOutflowStyle(eOutflowStyle style)
        {
            if (_stype == style)
@@ -52,7 +59,7 @@
                    if (_sidelineExitControl == null)
                    {
                        _sidelineExitControl = new SetOutflowParasCtrl1();
                        _sidelineExitControl = new SetOutflowParasCtrl1() { Name = "SetOutflowParasCtrl1" };
                        _sidelineExitControl.OnRefreshShape += (para) =>
                        {
                            if (OnRefreshShape2D != null)
@@ -69,7 +76,7 @@
                    metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Side-exit-curve.png", 878, 238);
                    if (_sidelineExitControl == null)
                    {
                        _sidelineExitControl = new SetOutflowParasCtrl1();
                        _sidelineExitControl = new SetOutflowParasCtrl1() { Name= "SetOutflowParasCtrl1" };
                        _sidelineExitControl.OnRefreshShape += (para) =>
                        {
                            if (OnRefreshShape2D != null)
@@ -87,15 +94,63 @@
                    metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238);
                    if (_sideCurveExitControl == null)
                        _sideCurveExitControl = new SetOutflowParasCtrl2();
                    _sideCurveExitControl.Dock = DockStyle.Top;
                    {
                        _sideCurveExitControl = new SetOutflowParasCtrl2() { Name = "SetOutflowParasCtrl2" };
                        _sideCurveExitControl.OnRefreshShape += (para) =>
                        {
                            if (OnRefreshShape2D != null)
                                return OnRefreshShape2D(para);
                            else
                                return null;
                        };
                        _sideCurveExitControl.Dock = DockStyle.Top;
                    }
                    tabPage1.Controls.Add(_sideCurveExitControl);
                    return;
                default:
                    throw new ArgumentException("Invalid control type");
            }
        }
        public void SetBindingData(
            eOutflowStyle style,
            ViewModel.HdrBaseInfo hdrBaseInfo,
            ViewModel.GeomBaseInfo geomBaseInfo,
            ViewModel.SectionBundleInfo sectionBundleInfo)
        {
            if(_outflowParas == null)
            {
                InitialParas(style, hdrBaseInfo, geomBaseInfo, sectionBundleInfo);
            }
            else
            {
                if (_stype == style)
                    return;
                if(_stype == eOutflowStyle.侧面出口_直线连接)
                {
                    if(style != eOutflowStyle.侧面出口_直线连接)
                    {
                        InitialParas(style, hdrBaseInfo, geomBaseInfo, sectionBundleInfo);
                    }
                    else
                    {
                        SetOutflowStyle(style);
                    }
                }
                else
                {
                    if (style == eOutflowStyle.侧面出口_直线连接)
                    {
                        InitialParas(style, hdrBaseInfo, geomBaseInfo, sectionBundleInfo);
                    }
                    else
                    {
                        SetOutflowStyle(style);
                    }
                }
            }
        }
        public void InitialParas(
            eOutflowStyle style,
            ViewModel.HdrBaseInfo hdrBaseInfo,