using DevExpress.XtraEditors; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Yw.WinFrmUI.Phart; namespace Yw.WinFrmUI { public partial class HydroValveCurveViewCtrl : DevExpress.XtraEditors.XtraUserControl { public HydroValveCurveViewCtrl() { InitializeComponent(); } private Yw.Model.HydroCurveInfo _curveol = null;//阀门开度曲线 private List _curvesql = null;//水头损失曲线列表 /// /// 绑定数据 /// public void SetBindingData(Yw.Model.HydroCurveInfo curveOL, List curvesQL) { _curveol = curveOL; _curvesql = curvesQL; var allVmList = new List(); if (curveOL != null) { var vmol = new ValveViewChartViewModel(); vmol.Id = curveOL.Code; vmol.Name = curveOL.Name; vmol.Color = Color.Blue; vmol.CurveType = Ahart.eCurveType.OL; vmol.FeatType = Ahart.eFeatType.Quadratic; vmol.DefPointList = curveOL.CurveData?.Select(x => new Geometry.Point2d(x.X, x.Y)).ToList(); vmol.IsSelect = false; allVmList.Add(vmol); } if (curvesQL != null && curvesQL.Count > 0) { foreach (var curveql in curvesQL) { var vmql = new ValveViewChartViewModel(); vmql.Id = curveql.Code; vmql.Name = curveql.Name; vmql.Color = Color.Green; vmql.CurveType = Ahart.eCurveType.QL; vmql.FeatType = Ahart.eFeatType.Quadratic; vmql.DefPointList = curveql.CurveData?.Select(x => new Geometry.Point2d(x.X, x.Y)).ToList(); vmql.IsSelect = false; allVmList.Add(vmql); } } this.valveViewChart1.SetBindingData(allVmList); } } }