From 24f31cf1f11318a0e76d31d382313d30c0ad9e1d Mon Sep 17 00:00:00 2001
From: lixiaojun <1287241240@qq.com>
Date: 星期四, 15 八月 2024 00:31:35 +0800
Subject: [PATCH] 水力部件列表尝试修改

---
 WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs |  437 ++++++++++++++++++++++++++----------------------------
 1 files changed, 212 insertions(+), 225 deletions(-)

diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs
index 8a6067a..baef353 100644
--- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs
+++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs
@@ -1,6 +1,4 @@
-锘縰sing DevExpress.CodeParser;
-using Mapster;
-using Yw.BIMFace;
+锘縰sing Mapster;
 
 namespace Yw.WinFrmUI
 {
@@ -13,10 +11,12 @@
             this.gridView1.RegistCustomDrawRowIndicator();
 
             this.PageTitle.Caption = "妯″瀷鏂囦欢绠$悊";
+            this.PageTitle.HeaderSvgImage = this.svgImage32[1];
+            this.PageTitle.SvgImageSize = new Size(24, 24);
         }
 
 
-        private List<BimfaceFileViewModel> _allBindingList = null;
+        private List<BimfaceFileMgrViewModel> _allBindingList = null;
         private Lazy<Yw.BLL.BimfaceFile> _bllBimfaceFile = new(() => new Yw.BLL.BimfaceFile());
         private Lazy<Yw.BLL.BimfaceFileRelation> _bllBimfaceFileRelation = new(() => new BLL.BimfaceFileRelation());
 
@@ -26,40 +26,20 @@
         {
             var allBimfaceFileList = await _bllBimfaceFile.Value.GetAll();
             var allBimfaceFileRelationList = await _bllBimfaceFileRelation.Value.GetAll();
-            _allBindingList = new List<BimfaceFileViewModel>();
+            _allBindingList = new List<BimfaceFileMgrViewModel>();
             if (allBimfaceFileList != null && allBimfaceFileList.Count > 0)
             {
                 foreach (var bimfaceFile in allBimfaceFileList)
                 {
                     var hasReason = allBimfaceFileRelationList == null ? false : allBimfaceFileRelationList.Exists(x => x.BimfaceFileID == bimfaceFile.ID);
-                    var vm = new BimfaceFileViewModel(bimfaceFile, hasReason);
+                    var vm = new BimfaceFileMgrViewModel(bimfaceFile, hasReason);
                     _allBindingList.Add(vm);
                 }
             }
-            this.bimfaceFileViewModelBindingSource.DataSource = _allBindingList;
-            this.bimfaceFileViewModelBindingSource.ResetBindings(false);
+            this.bimfaceFileMgrViewModelBindingSource.DataSource = _allBindingList;
+            this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
         }
 
-        //鑾峰彇褰撳墠瀵硅薄
-        private BimfaceFileViewModel GetCurrentModel()
-        {
-            if (_allBindingList == null)
-            {
-                return null;
-            }
-            if (_allBindingList.Count < 1)
-            {
-                XtraMessageBox.Show("鏃犳暟鎹�");
-                return null;
-            }
-            var vm = this.gridView1.GetCurrentViewModel(_allBindingList);
-            if (vm == null)
-            {
-                XtraMessageBox.Show("璇烽�夋嫨鏁版嵁琛岋紒");
-                return null;
-            }
-            return vm;
-        }
 
         /// <summary>
         ///鍒濆鍖栨暟鎹�
@@ -76,6 +56,16 @@
         public override async void RefreshData()
         {
             base.RefreshData();
+
+            if (_allBindingList == null)
+            {
+                return;
+            }
+            if (_allBindingList.Exists(x => x.FileStatus == eFileStatus.Uploading || x.FileStatus == eFileStatus.Converting))
+            {
+                return;
+            }
+
             await LoadData();
         }
 
@@ -99,72 +89,6 @@
             // PageDataSync<Model.BimFileMapper4Get>.DataOperationEvent -= SyncBimFileMapperData;
         }
 
