using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Drawing;
|
using System;
|
using DPumpHydr.WinFrmUI.RLT.Controls;
|
using DPumpHydr.WinFrmUI.RLT.Docking.Crown;
|
using DPumpHydr.WinFrmUI.Base;
|
using System.Linq;
|
using System.Windows.Forms;
|
|
namespace DPumpHydr.WinFrmUI.Volute
|
{
|
public partial class StepTreeDockPanel : CrownToolWindow
|
{
|
//基础信息
|
private readonly string Group_Name_Base_Info = "BaseInfo";
|
private readonly int Group_ID_Base_Info = -1;//组ID
|
public readonly long Step_ID_Introduce = 11;
|
public readonly long Step_ID_Hdr_Base_Info = 12;
|
public readonly long Step_ID_Geom_Base_Info = 13;
|
|
|
//断面设计(1-8)
|
private readonly string Group_Name_Section18 = "Section18";
|
private readonly int Group_ID_Section18 = -2;
|
public readonly long Step_ID_Section18_Full = 20;//详细信息
|
public readonly long Step_ID_Section18_Grp = 21;// 1-8组
|
|
|
//出水设计
|
private readonly string Group_Name_Outflow = "Outflow";
|
private readonly int Group_ID_Outflow = -3;
|
public readonly long Step_ID_Outflow_Style = 32;
|
public readonly long Step_ID_Outflow_Type = 31;
|
|
|
//
|
private List<DPumpHydr.WinFrmUI.Base.StepTreeNodePara> _allStepNodes = null;
|
/// <summary>
|
/// 步骤节点选择改变前后事件
|
/// </summary>
|
public event Func<StepTreeNodePara, StepTreeNodePara, bool> BeforeSelectedNodeChangedEvent;
|
public event Func<StepTreeNodePara, StepTreeNodePara, bool> AfterSelectedNodeChangedEvent;
|
|
|
public long PrevStepID
|
{
|
get
|
{
|
var prev_step = (from x in _allStepNodes
|
where x.ID<_currentStepID && x.AllowSelect
|
orderby x.ID
|
select x).LastOrDefault();
|
if (prev_step == null)
|
return 0;
|
else
|
return prev_step.ID;
|
}
|
}
|
public long NextStepID
|
{
|
get
|
{
|
var next_step = (from x in _allStepNodes
|
where x.ID > _currentStepID && x.AllowSelect
|
orderby x.ID
|
select x).FirstOrDefault();
|
if (next_step == null)
|
return 0;
|
else
|
return next_step.ID;
|
}
|
}
|
private long _currentStepID = 0;
|
public long CurrentStepID {
|
get { return _currentStepID; }
|
}
|
|
public StepTreeDockPanel()
|
{
|
InitializeComponent();
|
|
this.SerializationKey = "StepTreeDockPanel";
|
//BackColor = System.Drawing.Color.Transparent;
|
this.stepTreeCtrl1.BeforeSelectedNodeChangedEvent += (arg1, arg2) =>
|
{
|
if (arg1 == null)
|
return false ;
|
if (BeforeSelectedNodeChangedEvent != null)
|
{
|
return BeforeSelectedNodeChangedEvent(arg1, arg2);
|
}
|
|
return true;
|
};
|
|
this.stepTreeCtrl1.AfterSelectedNodeChangedEvent += (arg1, arg2) =>
|
{
|
if (arg1 == null || arg2 == null)
|
return true ;
|
if (AfterSelectedNodeChangedEvent != null)
|
{
|
if( AfterSelectedNodeChangedEvent(arg1, arg2))
|
{
|
this.stepTreeCtrl1.SetFocusedNode(arg2.ID);
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
this.stepTreeCtrl1.SetFocusedNode(arg2.ID);
|
return true;
|
};
|
}
|
|
|
/// <summary>
|
///
|
/// </summary>
|
public void InitialStepNodes()
|
{
|
_allStepNodes = new List<DPumpHydr.WinFrmUI.Base.StepTreeNodePara>();
|
|
#region 基础信息/几何参数
|
var stepGroup_BaseInfo = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara();
|
stepGroup_BaseInfo.AllowSelect = false;
|
stepGroup_BaseInfo.Caption = "基础信息";
|
stepGroup_BaseInfo.Name = Group_Name_Base_Info;
|
stepGroup_BaseInfo.ID = Group_ID_Base_Info;
|
stepGroup_BaseInfo.ParentID = 0;
|
_allStepNodes.Add(stepGroup_BaseInfo);
|
|
var step欢迎使用 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara();
|
step欢迎使用.AllowSelect = false ;
|
step欢迎使用.Caption = "欢迎使用";
|
step欢迎使用.Name = "StepHelp";
|
step欢迎使用.ID = Step_ID_Introduce;
|
step欢迎使用.ParentID = Group_ID_Base_Info;
|
step欢迎使用.SpecImage = DPumpHydr.WinFrmUI.Volute.Properties.Resources.Smile16;
|
_allStepNodes.Add(step欢迎使用);
|
|
|
var step基础信息 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
step基础信息.AllowSelect = true;
|
step基础信息.Caption = "第一步:基础信息";
|
step基础信息.Name = "StepHydParas";
|
step基础信息.ID = Step_ID_Hdr_Base_Info;
|
step基础信息.ParentID = Group_ID_Base_Info;
|
_allStepNodes.Add(step基础信息);
|
|
var step几何参数 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
step几何参数.AllowSelect = true;
|
step几何参数.Caption = "第二步:几何参数";
|
step几何参数.Name = "StepGeomParas";
|
step几何参数.ID = Step_ID_Geom_Base_Info;
|
step几何参数.ParentID = Group_ID_Base_Info;
|
_allStepNodes.Add(step几何参数);
|
#endregion
|
|
|
#region 断面设计(1-8)
|
|
var stepGroup_CoverPlate = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
stepGroup_CoverPlate.AllowSelect = false;
|
stepGroup_CoverPlate.Caption = "断面设计";
|
stepGroup_CoverPlate.Name = Group_Name_Section18;
|
stepGroup_CoverPlate.ID = Group_ID_Section18;
|
stepGroup_CoverPlate.ParentID = 0;
|
_allStepNodes.Add(stepGroup_CoverPlate);
|
|
|
var step断面基本信息 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
step断面基本信息.AllowSelect = true ;
|
step断面基本信息.Caption = string.Format("{0}:{1}",
|
GetTranslateString("第三步"),
|
GetTranslateString("断面信息"));
|
step断面基本信息.Name = "SectBaseInfo18";
|
step断面基本信息.ID = Step_ID_Section18_Full;
|
step断面基本信息.ParentID = Group_ID_Section18;
|
_allStepNodes.Add(step断面基本信息);
|
|
|
var stepSetct18 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
stepSetct18.AllowSelect = false ;
|
stepSetct18.Caption = "第四步: 第1-8断面";
|
stepSetct18.Name = "TreeStepNode" + Step_ID_Section18_Grp;
|
stepSetct18.ID = Step_ID_Section18_Grp;
|
stepSetct18.ParentID = Group_ID_Section18;
|
stepSetct18.SpecImage = DPumpHydr.WinFrmUI.Volute.Properties.Resources.Sect16;
|
_allStepNodes.Add(stepSetct18);
|
|
for(int i = 8; i >= 1; i--)
|
{
|
var stepSetct0 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
stepSetct0.AllowSelect = true;
|
stepSetct0.Caption = string.Format("第{0}断面",i);
|
stepSetct0.Name = "TreeStepNodeSect" + i;
|
stepSetct0.ID = Step_ID_Section18_Grp + (9-i);
|
stepSetct0.ParentID = Step_ID_Section18_Grp;
|
_allStepNodes.Add(stepSetct0);
|
}
|
#endregion
|
|
|
#region 出水体
|
|
var stepGroup_出水体 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
stepGroup_出水体.AllowSelect = false;
|
stepGroup_出水体.Caption = "出水体设计";
|
stepGroup_出水体.Name = Group_Name_Outflow;
|
stepGroup_出水体.ID = Group_ID_Outflow;
|
stepGroup_出水体.ParentID = 0;
|
_allStepNodes.Add(stepGroup_出水体);
|
|
|
|
var step出水体尺寸 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
step出水体尺寸.AllowSelect = true;
|
step出水体尺寸.Caption = " 第五步:出水体类型";
|
step出水体尺寸.Name = "TreeStepNode" + Step_ID_Outflow_Type;
|
step出水体尺寸.ID = Step_ID_Outflow_Type;
|
step出水体尺寸.ParentID = Group_ID_Outflow;
|
_allStepNodes.Add(step出水体尺寸);
|
|
|
|
|
var step出水体类型 = new DPumpHydr.WinFrmUI.Base.StepTreeNodePara()
|
{
|
ProgressState = WinFrmUI.Base.StepTreeNodePara.eProgressState.未完成,
|
DataState = WinFrmUI.Base.StepTreeNodePara.eDataState.未知
|
};
|
step出水体类型.AllowSelect = true;
|
step出水体类型.Caption = "第六步:出水体尺寸";
|
step出水体类型.Name = "TreeStepNode" + Step_ID_Outflow_Style;
|
step出水体类型.ID = Step_ID_Outflow_Style;
|
step出水体类型.ParentID = Group_ID_Outflow;
|
_allStepNodes.Add(step出水体类型);
|
|
|
|
|
|
#endregion
|
|
|
//
|
this._currentStepID = Step_ID_Hdr_Base_Info;
|
this.stepTreeCtrl1.SetStepSource(_allStepNodes, Step_ID_Hdr_Base_Info);
|
}
|
|
|
|
public void SetFocusedNode(long StepNodeID)
|
{
|
this._currentStepID = StepNodeID;
|
this.stepTreeCtrl1.SetFocusedNode(StepNodeID);
|
}
|
public void SetStepSource(List<StepTreeNodePara> steps, long ID)
|
{
|
if(ID > 0)
|
{
|
this._currentStepID = ID;
|
this.stepTreeCtrl1.SetStepSource(steps, ID);
|
}
|
else
|
{
|
this.stepTreeCtrl1.SetStepSource(steps, this._currentStepID);
|
}
|
}
|
|
|
|
|
private string GetTranslateString(string text)
|
{
|
return text;
|
}
|
|
}
|
|
}
|