| | |
| | | using DevExpress.CodeParser; |
| | | using DevExpress.Utils; |
| | | using DevExpress.Utils; |
| | | using DevExpress.XtraTreeList; |
| | | using HStation.WinFrmUI.Xhs; |
| | | using NetTaste; |
| | | using System; |
| | | using Timer = System.Threading.Timer; |
| | | |
| | | namespace HStation.WinFrmUI |
| | |
| | | this.Load += XhsProjectMgrPage_Load; |
| | | } |
| | | |
| | | private void XhsProjectMgrPage_Load |
| | | (object sender, EventArgs e) |
| | | private void XhsProjectMgrPage_Load(object sender, EventArgs e) |
| | | { |
| | | repositoryItemImageComboBox1.Items.AddEnum(typeof(XhsProjectMgrViewModel.eFileStatus)); |
| | | var a = typeof(XhsProjectMgrViewModel.eFileStatus); |
| | | repositoryItemImageComboBox1.Items.AddEnum(typeof(eXhsProjectStatus)); |
| | | repositoryItemImageComboBox1.Items[0].ImageIndex = 0; |
| | | repositoryItemImageComboBox1.Items[1].ImageIndex = 1; |
| | | repositoryItemImageComboBox1.Items[2].ImageIndex = 2; |
| | |
| | | repositoryItemImageComboBox1.Items[8].ImageIndex = 8; |
| | | } |
| | | |
| | | private List<XhsProjectMgrViewModel> _allProjectList = null; |
| | | private List<XhsProjectMgrViewModel> _allBindingList = null; |
| | | |
| | | private BLL.XhsProjectExtensions _bll = null; |
| | | |
| | |
| | | /// <summary> |
| | | /// 初始化数据源 |
| | | /// </summary> |
| | | public override async void InitialDataSource() |
| | | public override void InitialDataSource() |
| | | { |
| | | base.InitialDataSource(); |
| | | this.SetBindingData(); |
| | | InitialData(); |
| | | } |
| | | |
| | | private async void SetBindingData() |
| | | //初始化数据 |
| | | private async void InitialData() |
| | | { |
| | | _bll = new BLL.XhsProjectExtensions(); |
| | | var allProjectList = await _bll.GetAll(); |
| | | _allProjectList = new List<XhsProjectMgrViewModel>(); |
| | | var overlay = this.ShowOverlay(); |
| | | _allBindingList = new List<XhsProjectMgrViewModel>(); |
| | | var allProjectList = await BLLFactory<HStation.BLL.XhsProjectExtensions>.Instance.GetAll(); |
| | | if (allProjectList != null && allProjectList.Count > 0) |
| | | { |
| | | foreach (var project in allProjectList) |
| | | { |
| | | var mapinfo = await new Yw.BLL.MapInfo().Get(HStation.Xhs.DataType.XhsProject, project.ID, Yw.Map.Kind.Gaodei, Yw.Map.Purpose.Location); |
| | | var bimFile = await BimfaceFileStateHelper.IsHaveBimFace(project.ID); |
| | | if (bimFile != null) |
| | | var mapInfo = await BLLFactory<Yw.BLL.MapInfo>.Instance |
| | | .Get(HStation.Xhs.DataType.XhsProject, project.ID, Yw.Map.Kind.Gaodei, Yw.Map.Purpose.Location); |
| | | Yw.Vmo.BimfaceFileVmo bimfaceFile = null; |
| | | var projectSite = project.SiteList?.FirstOrDefault(); |
| | | if (projectSite != null) |
| | | { |
| | | //如果文件状态为上传中则进行定时请求刷新状态 |
| | | if (bimFile.FileStatus == 0) |
| | | var bimfaceFileRelation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, HStation.Xhs.Purpose.Simulation); ; |
| | | if (bimfaceFileRelation != null) |
| | | { |
| | | Task.Factory.StartNew(() => |
| | | { |
| | | StartTimer(300, bimFile.ID); |
| | | }); |
| | | bimfaceFile = await BLLFactory<Yw.BLL.BimfaceFile>.Instance |
| | | .GetByID(bimfaceFileRelation.BimfaceFileID); |
| | | } |
| | | var vm = new XhsProjectMgrViewModel(project, true, bimFile.FileStatus, mapinfo); |
| | | _allProjectList.Add(vm); |
| | | } |
| | | else |
| | | { |
| | | var vm = new XhsProjectMgrViewModel(project, false, 8, mapinfo); |
| | | _allProjectList.Add(vm); |
| | | } |
| | | var vm = new XhsProjectMgrViewModel(project, mapInfo, bimfaceFile); |
| | | _allBindingList.Add(vm); |
| | | } |
| | | } |
| | | this.xhsProjectMgrViewModelBindingSource.DataSource = _allProjectList; |
| | | } |
| | | |
| | | //计时器(刷新上传状态) |
| | | public void StartTimer(int intervalMilliseconds, long ID) |
| | | { |
| | | // 创建一个 Timer,它将在给定的时间间隔后触发回调方法 |
| | | var timer = new System.Threading.Timer(TimerCallback, ID, Timeout.Infinite, intervalMilliseconds); |
| | | // 启动 Timer |
| | | timer.Change(intervalMilliseconds, intervalMilliseconds); |
| | | } |
| | | |
| | | private async void TimerCallback(object state) |
| | | { |
| | | var tupleState = (Tuple<long, Timer>)state; |
| | | long iD = tupleState.Item1; |
| | | Timer timer = tupleState.Item2; |
| | | try |
| | | { |
| | | var stateResult = await BimfaceHelper.GetFileTranslateStatus(iD); |
| | | if (stateResult == 0) |
| | | { |
| | | this.SetBindingData(); |
| | | } |
| | | else |
| | | { |
| | | timer.Dispose(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | this.xhsProjectMgrViewModelBindingSource.DataSource = _allBindingList; |
| | | this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | overlay.Close(); |
| | | } |
| | | |
| | | #region 当前 |
| | |
| | | //获取当前 |
| | | private XhsProjectMgrViewModel GetCurrentViewModel() |
| | | { |
| | | if (_allProjectList == null) |
| | | { |
| | | Yw.WinFrmUI.MessageBoxHelper.ShowError("数据初始化错误!"); |
| | | return null; |
| | | } |
| | | if (_allProjectList == null) |
| | | { |
| | | Yw.WinFrmUI.MessageBoxHelper.ShowInfo("无数据"); |
| | | return null; |
| | | } |
| | | var vm = this.treeList1.GetCurrentViewModel(_allProjectList); |
| | | if (vm == null) |
| | | { |
| | | Yw.WinFrmUI.MessageBoxHelper.ShowInfo("请选择数据行!"); |
| | | return null; |
| | | } |
| | | return vm; |
| | | //if (_allProjectList == null) |
| | | //{ |
| | | // Yw.WinFrmUI.MessageBoxHelper.ShowError("数据初始化错误!"); |
| | | // return null; |
| | | //} |
| | | //if (_allProjectList == null) |
| | | //{ |
| | | // Yw.WinFrmUI.MessageBoxHelper.ShowInfo("无数据"); |
| | | // return null; |
| | | //} |
| | | //var vm = this.treeList1.GetCurrentViewModel(_allProjectList); |
| | | //if (vm == null) |
| | | //{ |
| | | // Yw.WinFrmUI.MessageBoxHelper.ShowInfo("请选择数据行!"); |
| | | // return null; |
| | | //} |
| | | //return vm; |
| | | return default; |
| | | } |
| | | |
| | | #endregion 当前 |
| | |
| | | #region 基础操作 |
| | | |
| | | //添加 |
| | | private async void barBtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void barBtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | /* var dlg = new AddProjectDlg(); |
| | | dlg.ReloadDataEvent += async (rhs, mapinfo) => |
| | | { |
| | | var bll = new BLL.XhsProjectExtensions(); |
| | | var id = await bll.Insert(rhs); |
| | | if (id > 0) |
| | | { |
| | | rhs.ID = id; |
| | | var vmo = await _bll.GetByID(id); |
| | | _allProjectList.Add(new XhsProjectMgrViewModel(vmo, false)); |
| | | this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | if (mapinfo != null) |
| | | { |
| | | mapinfo.ObjectID = id; |
| | | mapinfo.ObjectName = rhs.Name; |
| | | var mapinfoid = await new Yw.BLL.MapInfo().Insert(mapinfo); |
| | | if (mapinfoid < 0) |
| | | { |
| | | TipFormHelper.ShowError("地图信息添加错误"); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | */ |
| | | var dlg = new ImportXhsProjectDlg(); |
| | | dlg.SetBindingData(); |
| | | if (dlg.ShowDialog() == DialogResult.OK) |
| | | { |
| | | var prj = dlg.ViewModel; |
| | | if (prj.ProjectID == null) |
| | | return; |
| | | var vmo = await _bll.GetByID((long)prj.ProjectID); |
| | | if (vmo == null) |
| | | { |
| | | TipFormHelper.ShowError("导入失败!"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | TipFormHelper.ShowSucceed("导入成功!"); |
| | | var mapinfo = await new Yw.BLL.MapInfo().Get(HStation.Xhs.DataType.XhsProject, (long)prj.ProjectID, Yw.Map.Kind.Gaodei, Yw.Map.Purpose.Location); |
| | | var bimFile = await BimfaceFileStateHelper.IsHaveBimFace((long)prj.ProjectID); |
| | | if (bimFile != null) |
| | | { |
| | | _allProjectList.Add(new XhsProjectMgrViewModel(vmo, true, bimFile.FileStatus, mapinfo)); |
| | | } |
| | | else |
| | | { |
| | | _allProjectList.Add(new XhsProjectMgrViewModel(vmo, false, 8, mapinfo)); |
| | | } |
| | | this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | } |
| | | //var dlg = new ImportXhsProjectDlg(); |
| | | //dlg.SetBindingData(); |
| | | //if (dlg.ShowDialog() == DialogResult.OK) |
| | | //{ |
| | | // var prj = dlg.ViewModel; |
| | | // if (prj.ProjectID == null) |
| | | // return; |
| | | // var vmo = await _bll.GetByID((long)prj.ProjectID); |
| | | // if (vmo == null) |
| | | // { |
| | | // TipFormHelper.ShowError("导入失败!"); |
| | | // return; |
| | | // } |
| | | // else |
| | | // { |
| | | // TipFormHelper.ShowSucceed("导入成功!"); |
| | | // var mapinfo = await new Yw.BLL.MapInfo().Get(HStation.Xhs.DataType.XhsProject, (long)prj.ProjectID, Yw.Map.Kind.Gaodei, Yw.Map.Purpose.Location); |
| | | // var bimFile = await BimfaceFileStateHelper.IsHaveBimFace((long)prj.ProjectID); |
| | | // if (bimFile != null) |
| | | // { |
| | | // _allProjectList.Add(new XhsProjectMgrViewModel(vmo, true, bimFile.FileStatus, mapinfo)); |
| | | // } |
| | | // else |
| | | // { |
| | | // _allProjectList.Add(new XhsProjectMgrViewModel(vmo, false, 8, mapinfo)); |
| | | // } |
| | | // this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | // } |
| | | //} |
| | | } |
| | | |
| | | //编辑 |
| | | private void barBtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var currentVm = this.GetCurrentViewModel(); |
| | | if (currentVm == null) |
| | | { |
| | | MessageBoxHelper.ShowWarning("请选择数据行!"); |
| | | return; |
| | | } |
| | | var dlg = new EditProjectDlg(); |
| | | dlg.SetBindingData(currentVm.ID); |
| | | dlg.ReloadDataEvent += async (rhs, mapinfo) => |
| | | { |
| | | if (await _bll.Update(rhs)) |
| | | { |
| | | currentVm.Reset(rhs); |
| | | this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | if (mapinfo != null) |
| | | { |
| | | // mapinfo.ObjectID = id; |
| | | mapinfo.ObjectName = rhs.Name; |
| | | var bol = await new Yw.BLL.MapInfo().Update(mapinfo); |
| | | if (!bol) |
| | | { |
| | | TipFormHelper.ShowError("地图信息编辑错误"); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | return false; |
| | | }; |
| | | dlg.ShowDialog(); |
| | | //var currentVm = this.GetCurrentViewModel(); |
| | | //if (currentVm == null) |
| | | //{ |
| | | // MessageBoxHelper.ShowWarning("请选择数据行!"); |
| | | // return; |
| | | //} |
| | | //var dlg = new EditProjectDlg(); |
| | | //dlg.SetBindingData(currentVm.ID); |
| | | //dlg.ReloadDataEvent += async (rhs, mapinfo) => |
| | | //{ |
| | | // if (await _bll.Update(rhs)) |
| | | // { |
| | | // currentVm.Reset(rhs); |
| | | // this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | // if (mapinfo != null) |
| | | // { |
| | | // // mapinfo.ObjectID = id; |
| | | // mapinfo.ObjectName = rhs.Name; |
| | | // var bol = await new Yw.BLL.MapInfo().Update(mapinfo); |
| | | // if (!bol) |
| | | // { |
| | | // TipFormHelper.ShowError("地图信息编辑错误"); |
| | | // } |
| | | // } |
| | | // return true; |
| | | // } |
| | | // return false; |
| | | //}; |
| | | //dlg.ShowDialog(); |
| | | } |
| | | |
| | | //删除 |
| | | private async void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var currentVm = GetCurrentViewModel(); |
| | | if (currentVm == null) |
| | | var vm = this.treeList1.GetCurrentViewModel(_allBindingList); |
| | | if (vm == null) |
| | | { |
| | | MessageBoxHelper.ShowWarning("请选择数据行!"); |
| | | TipFormHelper.ShowWarn("请选择项目!"); |
| | | return; |
| | | } |
| | | if (MessageBoxHelper.IsClickOk($"确认删除数据行?", "提示")) |
| | | return; |
| | | var groupresult = await _bll.DeleteByID(currentVm.ID); |
| | | if (groupresult) |
| | | var result = XtraMessageBox.Show("是否确认删除此项目?", "询问", MessageBoxButtons.YesNo) == DialogResult.Yes; |
| | | if (!result) |
| | | { |
| | | _allProjectList.Remove(currentVm); |
| | | this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | TipFormHelper.ShowSucceed("删除成功!"); |
| | | } |
| | | else |
| | | { |
| | | TipFormHelper.ShowSucceed("删除失败!"); |
| | | return; |
| | | } |
| | | if (vm.Project.SiteList != null && vm.Project.SiteList.Count > 0) |
| | | { |
| | | foreach (var projectSite in vm.Project.SiteList) |
| | | { |
| | | var allSchemeList = await BLLFactory<HStation.BLL.XhsScheme>.Instance.GetBySiteID(projectSite.ID); |
| | | if (allSchemeList != null && allSchemeList.Count > 0) |
| | | { |
| | | foreach (var scheme in allSchemeList) |
| | | { |
| | | var schemeRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsScheme, scheme.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (schemeRelation != null) |
| | | { |
| | | if (!await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.DeleteAllByID(schemeRelation.ID)) |
| | | { |
| | | TipFormHelper.ShowError("项目方案模型删除失败,请重试!"); |
| | | return; |
| | | } |
| | | } |
| | | if (!await BLLFactory<HStation.BLL.XhsScheme>.Instance.DeleteByID(scheme.ID)) |
| | | { |
| | | TipFormHelper.ShowError("项目方案删除失败,请重试!"); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | var bimfaceFileRelation = await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (bimfaceFileRelation != null) |
| | | { |
| | | if (!await BLLFactory<Yw.BLL.BimfaceFileRelation>.Instance.DeleteAllByID(bimfaceFileRelation.ID)) |
| | | { |
| | | TipFormHelper.ShowError("项目三维模型删除失败,请重试!"); |
| | | return; |
| | | } |
| | | } |
| | | var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance |
| | | .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, projectSite.ID, HStation.Xhs.Purpose.Simulation); |
| | | if (hydroRelation != null) |
| | | { |
| | | if (!await BLLFactory<Yw.BLL.HydroModelRelation>.Instance.DeleteAllByID(hydroRelation.ID)) |
| | | { |
| | | TipFormHelper.ShowError("项目模型删除失败,请重试!"); |
| | | return; |
| | | } |
| | | } |
| | | if (!await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.DeleteByID(projectSite.ID)) |
| | | { |
| | | TipFormHelper.ShowError("项目站删除失败,请重试!"); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (vm.MapInfo != null) |
| | | { |
| | | if (!await BLLFactory<Yw.BLL.MapInfo>.Instance.DeleteByObjectTypeAndObjectID(HStation.Xhs.DataType.XhsProject, vm.Project.ID)) |
| | | { |
| | | TipFormHelper.ShowError("项目地图位置删除失败,请重试!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var bol = await BLLFactory<HStation.BLL.XhsProject>.Instance.DeleteByID(vm.Project.ID); |
| | | if (!bol) |
| | | { |
| | | TipFormHelper.ShowError("项目删除失败,请重试!"); |
| | | return; |
| | | } |
| | | |
| | | _allBindingList.Remove(vm); |
| | | this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | TipFormHelper.ShowSucceed("项目删除成功!"); |
| | | } |
| | | |
| | | //详细信息 |
| | |
| | | |
| | | private async void treeList1_RowCellClick(object sender, RowCellClickEventArgs e) |
| | | { |
| | | if (_allProjectList == null || _allProjectList.Count < 1) |
| | | return; |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | if (e.Column != this.ColViewBimface) |
| | | return; |
| | | if (!vm.IsHaveBimface) |
| | | { |
| | | TipFormHelper.ShowWarn("请先上传文件再进行操作!"); |
| | | return; |
| | | } |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = Yw.WinFrmUI.PageModular.Bimface, |
| | | MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab, |
| | | Function = Yw.WinFrmUI.PageFunction.ViewSchemeMgr, |
| | | TagName = $"{vm.ID}" |
| | | }; |
| | | //if (_allProjectList == null || _allProjectList.Count < 1) |
| | | // return; |
| | | //var vm = GetCurrentViewModel(); |
| | | //if (vm == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //if (e.Column != this.ColViewBimface) |
| | | // return; |
| | | //if (!vm.IsHaveBimface) |
| | | //{ |
| | | // TipFormHelper.ShowWarn("请先上传文件再进行操作!"); |
| | | // return; |
| | | //} |
| | | //var guid = new PageGuid() |
| | | //{ |
| | | // Modular = Yw.WinFrmUI.PageModular.Bimface, |
| | | // MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab, |
| | | // Function = Yw.WinFrmUI.PageFunction.ViewSchemeMgr, |
| | | // TagName = $"{vm.ID}" |
| | | //}; |
| | | |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new XhsProjectSimulationMgrPage(); |
| | | await page.SetBindingData(vm.ID); |
| | | CreatePage(page, guid); |
| | | } |
| | | //if (!IsExistPage(guid, true)) |
| | | //{ |
| | | // var page = new XhsProjectSimulationMgrPage(); |
| | | // await page.SetBindingData(vm.ID); |
| | | // CreatePage(page, guid); |
| | | //} |
| | | } |
| | | |
| | | #region 更多操作 |
| | |
| | | //刷新 |
| | | private void barBtnRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | this.SetBindingData(); |
| | | // this.SetBindingData(); |
| | | } |
| | | |
| | | #endregion 更多操作 |
| | |
| | | //查看bimface模型 |
| | | private async void barBtnViewBimface_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!vm.IsHaveBimface) |
| | | { |
| | | TipFormHelper.ShowWarn("请先上传文件再进行操作!"); |
| | | return; |
| | | } |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = Yw.WinFrmUI.PageModular.Bimface, |
| | | MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab, |
| | | Function = Yw.WinFrmUI.PageFunction.ViewBimface3d, |
| | | TagName = $"{vm.ID}" |
| | | }; |
| | | //var vm = GetCurrentViewModel(); |
| | | //if (vm == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //if (!vm.IsHaveBimface) |
| | | //{ |
| | | // TipFormHelper.ShowWarn("请先上传文件再进行操作!"); |
| | | // return; |
| | | //} |
| | | //var guid = new PageGuid() |
| | | //{ |
| | | // Modular = Yw.WinFrmUI.PageModular.Bimface, |
| | | // MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab, |
| | | // Function = Yw.WinFrmUI.PageFunction.ViewBimface3d, |
| | | // TagName = $"{vm.ID}" |
| | | //}; |
| | | |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new ViewXhsProjectBimfacePage(); |
| | | await page.SetBindingData(vm.ID); |
| | | CreatePage(page, guid); |
| | | } |
| | | //if (!IsExistPage(guid, true)) |
| | | //{ |
| | | // var page = new ViewXhsProjectBimfacePage(); |
| | | // await page.SetBindingData(vm.ID); |
| | | // CreatePage(page, guid); |
| | | //} |
| | | } |
| | | |
| | | //查看水力模型 |
| | | private void barBtnViewHydro_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_allProjectList == null || _allProjectList.Count < 1) |
| | | return; |
| | | var vm = GetCurrentViewModel(); |
| | | if (vm == null) |
| | | { |
| | | return; |
| | | } |
| | | if (!vm.IsHaveBimface) |
| | | { |
| | | TipFormHelper.ShowWarn("请先上传文件再进行操作!"); |
| | | return; |
| | | } |
| | | var guid = new PageGuid() |
| | | { |
| | | Modular = "Hydro", |
| | | MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab, |
| | | Function = "ViewModel", |
| | | }; |
| | | if (!IsExistPage(guid, true)) |
| | | { |
| | | var page = new HydroQ3dViewPage(); |
| | | page.SetBindingData(vm.ID); |
| | | CreatePage(page, guid); |
| | | } |
| | | //if (_allProjectList == null || _allProjectList.Count < 1) |
| | | // return; |
| | | //var vm = GetCurrentViewModel(); |
| | | //if (vm == null) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //if (!vm.IsHaveBimface) |
| | | //{ |
| | | // TipFormHelper.ShowWarn("请先上传文件再进行操作!"); |
| | | // return; |
| | | //} |
| | | //var guid = new PageGuid() |
| | | //{ |
| | | // Modular = "Hydro", |
| | | // MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab, |
| | | // Function = "ViewModel", |
| | | //}; |
| | | //if (!IsExistPage(guid, true)) |
| | | //{ |
| | | // var page = new HydroQ3dViewPage(); |
| | | // page.SetBindingData(vm.ID); |
| | | // CreatePage(page, guid); |
| | | // } |
| | | } |
| | | |
| | | //导入文件 |
| | | private async void BtnAddBimfaceFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void BtnAddBimfaceFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var currentVm = this.GetCurrentViewModel(); |
| | | if (currentVm == null) |
| | | { |
| | | MessageBoxHelper.ShowWarning("请选择数据行!"); |
| | | return; |
| | | } |
| | | if (currentVm.ModelState != XhsProjectMgrViewModel.eFileStatus.Noupload) |
| | | { |
| | | MessageBoxHelper.ShowWarning("已经存在模型文件!"); |
| | | return; |
| | | } |
| | | var dlg = new ImportXhsProjectFileDlg(); |
| | | dlg.SetBindingData(currentVm.ID); |
| | | if (dlg.ShowDialog() == DialogResult.OK) |
| | | { |
| | | var prj = dlg.ViewModel; |
| | | if (prj.ProjectID == null) |
| | | return; |
| | | var mapinfo = await new Yw.BLL.MapInfo().Get(HStation.Xhs.DataType.XhsProject, (long)prj.ProjectID, Yw.Map.Kind.Gaodei, Yw.Map.Purpose.Location); |
| | | var bimFile = await BimfaceFileStateHelper.IsHaveBimFace((long)prj.ProjectID); |
| | | if (bimFile != null) |
| | | { |
| | | currentVm.Reset(currentVm, bimFile.FileStatus); |
| | | this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | } |
| | | //var currentVm = this.GetCurrentViewModel(); |
| | | //if (currentVm == null) |
| | | //{ |
| | | // MessageBoxHelper.ShowWarning("请选择数据行!"); |
| | | // return; |
| | | //} |
| | | //if (currentVm.ModelState != XhsProjectMgrViewModel.eFileStatus.Noupload) |
| | | //{ |
| | | // MessageBoxHelper.ShowWarning("已经存在模型文件!"); |
| | | // return; |
| | | //} |
| | | //var dlg = new ImportXhsProjectFileDlg(); |
| | | //dlg.SetBindingData(currentVm.ID); |
| | | //if (dlg.ShowDialog() == DialogResult.OK) |
| | | //{ |
| | | // var prj = dlg.ViewModel; |
| | | // if (prj.ProjectID == null) |
| | | // return; |
| | | // var mapinfo = await new Yw.BLL.MapInfo().Get(HStation.Xhs.DataType.XhsProject, (long)prj.ProjectID, Yw.Map.Kind.Gaodei, Yw.Map.Purpose.Location); |
| | | // var bimFile = await BimfaceFileStateHelper.IsHaveBimFace((long)prj.ProjectID); |
| | | // if (bimFile != null) |
| | | // { |
| | | // currentVm.Reset(currentVm, bimFile.FileStatus); |
| | | // this.xhsProjectMgrViewModelBindingSource.ResetBindings(false); |
| | | // } |
| | | //} |
| | | } |
| | | |
| | | |
| | | } |
| | | } |