-        //鍚屾妯″瀷鏂囦欢鏁版嵁
-        //private void SyncBimFileData(DocumentPage page, ePageDataOperation operation, Model.BimFile4Get model)
-        //{
-        //    if (_allGetModels == null)
-        //        return;
-        //    if (page == this)
-        //        return;
-        //    switch (operation)
-        //    {
-        //        case ePageDataOperation.Insert:
-        //            {
-        //                _allGetModels.Add(model);
-        //                this.bimFile4GetBindingSource.ResetBindings(false);
-        //            }
-        //            break;
-        //        case ePageDataOperation.Update:
-        //            {
-        //                var rhs = _allGetModels.Find(x => x.ID == model.ID);
-        //                var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.BimFile4Get, Model.BimFile4Get>()).CreateMapper();
-        //                mapper.Map(model, rhs);
-        //                this.bimFile4GetBindingSource.ResetBindings(false);
-        //            }
-        //            break;
-        //        case ePageDataOperation.Delete:
-        //            {
-        //                _allGetModels.RemoveAll(x => x.ID == model.ID);
-        //                this.bimFile4GetBindingSource.ResetBindings(false);
-        //            }
-        //            break;
-        //        default: break;
-        //    }
-        //}
-
-        //鍚屾妯″瀷鏂囦欢鏄犲皠鏁版嵁
-        //private void SyncBimFileMapperData(DocumentPage page, ePageDataOperation operation, Model.BimFileMapper4Get model)
-        //{
-        //    if (_allGetMappers == null)
-        //        return;
-        //    if (page == this)
-        //        return;
-        //    switch (operation)
-        //    {
-        //        case ePageDataOperation.Insert:
-        //            {
-        //                _allGetMappers.Add(model);
-        //            }
-        //            break;
-        //        case ePageDataOperation.Update:
-        //            {
-        //                var index = _allGetMappers.FindIndex(x => x.ID == model.ID);
-        //                if (index >= 0)
-        //                    _allGetMappers.RemoveAt(index);
-        //                _allGetMappers.Add(model);
-        //            }
-        //            break;
-        //        case ePageDataOperation.Delete:
-        //            {
-        //                _allGetMappers.RemoveAll(x => x.ID == model.ID);
-        //            }
-        //            break;
-        //        default: break;
-        //    }
-        //}
-
-
-
         //娣诲姞
         private void Add()
         {
@@ -178,9 +102,9 @@
             {
                 var bimfaceFile = await _bllBimfaceFile.Value.GetByID(bimfaceFileId);
                 var hasReason = await _bllBimfaceFileRelation.Value.IsExistByBimfaceFileID(bimfaceFileId);
-                var vm = new BimfaceFileViewModel(bimfaceFile, hasReason);
+                var vm = new BimfaceFileMgrViewModel(bimfaceFile, hasReason);
                 _allBindingList.Add(vm);
-                this.bimfaceFileViewModelBindingSource.ResetBindings(false);
+                this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
                 XtraMessageBox.Show("娣诲姞鎴愬姛锛�");
             };
             dlg.ShowDialog();
@@ -197,7 +121,7 @@
             dlg.SetBindingData();
             dlg.ReloadDataEvent += async (rhs) =>
             {
-                var vm = new BimfaceFileViewModel();
+                var vm = new BimfaceFileMgrViewModel();
                 vm.BimfaceId = string.Empty;
                 vm.Name = rhs.FileName;
                 vm.ModelType = eModelType.File;
@@ -208,202 +132,226 @@
                 vm.FileSize = string.Format("{0}MB", System.Math.Ceiling(fileInfo.Length / 1024.0 / 1024.0));
 
                 _allBindingList.Add(vm);
-                this.bimfaceFileViewModelBindingSource.ResetBindings(false);
-                var bimfaceClient = Yw.BIMFaceClient.Instance(Settings.BimfaceParasHelper.Bimface.AppKey, Settings.BimfaceParasHelper.Bimface.AppSecret);
-                var uploadTask = Task.Run(() => bimfaceClient.UploadFileExByPolicy(rhs.FilePath, rhs.FileName));
-                await uploadTask;
+                this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
+                var bimfaceId = await BimfaceHelper.UploadFile(rhs.FilePath, rhs.FileName);
 
-                if (uploadTask.Result < 1)
+                if (bimfaceId < 1)
                 {
                     _allBindingList.Remove(vm);
-                    this.bimfaceFileViewModelBindingSource.ResetBindings(false);
-                    this.FindForm().ShowAlertInfo("妯″瀷鏂囦欢涓婁紶鎻愮ず", $"{rhs.FileName} 涓婁紶澶辫触锛�");
+                    this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
+                    this.ShowAlertInfo("妯″瀷鏂囦欢涓婁紶鎻愮ず", $"{rhs.FileName} 涓婁紶澶辫触锛�");
                     return;
                 }
 
-                vm.BimfaceId = uploadTask.Result.ToString();
+                vm.BimfaceId = bimfaceId.ToString();
                 vm.FileStatus = eFileStatus.UploadSucceed;
-                this.bimfaceFileViewModelBindingSource.ResetBindings(false);
+                this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
 
-                var addModel = vm.Adapt<BimfaceFileViewModel, Yw.Dto.AddBimfaceFileInput>();
+                var addModel = vm.Adapt<BimfaceFileMgrViewModel, Yw.Dto.AddBimfaceFileInput>();
                 vm.ID = await _bllBimfaceFile.Value.Insert(addModel);
                 if (vm.ID < 1)
                 {
                     _allBindingList.Remove(vm);
-                    this.FindForm().ShowAlertInfo("妯″瀷鏂囦欢涓婁紶鎻愮ず", $"{rhs.FileName} 淇濆瓨澶辫触锛�");
+                    this.ShowAlertInfo("妯″瀷鏂囦欢涓婁紶鎻愮ず", $"{rhs.FileName} 淇濆瓨澶辫触锛�");
                 }
-                this.bimfaceFileViewModelBindingSource.ResetBindings(false);
+                this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
             };
             dlg.ShowDialog();
         }
 
