yangyin
2024-12-25 df88a15b84a7eee09c870dab8c0f5facd6c18c6e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DPumpHydr.WinFrmUI.Volute.ViewModel;
 
namespace DPumpHydr.WinFrmUI.Volute
{
    public partial class ctrlSetOutflowParas : ParasInfoBaseCtrl
    {
        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 };
        sidelineExitControl _sidelineExitControl = null;
        sideCurveExitControl _sideCurveExitControl = null;
        public void SetBindingData(eOutflowStyle style)
        {
            if(_stype == style)
                return;
 
                _stype = style;
              
               var control =  InitialParasControl( );
            if (control is sidelineExitControl)
            {
                _sidelineExitControl = (sidelineExitControl)control;
 
                _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;
            switch (_stype)
            {
                case eOutflowStyle.中心出口_垂直法兰面流出:
                    newControl = new sidelineExitControl();
                    metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238);
                    break;
                case eOutflowStyle.侧面出口_曲线连接:
                    newControl = new sidelineExitControl();
                    metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Side-exit-curve.png", 878, 238);
                    break;
                case eOutflowStyle.侧面出口_直线连接:
                    newControl = new sideCurveExitControl();
                    metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238);
                    break;
                default:
                    throw new ArgumentException("Invalid control type");
            }
 
            panel.Controls.Clear();
            panel.Controls.Add(newControl);
            newControl.Dock = DockStyle.Top;
            return newControl;
        }
 
 
        public Func<bool>  OnRefreshShape = null;
 
        private void BuildAllTips()
        {
            metroToolTip第六步提示.SetToolTip(this.metroTile扩散管形状, "断面图");
        }
 
        public void ShowPage()
        {
            OnRefreshShape();
        }
 
 
 
        private void mBtn更新模型_Click(object sender, EventArgs e)
        {
            OnRefreshShape();
        }
    }
}