| | |
| | | namespace PBS.WinFrmUI.Hydro |
| | | using Microsoft.Web.WebView2.Core; |
| | | |
| | | namespace PBS.WinFrmUI.Hydro |
| | | { |
| | | public partial class QuickModelingPlaceWizardPage : DevExpress.XtraEditors.XtraUserControl, IWizardPageAsync<QuickModelingViewModel> |
| | | { |
| | |
| | | { |
| | | 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> |
| | | /// 状态改变事件 |
| | |
| | | _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; |
| | |
| | | |
| | | |
| | | //加载完成事件 |
| | | 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; |
| | | } |
| | | |
| | | |
| | |
| | | var placeType = (PBS.ePlaceType)this.imgCmbPlaceType.EditValue; |
| | | this.placeInfoCtrl1.Set(placeType); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //验证 |
| | | private bool Verify() |
| | |
| | | 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; |
| | |
| | | /// </summary> |
| | | public Task<bool> CanNext() |
| | | { |
| | | return Task.Run(() => Save()); |
| | | return Task.Run(async () => await Save()); |
| | | } |
| | | |
| | | /// <summary> |