-        //杞崲BIM
-        private async void TranslateBim()
+        //杞崲
+        private async void Translate()
         {
-            if (_allBindingList == null)
-            {
-                return;
-            }
-            var vm = GetCurrentModel();
+            var vm = GetCurrentViewModel();
             if (vm == null)
             {
                 return;
             }
             if (vm.FileStatus != eFileStatus.UploadSucceed)
             {
-                XtraMessageBox.Show("姝ゅ姛鑳戒粎閫傜敤浜庝笂浼犳垚鍔熺殑妯″瀷鏂囦欢锛�");
+                MessageBoxHelper.ShowInfo("姝ゅ姛鑳戒粎閫傜敤浜庝笂浼犳垚鍔熺姸鎬佺殑妯″瀷鏂囦欢锛�");
                 return;
             }
-            if (vm.FormatType != eFormatType._3D)
+            if (vm.FormatType != eFormatType.d3)
             {
-                XtraMessageBox.Show("姝ゅ姛鑳戒粎閫傜敤浜�3D妯″瀷鏂囦欢锛�");
+                MessageBoxHelper.ShowInfo("姝ゅ姛鑳戒粎閫傜敤浜�3D妯″瀷鏂囦欢锛�");
                 return;
             }
             if (vm.FileSuffix.ToLower() != ".rvt")
             {
-                XtraMessageBox.Show("姝ゅ姛鑳戒粎閫傜敤浜巖vt妯″瀷鏂囦欢锛�");
+                MessageBoxHelper.ShowInfo("姝ゅ姛鑳戒粎閫傜敤浜巖vt妯″瀷鏂囦欢锛�");
                 return;
             }
-            var bimfaceClient = Yw.BIMFaceClient.Instance(Settings.BimfaceParasHelper.Bimface.AppKey, Settings.BimfaceParasHelper.Bimface.AppSecret);
-            var task = Task.Run(() => bimfaceClient.TranslateRvtFileReturnStatus(vm.BimfaceId, eRvtTranslateStyle.Real));
-            await task;
 
-            if (task.Result == eTranslateStatus.ProcessingStatus)
+            bool updateFileStatusResult = false;
+            var translateStatus = await BimfaceHelper.TranslateRvtFile(vm.BimfaceId);
+            if (translateStatus == eTranslateStatus.Processing)
             {
                 vm.FileStatus = eFileStatus.Converting;
-                this.bimfaceFileViewModelBindingSource.ResetBindings(false);
-                if (!await _bllBimfaceFile.Value.UpdateFileStatus(vm.ID, (int)vm.FileStatus))
+                this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
+                updateFileStatusResult = await _bllBimfaceFile.Value.UpdateFileStatus(vm.ID, (int)vm.FileStatus);
+                if (!updateFileStatusResult)
                 {
-                    this.FindForm().ShowAlertInfo("妯″瀷鏂囦欢杞崲", $"{vm.Name}:鏇存柊澶辫触");
+                    this.ShowAlertInfo("妯″瀷鏂囦欢杞崲", $"{vm.Name}:鏇存柊鏂囦欢鐘舵�佸け璐ワ紒");
                 }
-                this.FindForm().ShowAlertInfo("妯″瀷鏂囦欢杞崲鎻愮ず", "妯″瀷鏂囦欢杞崲鑰楁椂杈冮暱锛岃鑰愬績绛夊緟...");
 
-                var statusTask = Task.Run(async () =>
-                {
-                    while (vm.FileStatus == eFileStatus.Converting)
-                    {
-                        Thread.Sleep(3000);
-                        var result = await bimfaceClient.GetFileTranslateStatusReturnStatus(vm.BimfaceId);
-                        if (result == eTranslateStatus.ProcessingStatus)
-                        {
-                            vm.FileStatus = eFileStatus.ConvertSucceed;
-                        }
-                    }
-                });
-                await statusTask;
+                this.ShowAlertInfo("妯″瀷鏂囦欢杞崲鎻愮ず", "妯″瀷鏂囦欢杞崲鑰楁椂杈冮暱锛岃鑰愬績绛夊緟...");
+
+                await BimfaceHelper.WaitFileTranslateStatusUntilSuccess(vm.BimfaceId, 3000);
             }
+
             vm.FileStatus = eFileStatus.ConvertSucceed;
-            this.bimfaceFileViewModelBindingSource.ResetBindings(false);
-            if (!await _bllBimfaceFile.Value.UpdateFileStatus(vm.ID, (int)vm.FileStatus))
+            this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
+            updateFileStatusResult = await _bllBimfaceFile.Value.UpdateFileStatus(vm.ID, (int)vm.FileStatus);
+            if (!updateFileStatusResult)
             {
-                this.FindForm().ShowAlertInfo("妯″瀷鏂囦欢杞崲", $"{vm.Name}:鏇存柊澶辫触");
+                this.ShowAlertInfo("妯″瀷鏂囦欢杞崲", $"{vm.Name}:鏇存柊鏂囦欢鐘舵�佸け璐ワ紒");
             }
+
         }
 
         //缂栬緫
