| | |
| | | this.layoutControl1.SetupLayoutControl(); |
| | | this.mapSetSimpleMarkerContainer1.LoadCompletedEvent += MapSetSimpleMarkerContainer1_LoadCompletedEvent; |
| | | this.mapSetSimpleMarkerContainer1.SetMarkerEvent += MapSetSimpleMarkerContainer1_SetMarkerEvent; |
| | | |
| | | this.imgCmbPlaceType.Properties.AddEnum<PBS.ePlaceType>(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public event Action PageStateChangedEvent; |
| | | |
| | | private QuickModelingViewModel _vm = null;//操作对象 |
| | | private bool _isCompleted = false;//是否创建完成 |
| | | private bool _createResult = false;//创建结果 |
| | | private bool _isCompleted = false;//是否创建完成 |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 初始化页面 |
| | |
| | | { |
| | | 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(); |
| | | } |
| | | |
| | |
| | | //设置 |
| | | 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; |
| | | } |
| | | |
| | | |
| | |
| | | public bool AllowPrev |
| | | { |
| | | get |
| | | { |
| | | if (!_isCompleted) |
| | | { |
| | | return false; |
| | | } |
| | | if (!_createResult) |
| | | { |
| | | return true; |
| | | } |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | |
| | | { |
| | | get |
| | | { |
| | | if (_createResult) |
| | | if (!_isCompleted) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | public bool AllowCancel |
| | | { |
| | | get |
| | | { |
| | | if (!_createResult) |
| | | { |
| | | return true; |
| | | } |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | public Task<bool> CanNext() |
| | | { |
| | | return Task.Run(() => this.AllowNext); |
| | | return Task.Run(() => Save()); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return Task.Run(() => this.AllowComplete); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |