namespace HStation.WinFrmUI { public partial class XhsProjectSimulationUnMatchingListCtrl : DevExpress.XtraEditors.XtraUserControl { public XhsProjectSimulationUnMatchingListCtrl() { InitializeComponent(); this.xhsProjectSimulationPumpUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationPumpUnMatchingListCtrl1_HydroClickEvent; this.xhsProjectSimulationValveUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationValveUnMatchingListCtrl1_HydroClickEvent; this.xhsProjectSimulationPipeUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationPipeUnMatchingListCtrl1_HydroClickEvent; this.xhsProjectSimulationElbowUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationElbowUnMatchingListCtrl1_HydroClickEvent; this.xhsProjectSimulationThreelinkUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationThreelinkUnMatchingListCtrl1_HydroClickEvent; this.xhsProjectSimulationFourlinkUnMatchingListCtrl1.HydroClickEvent += XhsProjectSimulationFourlinkUnMatchingListCtrl1_HydroClickEvent; } /// /// 水力点击事件 /// public event Action HydroClickEvent; /// /// 查看模型事件 /// public event Action> ViewModelEvent; /// /// 列表为空时隐藏Page /// [Browsable(true)] [Display(Name = "列表为空时隐藏Page")] [DisplayName("列表为空时隐藏Page")] public bool HidePageWhenListIsNull { get { return _hidePageWhenListIsNull; } set { _hidePageWhenListIsNull = value; } } private bool _hidePageWhenListIsNull = true; private Yw.Model.HydroModelInfo _hydroInfo = null; /// /// 绑定数据 /// public void SetBindingData(Yw.Model.HydroModelInfo rhs) { _hydroInfo = rhs; if (_hydroInfo == null) { return; } var pumps = _hydroInfo.Pumps?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList(); this.xhsProjectSimulationPumpUnMatchingListCtrl1.SetBindingData(pumps); var valves = _hydroInfo.Valves?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList(); this.xhsProjectSimulationValveUnMatchingListCtrl1.SetBindingData(valves); var pipes = _hydroInfo.Pipes?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList(); this.xhsProjectSimulationPipeUnMatchingListCtrl1.SetBindingData(pipes); var elbows = _hydroInfo.Elbows?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList(); this.xhsProjectSimulationElbowUnMatchingListCtrl1.SetBindingData(elbows); var threelinks = _hydroInfo.Threelinks?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList(); this.xhsProjectSimulationThreelinkUnMatchingListCtrl1.SetBindingData(threelinks); var fourlinks = _hydroInfo.Fourlinks?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList(); this.xhsProjectSimulationFourlinkUnMatchingListCtrl1.SetBindingData(fourlinks); if (this.HidePageWhenListIsNull) { if (pumps == null || pumps.Count < 1) { this.tabPagePumps.PageVisible = false; } else { this.tabPagePumps.PageVisible = true; } if (valves == null || valves.Count < 1) { this.tabPageValves.PageVisible = false; } else { this.tabPageValves.PageVisible = true; } if (pipes == null || pipes.Count < 1) { this.tabPagePipes.PageVisible = false; } else { this.tabPagePipes.PageVisible = true; } if (elbows == null || elbows.Count < 1) { this.tabPageElbows.PageVisible = false; } else { this.tabPageElbows.PageVisible = true; } if (threelinks == null || threelinks.Count < 1) { this.tabPageThreelinks.PageVisible = false; } else { this.tabPageThreelinks.PageVisible = true; } if (fourlinks == null || fourlinks.Count < 1) { this.tabPageFourlinks.PageVisible = false; } else { this.tabPageFourlinks.PageVisible = true; } } } //模型查看 private void btnViewModel_Click(object sender, EventArgs e) { if (_hydroInfo == null) { return; } var parters = _hydroInfo.GetAllParters(); parters = parters?.Where(x => string.IsNullOrEmpty(x.DbId)).ToList(); this.ViewModelEvent?.Invoke(parters); } #region 事件触发 private void XhsProjectSimulationPipeUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroPipeInfo obj) { this.HydroClickEvent?.Invoke(obj); } private void XhsProjectSimulationFourlinkUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroFourlinkInfo obj) { this.HydroClickEvent?.Invoke(obj); } private void XhsProjectSimulationThreelinkUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroThreelinkInfo obj) { this.HydroClickEvent?.Invoke(obj); } private void XhsProjectSimulationElbowUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroElbowInfo obj) { this.HydroClickEvent?.Invoke(obj); } private void XhsProjectSimulationValveUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroValveInfo obj) { this.HydroClickEvent?.Invoke(obj); } private void XhsProjectSimulationPumpUnMatchingListCtrl1_HydroClickEvent(Yw.Model.HydroPumpInfo obj) { this.HydroClickEvent?.Invoke(obj); } #endregion } }