-        private void EidtBim()
+        private void Edit()
         {
-            //if (_allGetModels == null)
-            //    return;
-            //var getModel = GetCurrentModel();
-            //if (getModel.FileStatus == eFileStatus.涓婁紶涓�)
-            //{
-            //    XtraMessageBox.Show(eFileStatus.涓婁紶涓�.ToString());
-            //    return;
-            //}
-            //var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.BimFile4Get, Model.BimFile4Update>()).CreateMapper();
-            //var updateModel = mapper.Map<Model.BimFile4Get, Model.BimFile4Update>(getModel);
-            //var dlg = new EditBimFileBaseInfoDlg();
-            //dlg.SetBindingData(updateModel);
-            //dlg.ReloadDataEvent += (rhs) =>
-            //{
-            //    mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.BimFile4Update, Model.BimFile4Get>()).CreateMapper();
-            //    getModel = mapper.Map<Model.BimFile4Update, Model.BimFile4Get>(rhs, getModel);
-            //    this.gridView1.RefreshRow(this.gridView1.FocusedRowHandle);
-            //    XtraMessageBox.Show("鏇存柊鎴愬姛锛�");
-            //    PageDataSync<Model.BimFile4Get>.Commit(this, ePageDataOperation.Update, getModel);
-            //};
-            //dlg.ShowDialog();
+            var vm = GetCurrentViewModel();
+            if (vm == null)
+            {
+                return;
+            }
+            if (vm.FileStatus == eFileStatus.Uploading)
+            {
+                MessageBoxHelper.ShowWarning("涓婁紶涓殑妯″瀷鏂囦欢涓嶅彲缂栬緫");
+                return;
+            }
+            if (vm.FileStatus == eFileStatus.Converting)
+            {
+                MessageBoxHelper.ShowWarning("杞崲涓殑妯″瀷鏂囦欢涓嶅彲缂栬緫");
+                return;
+            }
+
+            var dlg = new EditBimfaceFileDlg();
+            dlg.SetBindingData(vm);
+            dlg.ReloadDataEvent += async (bimfaceFileId) =>
+            {
+                var dto = await _bllBimfaceFile.Value.GetByID(bimfaceFileId);
+                vm.Reset(dto);
+                this.gridView1.RefreshRow(this.gridView1.FocusedRowHandle);
+                XtraMessageBox.Show("鏇存柊鎴愬姛锛�");
+            };
+            dlg.ShowDialog();
         }
 
         //鍒犻櫎
