From ce9752fd657c6689ea64929eb962146e2730624e Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期五, 28 三月 2025 14:07:54 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- WinFrmUI/PBS.WinFrmUI.Hydro/02-quick-modeling/02-place/QuickModelingPlaceWizardPage.cs | 65 +++++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 15 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 5aab912..18428f9 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 @@ -1,4 +1,6 @@ -锘縩amespace PBS.WinFrmUI.Hydro +锘縰sing Microsoft.Web.WebView2.Core; + +namespace PBS.WinFrmUI.Hydro { public partial class QuickModelingPlaceWizardPage : DevExpress.XtraEditors.XtraUserControl, IWizardPageAsync<QuickModelingViewModel> { @@ -6,10 +8,12 @@ { InitializeComponent(); this.layoutControl1.SetupLayoutControl(); - this.mapSetSimpleMarkerContainer1.LoadCompletedEvent += MapSetSimpleMarkerContainer1_LoadCompletedEvent; - this.mapSetSimpleMarkerContainer1.SetMarkerEvent += MapSetSimpleMarkerContainer1_SetMarkerEvent; + this.mapSetPlaceMarkerContainer1.LoadCompletedEvent += MapSetPlaceMarkerContainer1_LoadCompletedEvent; + this.mapSetPlaceMarkerContainer1.SetMarkerEvent += MapSetPlaceMarkerContainer1_SetMarkerEvent; + this.mapSetPlaceMarkerContainer1.SetMapBoundsEvent += MapSetPlaceMarkerContainer1_SetMapBoundsEvent; this.imgCmbPlaceType.Properties.AddEnum<PBS.ePlaceType>(); } + /// <summary> /// 鐘舵�佹敼鍙樹簨浠� @@ -33,9 +37,9 @@ _vm = vm; _isCompleted = false; - if (!this.mapSetSimpleMarkerContainer1.IsInitialized) + if (!this.mapSetPlaceMarkerContainer1.IsInitialized) { - await this.mapSetSimpleMarkerContainer1.InitialContainer(); + await this.mapSetPlaceMarkerContainer1.InitialContainer(); } this.txtName.EditValue = _vm.Place.Name; @@ -53,19 +57,27 @@ //鍔犺浇瀹屾垚浜嬩欢 - private async void MapSetSimpleMarkerContainer1_LoadCompletedEvent() + private async void MapSetPlaceMarkerContainer1_LoadCompletedEvent() { if (_vm.Marker != null) { - await this.mapSetSimpleMarkerContainer1.LoadMarker(_vm.Marker); + await this.mapSetPlaceMarkerContainer1.LoadMarker(_vm.Marker); } } - //璁剧疆 - private void MapSetSimpleMarkerContainer1_SetMarkerEvent(Yw.Model.Map.Marker obj) + //璁剧疆鍦板浘杈圭晫 + private void MapSetPlaceMarkerContainer1_SetMapBoundsEvent(Yw.Model.Map.Point southWest, Yw.Model.Map.Point northEast) { - _vm.Marker = obj; - this.txtAddress.EditValue = obj.Address; + _vm.SouthWest = southWest; + _vm.NorthEast = northEast; + + } + + //璁剧疆鐐� + private void MapSetPlaceMarkerContainer1_SetMarkerEvent(Yw.Model.Map.Marker marker) + { + _vm.Marker = marker; + this.txtAddress.EditValue = marker.Address; } @@ -75,6 +87,9 @@ var placeType = (PBS.ePlaceType)this.imgCmbPlaceType.EditValue; this.placeInfoCtrl1.Set(placeType); } + + + //楠岃瘉 private bool Verify() @@ -92,23 +107,43 @@ if (!this.placeInfoCtrl1.Verify()) { isExist = false; - } + } if (_vm.Marker==null) { isExist = false; - TipFormHelper.ShowWarn("璇疯缃湴鍥句俊鎭紒"); + TipFormHelper.ShowWarn("璇疯缃湴鍥句俊鎭紒"); } + if (_vm.SouthWest == null || _vm.NorthEast == null) + { + isExist = false; + TipFormHelper.ShowWarn("璇疯缃湴鍥捐竟鐣屼俊鎭紒"); + } return isExist; }); } + + //淇濆瓨 - private bool Save() + private async Task<bool> Save() { if (!Verify()) { return false; } + + var sizeInfo= await this.mapSetPlaceMarkerContainer1.CaptureImage(_vm.TempBackgroundImageUrl,_vm.SouthWest,_vm.NorthEast); + if (sizeInfo == null) + { + _vm.IsCaptureImage = false; + TipFormHelper.ShowError("鎴浘澶辫触锛�"); + return false; + } + + _vm.BackgroundHeight = sizeInfo.Value.Height; + _vm.BackgroundWidth = sizeInfo.Value.Width; + _vm.Zoom = sizeInfo.Value.Zoom; + _vm.IsCaptureImage = true; _vm.Place.Name = this.txtName.Text.Trim(); _vm.Place.PlaceType = (ePlaceType)this.imgCmbPlaceType.EditValue; @@ -184,7 +219,7 @@ /// </summary> public Task<bool> CanNext() { - return Task.Run(() => Save()); + return Task.Run(async () => await Save()); } /// <summary> -- Gitblit v1.9.3