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();
|
}
|
}
|
}
|