-        private void DeleteBim()
+        private async void Delete()
         {
-            //if (_allGetModels == null)
-            //    return;
-            //var getModel = GetCurrentModel();
-            //if (getModel.FileStatus == eFileStatus.涓婁紶涓� || getModel.FileStatus == eFileStatus.杞崲涓�)
-            //{
-            //    XtraMessageBox.Show(getModel.FileStatus.ToString());
-            //    return;
-            //}
-            //if (DevExpress.XtraEditors.XtraMessageBox.Show("鏄惁瑕佸垹闄わ紵", "鎻愮ず", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
-            //{
-            //    if (!GlobelParas.BimfaceClient.DeleteFile(getModel.BimfaceID))
-            //    {
-            //        XtraMessageBox.Show("鍒犻櫎澶辫触锛�");
-            //        return;
-            //    }
-            //    if (!BLLFactory<BLL.BimFile>.Instance.DeleteByID(getModel.ID))
-            //    {
-            //        XtraMessageBox.Show("鍒犻櫎澶辫触锛�");
-            //        return;
-            //    }
-            //    _allGetModels.Remove(getModel);
-            //    this.bimFile4GetBindingSource.ResetBindings(false);
-            //    XtraMessageBox.Show("鍒犻櫎鎴愬姛锛�");
-            //    PageDataSync<Model.BimFile4Get>.Commit(this, ePageDataOperation.Delete, getModel);
-            //}
+            var vm = GetCurrentViewModel();
+            if (vm == null)
+            {
+                return;
+            }
+            if (vm.HasRelation)
+            {
+                MessageBoxHelper.ShowWarning("瀛樺湪鍏宠仈鍏崇郴锛屼笉鍙垹闄わ紒");
+                return;
+            }
+            if (vm.FileStatus == eFileStatus.Uploading)
+            {
+                MessageBoxHelper.ShowWarning("涓婁紶涓殑鏂囦欢涓嶈兘鍒犻櫎锛�");
+                return;
+            }
+            if (vm.FileStatus == eFileStatus.Converting)
+            {
+                MessageBoxHelper.ShowWarning("杞崲涓殑鏂囦欢涓嶈兘鍒犻櫎锛�");
+                return;
+            }
+
+            if (MessageBoxHelper.ShowQuestion("鏄惁纭畾鍒犻櫎锛�") == DialogResult.Yes)
+            {
+                var deleteResult = await BimfaceHelper.Delete(vm.BimfaceId);
+                if (!deleteResult)
+                {
+                    MessageBoxHelper.ShowError("Bimface鍒犻櫎澶辫触锛�");
+                    return;
+                }
+                deleteResult = await _bllBimfaceFile.Value.DeleteByID(vm.ID);
+                if (!deleteResult)
+                {
+                    MessageBoxHelper.ShowError("Bimface鏂囦欢鍒犻櫎澶辫触锛�");
+                    return;
+                }
+                _allBindingList.Remove(vm);
+                this.bimfaceFileMgrViewModelBindingSource.ResetBindings(false);
+                MessageBoxHelper.ShowSuccess("鍒犻櫎鎴愬姛锛�");
+            }
         }
 
         //鏄剧ず璇︾粏淇℃伅
         private void ShowDetail()
         {
-            XtraMessageBox.Show("寮�鍙戜腑...");
+            var vm = GetCurrentViewModel();
+            if (vm == null)
+            {
+                return;
+            }
+            MessageBoxHelper.ShowInfo("姝e湪寮�鍙戜腑...");
         }
 
         //鏈湴娴忚
