From 5aa0bae63df66d66fefb6a0d180eb3774c172d3a Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期四, 20 三月 2025 16:57:28 +0800 Subject: [PATCH] 快速建模 修改中 --- WinFrmUI/PBS.WinFrmUI.Hydro/02-quick-modeling/02-place/QuickModelingPlaceWizardPage.cs | 130 ++++++++++++++++++++++++++----------------- 1 files changed, 79 insertions(+), 51 deletions(-) diff --git a/WinFrmUI/PBS.WinFrmUI.Hydro/02-quick-modeling/02-place/QuickModelingPlaceWizardPage.cs b/WinFrmUI/PBS.WinFrmUI.Hydro/02-quick-modeling/02-place/QuickModelingPlaceWizardPage.cs index 7fc1c0f..5aab912 100644 --- a/WinFrmUI/PBS.WinFrmUI.Hydro/02-quick-modeling/02-place/QuickModelingPlaceWizardPage.cs +++ b/WinFrmUI/PBS.WinFrmUI.Hydro/02-quick-modeling/02-place/QuickModelingPlaceWizardPage.cs @@ -8,7 +8,7 @@ this.layoutControl1.SetupLayoutControl(); this.mapSetSimpleMarkerContainer1.LoadCompletedEvent += MapSetSimpleMarkerContainer1_LoadCompletedEvent; this.mapSetSimpleMarkerContainer1.SetMarkerEvent += MapSetSimpleMarkerContainer1_SetMarkerEvent; - + this.imgCmbPlaceType.Properties.AddEnum<PBS.ePlaceType>(); } /// <summary> @@ -17,10 +17,9 @@ public event Action PageStateChangedEvent; private QuickModelingViewModel _vm = null;//鎿嶄綔瀵硅薄 - private bool _isCompleted = false;//鏄惁鍒涘缓瀹屾垚 - private bool _createResult = false;//鍒涘缓缁撴灉 + private bool _isCompleted = false;//鏄惁鍒涘缓瀹屾垚 - + /// <summary> /// 鍒濆鍖栭〉闈� @@ -31,32 +30,24 @@ { return; } - _vm = vm; + _vm = vm; _isCompleted = false; - _createResult = false; - - //_createResult = await QuickModelingHelper.Create(vm, (msg, color) => - // { - // var drawItem = new DrawItemViewModel - // { - // Text = msg, - // Color = color - // }; - // this.listBoxControl1.Items.Add(drawItem); - // }, (max, current) => - // { - // this.progressBarControl1.Properties.Maximum = max; - // this.progressBarControl1.Position = current; - // //鏇夸唬鏂规 - // // this.progressBarControl1.Properties.Step = current; - // // this.progressBarControl1.PerformStep(); - // }); - _isCompleted = true; - if (!_createResult) + + if (!this.mapSetSimpleMarkerContainer1.IsInitialized) { - //this.progressBarControl1.Position = 0; - //this.itemForProgress.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; - } + await this.mapSetSimpleMarkerContainer1.InitialContainer(); + } + + this.txtName.EditValue = _vm.Place.Name; + this.txtTagName.EditValue = _vm.Place.TagName; + this.txtAddress.EditValue = _vm.Place.Address; + this.txtDescription.EditValue = _vm.Place.Description; + this.placeInfoCtrl1.Set(_vm.Place.PlaceType, _vm.Place.PlaceInfo); + var allFlagsList = await BLLFactory<Yw.BLL.SysFlag>.Instance.GetBySysType(DataType.PBSPlace); + this.setFlagsEditCtrl1.SetBindingData(allFlagsList?.Select(x => x.Name).Distinct().ToList(), _vm.Place.Flags); + this.imgCmbPlaceType.EditValue = _vm.Place.PlaceType; + + _isCompleted = true; this.PageStateChangedEvent?.Invoke(); } @@ -73,11 +64,61 @@ //璁剧疆 private void MapSetSimpleMarkerContainer1_SetMarkerEvent(Yw.Model.Map.Marker obj) { - _vm.Marker = obj; - if (string.IsNullOrEmpty(this.txtAddress.Text.Trim())) + _vm.Marker = obj; + this.txtAddress.EditValue = obj.Address; + } + + + //鍦烘墍绫诲瀷鍙樻崲 + private void imgCmbPlaceType_EditValueChanged(object sender, EventArgs e) + { + var placeType = (PBS.ePlaceType)this.imgCmbPlaceType.EditValue; + this.placeInfoCtrl1.Set(placeType); + } + + //楠岃瘉 + private bool Verify() + { + return this.Invoke(() => { - this.txtAddress.EditValue = obj.Address; + var isExist = true; + this.dxErrorProvider1.ClearErrors(); + var name = this.txtName.Text.Trim(); + if (string.IsNullOrEmpty(name)) + { + this.dxErrorProvider1.SetError(this.txtName, "蹇呭~椤�"); + isExist= false; + } + if (!this.placeInfoCtrl1.Verify()) + { + isExist = false; + } + if (_vm.Marker==null) + { + isExist = false; + TipFormHelper.ShowWarn("璇疯缃湴鍥句俊鎭紒"); + } + return isExist; + }); + } + + //淇濆瓨 + private bool Save() + { + if (!Verify()) + { + return false; } + + _vm.Place.Name = this.txtName.Text.Trim(); + _vm.Place.PlaceType = (ePlaceType)this.imgCmbPlaceType.EditValue; + _vm.Place.Flags = this.setFlagsEditCtrl1.SelectedFlagList; + _vm.Place.TagName = this.txtTagName.Text.Trim(); + _vm.Place.Address = this.txtAddress.Text.Trim(); + _vm.Place.Description = this.txtDescription.Text.Trim(); + _vm.Place.PlaceInfo=this.placeInfoCtrl1.Get(); + + return true; } @@ -87,15 +128,7 @@ public bool AllowPrev { get - { - if (!_isCompleted) - { - return false; - } - if (!_createResult) - { - return true; - } + { return false; } } @@ -107,11 +140,11 @@ { get { - if (_createResult) + if (!_isCompleted) { - return true; - } - return false; + return false; + } + return true; } } @@ -121,11 +154,7 @@ public bool AllowCancel { get - { - if (!_createResult) - { - return true; - } + { return false; } } @@ -155,7 +184,7 @@ /// </summary> public Task<bool> CanNext() { - return Task.Run(() => this.AllowNext); + return Task.Run(() => Save()); } /// <summary> @@ -174,6 +203,5 @@ return Task.Run(() => this.AllowComplete); } - } } \ No newline at end of file -- Gitblit v1.9.3