-        private void ShowLocalView()
+        private async void ShowLocalView()
         {
-            //if (_allGetModels == null)
-            //    return;
-            //var getModel = GetCurrentModel();
-            //if (getModel == null)
-            //    return;
-            //new BimfaceViewHelper().ShowBimfaceLocalView(getModel, IsExistPage, CreatePage);
+            var vm = GetCurrentViewModel();
+            if (vm == null)
+            {
+                return;
+            }
+
+            var guid = new PageGuid()
+            {
+                Modular = Yw.WinFrmUI.PageModular.Bimface,
+                MoudingType = Yw.WinFrmUI.Page.eMoudingType.Tab,
+                Function = Yw.WinFrmUI.PageFunction.ViewBimface3d,
+                TagName = vm.ID.ToString()
+            };
+
+            if (!IsExistPage(guid, true))
+            {
+                var page = new Bimface3dViewPage();
+                await page.SetBindingData(vm.ID);
+                CreatePage(page, guid);
+            }
         }
 
         //缃戦〉娴忚
         private void ShowWebView()
         {
-            //if (_allGetModels == null)
-            //    return;
-            //var getModel = GetCurrentModel();
-            //if (getModel == null)
-            //    return;
-            //new BimfaceViewHelper().ShowBimfaceWebView(getModel);
+            var vm = GetCurrentViewModel();
+            if (vm == null)
+            {
+                return;
+            }
+            MessageBoxHelper.ShowInfo("姝e湪寮�鍙戜腑...");
         }
 
         //鎵嬫満娴忚
         private void ShowPhoneView()
         {
-            //if (_allGetModels == null)
-            //    return;
-            //var getModel = GetCurrentModel();
-            //if (getModel == null)
-            //    return;
-            //new BimfaceViewHelper().ShowBimfacePhoneView(getModel);
+            var vm = GetCurrentViewModel();
+            if (vm == null)
+            {
+                return;
+            }
+            MessageBoxHelper.ShowInfo("姝e湪寮�鍙戜腑...");
         }
 
         //鏄剧ず妯″瀷鏂囦欢璁剧疆鐣岄潰
         private void ShowBimFileSettings()
         {
-            //if (_allGetModels == null)
-            //    return;
-            //var getModel = GetCurrentModel();
-            //if (getModel == null)
-            //    return;
-            //new BimfaceViewHelper().ShowBimFileSettings(getModel, IsExistPage, CreatePage);
+            var vm = GetCurrentViewModel();
+            if (vm == null)
+            {
+                return;
+            }
+            MessageBoxHelper.ShowInfo("姝e湪寮�鍙戜腑...");
         }
 
 
@@ -454,46 +402,56 @@
 
 
         #region Ribbon
+
+        //娣诲姞
         private void barBtnAdminAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             Add();
         }
 
+        //涓婁紶
         private void barBtnUpload_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             Upload();
         }
 
+        //杞崲
         private void barBtnTranslate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-            TranslateBim();
+            Translate();
         }
 
+        //缂栬緫
         private void barBtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-            EidtBim();
+            Edit();
         }
 
+        //鍒犻櫎
         private void barBtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
-            DeleteBim();
+            Delete();
         }
 
+        //璇︾粏淇℃伅
         private void barBtnDetail_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             ShowDetail();
         }
 
+        //鏈湴瑙嗗浘
         private void barBtnLocal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             ShowLocalView();
         }
 
+        //缃戦〉瑙嗗浘
         private void barBtnWeb_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             ShowWebView();
         }
 
+        //鎵嬫満瑙嗗浘
         private void barBtnPhone_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
             ShowPhoneView();
@@ -505,18 +463,47 @@
             ShowBimFileSettings();
         }
 
+        //鍒锋柊鏁版嵁
         private void barBtnReloadData_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
         {
+            if (_allBindingList == null)
+            {
+                return;
+            }
+            if (_allBindingList.Exists(x => x.FileStatus == eFileStatus.Uploading || x.FileStatus == eFileStatus.Converting))
+            {
+                MessageBoxHelper.ShowWarning("姝e湪涓婁紶鎴栬浆鎹㈡ā鍨嬫枃浠讹紝璇风◢鍚庨噸璇曪紒");
+                return;
+            }
             RefreshData();
         }
 
-        private void gridControl1_Click(object sender, EventArgs e)
-        {
-
-        }
 
         #endregion
 
+        #region 褰撳墠
+
+        //鑾峰彇褰撳墠瑙嗗浘
+        private BimfaceFileMgrViewModel GetCurrentViewModel()
+        {
+            if (_allBindingList == null)
+            {
+                MessageBoxHelper.ShowError("鏁版嵁鍒濆鍖栧け璐�");
+                return null;
+            }
+            if (_allBindingList.Count < 1)
+            {
+                MessageBoxHelper.ShowInfo("鏁版嵁涓虹┖");
+            }
+            var vm = this.gridView1.GetCurrentViewModel(_allBindingList);
+            if (vm == null)
+            {
+                MessageBoxHelper.ShowWarning("璇烽�夋嫨鏁版嵁琛�");
+            }
+            return vm;
+        }
+
+        #endregion
 
 
 

--
Gitblit v1.9.3