From 6dad261c5671357bbb7f056898b572398293f6fe Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期五, 26 七月 2024 14:53:11 +0800 Subject: [PATCH] 界面修改 --- WinFrmUI/Yw.WinFrmUI.Bimface.Core/Properties/DataSources/Yw.WinFrmUI.BimfaceFileMgrViewModel.datasource | 10 WinFrmUI/Yw.WinFrmUI.Core/05-alert/AlertToolHelper.cs | 12 WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.cs | 2 WinFrmUI/Yw.WinFrmUI.Core/00-core/MessageBoxHelper.cs | 107 ++++ WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.resx | 123 ++++ WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrViewModel.cs | 42 + WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.resx | 3 WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.resx | 3 WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.Designer.cs | 70 ++ WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.cs | 54 ++ WinFrmUI/Yw.WinFrmUI.Bimface.Core/Yw.WinFrmUI.Bimface.Core.csproj.user | 3 WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/BimfaceHelper.cs | 63 ++ WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.Designer.cs | 94 +- WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.Designer.cs | 219 +++++++- WinFrmUI/Yw.WinFrmUI.Core/06-document/PageModular.cs | 18 WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.resx | 5 Service/HStation.Service.Revit.Core/02-parter/01-interface/01-node/IRevitTank.cs | 4 WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs | 2 WinFrmUI/Yw.WinFrmUI.Core/06-document/PageFunction.cs | 13 WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.cs | 1 /dev/null | 10 WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.cs | 122 +++ WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.Designer.cs | 58 + WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.Designer.cs | 9 Service/HStation.Service.Revit.Core/02-parter/00-core/RevitPosition.cs | 4 WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.Designer.cs | 51 + WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs | 431 ++++++++-------- 27 files changed, 1,164 insertions(+), 369 deletions(-) diff --git a/Service/HStation.Service.Revit.Core/02-parter/00-core/RevitPosition.cs b/Service/HStation.Service.Revit.Core/02-parter/00-core/RevitPosition.cs index 54d8c9f..978facf 100644 --- a/Service/HStation.Service.Revit.Core/02-parter/00-core/RevitPosition.cs +++ b/Service/HStation.Service.Revit.Core/02-parter/00-core/RevitPosition.cs @@ -34,8 +34,6 @@ this.Z = rhs.Z; } - - /// <summary> /// X /// </summary> @@ -51,4 +49,6 @@ /// </summary> public double Z { get; set; } } + + } diff --git a/Service/HStation.Service.Revit.Core/02-parter/01-interface/01-node/IRevitTank.cs b/Service/HStation.Service.Revit.Core/02-parter/01-interface/01-node/IRevitTank.cs index cabbac3..ed9a087 100644 --- a/Service/HStation.Service.Revit.Core/02-parter/01-interface/01-node/IRevitTank.cs +++ b/Service/HStation.Service.Revit.Core/02-parter/01-interface/01-node/IRevitTank.cs @@ -10,10 +10,6 @@ /// </summary> public interface IRevitTank : IRevitNode { - ///// <summary> - ///// 姹犲簳鏍囬珮 (2024-7-25 lxj 娉ㄩ噴) - ///// </summary> - //double Elev { get; set; } /// <summary> /// 鍒濆姘翠綅 diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.Designer.cs index c402f52..dfd9a3d 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.Designer.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.Designer.cs @@ -50,6 +50,7 @@ layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem(); layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); dockManager1 = new DevExpress.XtraBars.Docking.DockManager(components); + svgImg32 = new DevExpress.Utils.SvgImageCollection(components); ((ISupportInitialize)layoutControl1).BeginInit(); layoutControl1.SuspendLayout(); mapViewProjectListContainer1.SuspendLayout(); @@ -61,6 +62,7 @@ ((ISupportInitialize)layoutControlItem1).BeginInit(); ((ISupportInitialize)layoutControlItem2).BeginInit(); ((ISupportInitialize)dockManager1).BeginInit(); + ((ISupportInitialize)svgImg32).BeginInit(); SuspendLayout(); // // layoutControl1 @@ -247,6 +249,11 @@ dockManager1.RootPanels.AddRange(new DevExpress.XtraBars.Docking.DockPanel[] { docPnlProject, docPnlProperty }); dockManager1.TopZIndexControls.AddRange(new string[] { "DevExpress.XtraBars.BarDockControl", "DevExpress.XtraBars.StandaloneBarDockControl", "System.Windows.Forms.MenuStrip", "System.Windows.Forms.StatusStrip", "System.Windows.Forms.StatusBar", "DevExpress.XtraBars.Ribbon.RibbonStatusBar", "DevExpress.XtraBars.Ribbon.RibbonControl", "DevExpress.XtraBars.Navigation.OfficeNavigationBar", "DevExpress.XtraBars.Navigation.TileNavPane", "DevExpress.XtraBars.TabFormControl", "DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormControl", "DevExpress.XtraBars.ToolbarForm.ToolbarFormControl" }); // + // svgImg32 + // + svgImg32.ImageSize = new Size(32, 32); + svgImg32.Add("bo_address", "image://svgimages/business objects/bo_address.svg"); + // // HomeXhsProjectPage // Appearance.BackColor = SystemColors.Control; @@ -267,6 +274,7 @@ ((ISupportInitialize)layoutControlItem1).EndInit(); ((ISupportInitialize)layoutControlItem2).EndInit(); ((ISupportInitialize)dockManager1).EndInit(); + ((ISupportInitialize)svgImg32).EndInit(); ResumeLayout(false); } @@ -287,5 +295,6 @@ private HomeXhsProjectTreeListCtrl homeXhsProjectTreeListCtrl1; private DevExpress.XtraBars.Docking.DockManager dockManager1; private HomeXhsProjectPropertyCtrl homeXhsProjectPropertyCtrl1; + private DevExpress.Utils.SvgImageCollection svgImg32; } } diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.cs index 9ef0baf..e1b7aeb 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.cs @@ -7,6 +7,8 @@ InitializeComponent(); this.layoutControl1.SetupLayoutControl(); this.PageTitle.Caption = "棣栭〉"; + this.PageTitle.HeaderSvgImage = this.svgImg32[0]; + this.PageTitle.SvgImageSize = new Size(24, 24); this.PageTitle.AllowClose = false; } diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.resx b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.resx index c4e0345..bf1396d 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.resx +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/01-home/HomeXhsProjectPage.resx @@ -147,4 +147,7 @@ <metadata name="dockManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="svgImg32.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>161, 17</value> + </metadata> </root> \ No newline at end of file diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.Designer.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.Designer.cs index 10b73ee..1d77e21 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.Designer.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.Designer.cs @@ -43,6 +43,7 @@ barBtnExpandAll = new DevExpress.XtraBars.BarButtonItem(); barBtnCollpseAll = new DevExpress.XtraBars.BarButtonItem(); barBtnSearch = new DevExpress.XtraBars.BarButtonItem(); + barBtnRefresh = new DevExpress.XtraBars.BarButtonItem(); ribbonPage1 = new DevExpress.XtraBars.Ribbon.RibbonPage(); ribPageGroupForBasic = new DevExpress.XtraBars.Ribbon.RibbonPageGroup(); ribPageGroupForOperation = new DevExpress.XtraBars.Ribbon.RibbonPageGroup(); @@ -61,17 +62,21 @@ colTagName = new DevExpress.XtraTreeList.Columns.TreeListColumn(); colDescription = new DevExpress.XtraTreeList.Columns.TreeListColumn(); xhsProjectMgrViewModelBindingSource = new BindingSource(components); - barBtnRefresh = new DevExpress.XtraBars.BarButtonItem(); + panelControl1 = new DevExpress.XtraEditors.PanelControl(); + svgImg32 = new DevExpress.Utils.SvgImageCollection(components); ((ISupportInitialize)ribbonControl1).BeginInit(); ((ISupportInitialize)treeList1).BeginInit(); ((ISupportInitialize)xhsProjectMgrViewModelBindingSource).BeginInit(); + ((ISupportInitialize)panelControl1).BeginInit(); + panelControl1.SuspendLayout(); + ((ISupportInitialize)svgImg32).BeginInit(); SuspendLayout(); // // ribbonControl1 // ribbonControl1.ExpandCollapseItem.Id = 0; ribbonControl1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { ribbonControl1.ExpandCollapseItem, barBtnAdd, barBtnEdit, barBtnDelete, barBtnInfo, barBtnViewHydro, barBtnViewBimface, barBtnPublish, barBtnDeprecated, barCkTreeLine, barBtnExpandAll, barBtnCollpseAll, barBtnSearch, barBtnRefresh }); - ribbonControl1.Location = new Point(0, 0); + ribbonControl1.Location = new Point(1, 1); ribbonControl1.MaxItemId = 14; ribbonControl1.Name = "ribbonControl1"; ribbonControl1.Pages.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPage[] { ribbonPage1 }); @@ -79,7 +84,7 @@ ribbonControl1.ShowExpandCollapseButton = DevExpress.Utils.DefaultBoolean.False; ribbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.ShowOnMultiplePages; ribbonControl1.ShowToolbarCustomizeItem = false; - ribbonControl1.Size = new Size(998, 128); + ribbonControl1.Size = new Size(996, 128); ribbonControl1.Toolbar.ShowCustomizeItem = false; ribbonControl1.ToolbarLocation = DevExpress.XtraBars.Ribbon.RibbonQuickAccessToolbarLocation.Hidden; // @@ -173,6 +178,14 @@ barBtnSearch.Name = "barBtnSearch"; barBtnSearch.ItemClick += barBtnSearch_ItemClick; // + // barBtnRefresh + // + barBtnRefresh.Caption = "鍒锋柊"; + barBtnRefresh.Id = 13; + barBtnRefresh.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("barBtnRefresh.ImageOptions.SvgImage"); + barBtnRefresh.Name = "barBtnRefresh"; + barBtnRefresh.ItemClick += barBtnRefresh_ItemClick; + // // ribbonPage1 // ribbonPage1.Groups.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPageGroup[] { ribPageGroupForBasic, ribPageGroupForOperation, ribPageGroupForHydro, ribPageGroupBimface, ribPageGroupForMore }); @@ -222,10 +235,10 @@ treeList1.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] { colNO, colName, colStartTime, colEndTime, colPublishStatus, colAddress, colCustomer, colFlags, colTagName, colDescription }); treeList1.DataSource = xhsProjectMgrViewModelBindingSource; treeList1.Dock = DockStyle.Fill; - treeList1.Location = new Point(0, 128); + treeList1.Location = new Point(0, 1); treeList1.MenuManager = ribbonControl1; treeList1.Name = "treeList1"; - treeList1.Size = new Size(998, 542); + treeList1.Size = new Size(996, 539); treeList1.TabIndex = 1; // // colNO @@ -302,13 +315,21 @@ // xhsProjectMgrViewModelBindingSource.DataSource = typeof(XhsProjectMgrViewModel); // - // barBtnRefresh + // panelControl1 // - barBtnRefresh.Caption = "鍒锋柊"; - barBtnRefresh.Id = 13; - barBtnRefresh.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("barBtnRefresh.ImageOptions.SvgImage"); - barBtnRefresh.Name = "barBtnRefresh"; - barBtnRefresh.ItemClick += barBtnRefresh_ItemClick; + panelControl1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; + panelControl1.Controls.Add(treeList1); + panelControl1.Dock = DockStyle.Fill; + panelControl1.Location = new Point(1, 129); + panelControl1.Name = "panelControl1"; + panelControl1.Padding = new Padding(0, 1, 0, 0); + panelControl1.Size = new Size(996, 540); + panelControl1.TabIndex = 3; + // + // svgImg32 + // + svgImg32.ImageSize = new Size(32, 32); + svgImg32.Add("productquickshippments", "image://svgimages/outlook inspired/productquickshippments.svg"); // // XhsProjectMgrPage // @@ -316,13 +337,17 @@ Appearance.Options.UseBackColor = true; AutoScaleDimensions = new SizeF(7F, 14F); AutoScaleMode = AutoScaleMode.Font; - Controls.Add(treeList1); + Controls.Add(panelControl1); Controls.Add(ribbonControl1); Name = "XhsProjectMgrPage"; + Padding = new Padding(1); Size = new Size(998, 670); ((ISupportInitialize)ribbonControl1).EndInit(); ((ISupportInitialize)treeList1).EndInit(); ((ISupportInitialize)xhsProjectMgrViewModelBindingSource).EndInit(); + ((ISupportInitialize)panelControl1).EndInit(); + panelControl1.ResumeLayout(false); + ((ISupportInitialize)svgImg32).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -361,5 +386,7 @@ private DevExpress.XtraBars.BarButtonItem barBtnCollpseAll; private DevExpress.XtraBars.BarButtonItem barBtnSearch; private DevExpress.XtraBars.BarButtonItem barBtnRefresh; + private DevExpress.XtraEditors.PanelControl panelControl1; + private DevExpress.Utils.SvgImageCollection svgImg32; } } diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs index 29e0e0b..4d18c6a 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs @@ -10,6 +10,8 @@ InitializeComponent(); this.treeList1.InitialMultiColSettings(); this.PageTitle.Caption = "椤圭洰绠$悊"; + this.PageTitle.HeaderSvgImage = this.svgImg32[0]; + this.PageTitle.SvgImageSize = new Size(24, 24); } private List<XhsProjectMgrViewModel> _allProjectList = null; diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.resx b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.resx index 74b44cc..2c7cafb 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.resx +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.resx @@ -385,4 +385,7 @@ <metadata name="xhsProjectMgrViewModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="svgImg32.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>305, 17</value> + </metadata> </root> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/BimfaceHelper.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/BimfaceHelper.cs index 24f3492..67ab899 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/BimfaceHelper.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/BimfaceHelper.cs @@ -21,15 +21,16 @@ /// 涓婁紶鏂囦欢 /// </summary> /// <param name="fullFilePath">鏂囦欢鍏ㄨ矾寰�</param> + /// <param name="fileName">鏂囦欢鍚嶇О</param> /// <returns>BimfaceId</returns> - public static async Task<long> UploadFile(string fullFilePath) + public static async Task<long> UploadFile(string fullFilePath, string fileName = null) { if (!File.Exists(fullFilePath)) { return default; } var bimfaceClient = Yw.BIMFaceClient.Instance(ConfigHelper.AppKey, ConfigHelper.AppSecret); - var bimfaceId = await bimfaceClient.UploadFileExByPolicy(fullFilePath); + var bimfaceId = await bimfaceClient.UploadFileExByPolicy(fullFilePath, fileName); return bimfaceId; } @@ -43,6 +44,19 @@ { var bimfaceClient = Yw.BIMFaceClient.Instance(ConfigHelper.AppKey, ConfigHelper.AppSecret); var fileStatus = await bimfaceClient.TranslateRvtFileReturnStatus(bimfaceId.ToString(), translateStyle); + return fileStatus; + } + + /// <summary> + /// 杞崲rvt鏂囦欢 + /// </summary> + /// <param name="bimfaceId">bimfaceId</param> + /// <param name="translateStyle">杞崲鏍峰紡</param> + /// <returns>杞崲鐘舵��</returns> + public static async Task<eTranslateStatus> TranslateRvtFile(string bimfaceId, eRvtTranslateStyle translateStyle = eRvtTranslateStyle.Real) + { + var bimfaceClient = Yw.BIMFaceClient.Instance(ConfigHelper.AppKey, ConfigHelper.AppSecret); + var fileStatus = await bimfaceClient.TranslateRvtFileReturnStatus(bimfaceId, translateStyle); return fileStatus; } @@ -81,7 +95,52 @@ } } + /// <summary> + /// 绛夊緟鏂囦欢杞崲鐘舵�佺洿鍒版垚鍔� + /// </summary> + /// <param name="bimfaceId">bimfaceId</param> + /// <param name="polling">杞姣</param> + /// <returns></returns> + public static async Task WaitFileTranslateStatusUntilSuccess(string bimfaceId, int polling) + { + var bimfaceClient = Yw.BIMFaceClient.Instance(ConfigHelper.AppKey, ConfigHelper.AppSecret); + var fileStatus = await bimfaceClient.GetFileTranslateStatusReturnStatus(bimfaceId); + if (fileStatus == eTranslateStatus.Processing) + { + await Task.Run(async () => + { + while (fileStatus == eTranslateStatus.Processing) + { + Thread.Sleep(polling); + fileStatus = await bimfaceClient.GetFileTranslateStatusReturnStatus(bimfaceId); + } + }); + } + } + /// <summary> + /// 鍒犻櫎 + /// </summary> + /// <param name="bimfaceId">bimfaceId</param> + /// <param name="modelIdType">妯″瀷绫诲瀷</param> + /// <returns></returns> + public static async Task<bool> Delete(long bimfaceId, Yw.BIMFace.eModelIdType modelIdType = eModelIdType.fileId) + { + var bimfaceClient = Yw.BIMFaceClient.Instance(ConfigHelper.AppKey, ConfigHelper.AppSecret); + return await bimfaceClient.Delete(bimfaceId.ToString(), modelIdType); + } + + /// <summary> + /// 鍒犻櫎 + /// </summary> + /// <param name="bimfaceId">bimfaceId</param> + /// <param name="modelIdType">妯″瀷绫诲瀷</param> + /// <returns></returns> + public static async Task<bool> Delete(string bimfaceId, Yw.BIMFace.eModelIdType modelIdType = eModelIdType.fileId) + { + var bimfaceClient = Yw.BIMFaceClient.Instance(ConfigHelper.AppKey, ConfigHelper.AppSecret); + return await bimfaceClient.Delete(bimfaceId, modelIdType); + } } } diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.Designer.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.Designer.cs index 586189f..3a82edc 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.Designer.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.Designer.cs @@ -94,68 +94,68 @@ layoutControl1.Location = new Point(0, 0); layoutControl1.Name = "layoutControl1"; layoutControl1.Root = layoutControlGroup1; - layoutControl1.Size = new Size(493, 432); + layoutControl1.Size = new Size(448, 468); layoutControl1.TabIndex = 0; layoutControl1.Text = "layoutControl1"; // // txtExtension // - txtExtension.Location = new Point(83, 60); + txtExtension.Location = new Point(88, 156); txtExtension.Name = "txtExtension"; - txtExtension.Size = new Size(398, 20); + txtExtension.Size = new Size(348, 20); txtExtension.StyleController = layoutControl1; txtExtension.TabIndex = 21; // // txtFileSize // - txtFileSize.Location = new Point(83, 156); + txtFileSize.Location = new Point(88, 132); txtFileSize.Name = "txtFileSize"; - txtFileSize.Size = new Size(398, 20); + txtFileSize.Size = new Size(348, 20); txtFileSize.StyleController = layoutControl1; txtFileSize.TabIndex = 18; // // imgCmbFormatType // - imgCmbFormatType.Location = new Point(83, 108); + imgCmbFormatType.Location = new Point(88, 84); imgCmbFormatType.Name = "imgCmbFormatType"; imgCmbFormatType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); - imgCmbFormatType.Size = new Size(398, 20); + imgCmbFormatType.Size = new Size(348, 20); imgCmbFormatType.StyleController = layoutControl1; imgCmbFormatType.TabIndex = 17; // // imgCmbFileStatus // - imgCmbFileStatus.Location = new Point(83, 132); + imgCmbFileStatus.Location = new Point(88, 108); imgCmbFileStatus.Name = "imgCmbFileStatus"; imgCmbFileStatus.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); - imgCmbFileStatus.Size = new Size(398, 20); + imgCmbFileStatus.Size = new Size(348, 20); imgCmbFileStatus.StyleController = layoutControl1; imgCmbFileStatus.TabIndex = 16; // // imgCmbBimfaceModelType // - imgCmbBimfaceModelType.Location = new Point(83, 84); + imgCmbBimfaceModelType.Location = new Point(88, 60); imgCmbBimfaceModelType.Name = "imgCmbBimfaceModelType"; imgCmbBimfaceModelType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); - imgCmbBimfaceModelType.Size = new Size(398, 20); + imgCmbBimfaceModelType.Size = new Size(348, 20); imgCmbBimfaceModelType.StyleController = layoutControl1; imgCmbBimfaceModelType.TabIndex = 15; // // txtBimFaceFileID // - txtBimFaceFileID.Location = new Point(83, 12); + txtBimFaceFileID.Location = new Point(88, 12); txtBimFaceFileID.Name = "txtBimFaceFileID"; txtBimFaceFileID.Properties.Mask.EditMask = "N00"; txtBimFaceFileID.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; - txtBimFaceFileID.Size = new Size(398, 20); + txtBimFaceFileID.Size = new Size(348, 20); txtBimFaceFileID.StyleController = layoutControl1; txtBimFaceFileID.TabIndex = 14; // // txtDescription // - txtDescription.Location = new Point(83, 180); + txtDescription.Location = new Point(88, 180); txtDescription.Name = "txtDescription"; - txtDescription.Size = new Size(398, 214); + txtDescription.Size = new Size(348, 250); txtDescription.StyleController = layoutControl1; txtDescription.TabIndex = 13; // @@ -164,7 +164,7 @@ btnCancel.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Warning; btnCancel.Appearance.Options.UseBackColor = true; btnCancel.DialogResult = DialogResult.Cancel; - btnCancel.Location = new Point(394, 398); + btnCancel.Location = new Point(349, 434); btnCancel.Name = "btnCancel"; btnCancel.Size = new Size(87, 22); btnCancel.StyleController = layoutControl1; @@ -175,7 +175,7 @@ // btnOk.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Primary; btnOk.Appearance.Options.UseBackColor = true; - btnOk.Location = new Point(303, 398); + btnOk.Location = new Point(258, 434); btnOk.Name = "btnOk"; btnOk.Size = new Size(87, 22); btnOk.StyleController = layoutControl1; @@ -185,9 +185,9 @@ // // txtFileName // - txtFileName.Location = new Point(83, 36); + txtFileName.Location = new Point(88, 36); txtFileName.Name = "txtFileName"; - txtFileName.Size = new Size(398, 20); + txtFileName.Size = new Size(348, 20); txtFileName.StyleController = layoutControl1; txtFileName.TabIndex = 4; // @@ -199,21 +199,21 @@ layoutControlGroup1.GroupBordersVisible = false; layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { emptySpaceItem1, layoutControlItem3, layoutControlItem2, layoutControlItem5, layoutControlItem4, layoutControlItem7, layoutControlItem8, layoutControlItem1, layoutControlItem6, layoutControlItem9, layoutControlItem12 }); layoutControlGroup1.Name = "layoutControlGroup1"; - layoutControlGroup1.Size = new Size(493, 432); + layoutControlGroup1.Size = new Size(448, 468); layoutControlGroup1.TextVisible = false; // // emptySpaceItem1 // emptySpaceItem1.AllowHotTrack = false; - emptySpaceItem1.Location = new Point(0, 386); + emptySpaceItem1.Location = new Point(0, 422); emptySpaceItem1.Name = "emptySpaceItem1"; - emptySpaceItem1.Size = new Size(291, 26); + emptySpaceItem1.Size = new Size(246, 26); emptySpaceItem1.TextSize = new Size(0, 0); // // layoutControlItem3 // layoutControlItem3.Control = btnCancel; - layoutControlItem3.Location = new Point(382, 386); + layoutControlItem3.Location = new Point(337, 422); layoutControlItem3.MaxSize = new Size(91, 26); layoutControlItem3.MinSize = new Size(91, 26); layoutControlItem3.Name = "layoutControlItem3"; @@ -225,7 +225,7 @@ // layoutControlItem2 // layoutControlItem2.Control = btnOk; - layoutControlItem2.Location = new Point(291, 386); + layoutControlItem2.Location = new Point(246, 422); layoutControlItem2.MaxSize = new Size(91, 26); layoutControlItem2.MinSize = new Size(91, 26); layoutControlItem2.Name = "layoutControlItem2"; @@ -239,9 +239,9 @@ layoutControlItem5.Control = txtDescription; layoutControlItem5.Location = new Point(0, 168); layoutControlItem5.Name = "layoutControlItem5"; - layoutControlItem5.Size = new Size(473, 218); + layoutControlItem5.Size = new Size(428, 254); layoutControlItem5.Text = "璇存槑:"; - layoutControlItem5.TextSize = new Size(59, 14); + layoutControlItem5.TextSize = new Size(64, 14); // // layoutControlItem4 // @@ -249,29 +249,29 @@ layoutControlItem4.Control = txtBimFaceFileID; layoutControlItem4.Location = new Point(0, 0); layoutControlItem4.Name = "layoutControlItem4"; - layoutControlItem4.Size = new Size(473, 24); - layoutControlItem4.Text = "<color=red>*</color>鏂囦欢ID:"; - layoutControlItem4.TextSize = new Size(59, 14); + layoutControlItem4.Size = new Size(428, 24); + layoutControlItem4.Text = "<color=red>*</color>BimfaceId:"; + layoutControlItem4.TextSize = new Size(64, 14); // // layoutControlItem7 // layoutControlItem7.AllowHtmlStringInCaption = true; layoutControlItem7.Control = imgCmbFileStatus; - layoutControlItem7.Location = new Point(0, 120); + layoutControlItem7.Location = new Point(0, 96); layoutControlItem7.Name = "layoutControlItem7"; - layoutControlItem7.Size = new Size(473, 24); + layoutControlItem7.Size = new Size(428, 24); layoutControlItem7.Text = "<color=red>*</color>鏂囦欢鐘舵��:"; - layoutControlItem7.TextSize = new Size(59, 14); + layoutControlItem7.TextSize = new Size(64, 14); // // layoutControlItem8 // layoutControlItem8.AllowHtmlStringInCaption = true; layoutControlItem8.Control = imgCmbFormatType; - layoutControlItem8.Location = new Point(0, 96); + layoutControlItem8.Location = new Point(0, 72); layoutControlItem8.Name = "layoutControlItem8"; - layoutControlItem8.Size = new Size(473, 24); + layoutControlItem8.Size = new Size(428, 24); layoutControlItem8.Text = "<color=red>*</color>鏂囦欢鏍煎紡:"; - layoutControlItem8.TextSize = new Size(59, 14); + layoutControlItem8.TextSize = new Size(64, 14); // // layoutControlItem1 // @@ -279,38 +279,38 @@ layoutControlItem1.Control = txtFileName; layoutControlItem1.Location = new Point(0, 24); layoutControlItem1.Name = "layoutControlItem1"; - layoutControlItem1.Size = new Size(473, 24); + layoutControlItem1.Size = new Size(428, 24); layoutControlItem1.Text = "<color=red>*</color>鏂囦欢鍚嶇О:"; - layoutControlItem1.TextSize = new Size(59, 14); + layoutControlItem1.TextSize = new Size(64, 14); // // layoutControlItem6 // layoutControlItem6.AllowHtmlStringInCaption = true; layoutControlItem6.Control = imgCmbBimfaceModelType; - layoutControlItem6.Location = new Point(0, 72); + layoutControlItem6.Location = new Point(0, 48); layoutControlItem6.Name = "layoutControlItem6"; - layoutControlItem6.Size = new Size(473, 24); + layoutControlItem6.Size = new Size(428, 24); layoutControlItem6.Text = "<color=red>*</color>妯″瀷绫诲瀷:"; - layoutControlItem6.TextSize = new Size(59, 14); + layoutControlItem6.TextSize = new Size(64, 14); // // layoutControlItem9 // layoutControlItem9.Control = txtFileSize; - layoutControlItem9.Location = new Point(0, 144); + layoutControlItem9.Location = new Point(0, 120); layoutControlItem9.Name = "layoutControlItem9"; - layoutControlItem9.Size = new Size(473, 24); + layoutControlItem9.Size = new Size(428, 24); layoutControlItem9.Text = "鏂囦欢澶у皬:"; - layoutControlItem9.TextSize = new Size(59, 14); + layoutControlItem9.TextSize = new Size(64, 14); // // layoutControlItem12 // layoutControlItem12.AllowHtmlStringInCaption = true; layoutControlItem12.Control = txtExtension; - layoutControlItem12.Location = new Point(0, 48); + layoutControlItem12.Location = new Point(0, 144); layoutControlItem12.Name = "layoutControlItem12"; - layoutControlItem12.Size = new Size(473, 24); + layoutControlItem12.Size = new Size(428, 24); layoutControlItem12.Text = "<color=red>*</color>鎵╁睍鍚�:"; - layoutControlItem12.TextSize = new Size(59, 14); + layoutControlItem12.TextSize = new Size(64, 14); // // dxErrorProvider1 // @@ -320,7 +320,7 @@ // AutoScaleDimensions = new SizeF(7F, 14F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(493, 432); + ClientSize = new Size(448, 468); Controls.Add(layoutControl1); Name = "AddBimfaceFileDlg"; StartPosition = FormStartPosition.CenterParent; diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.cs index fbc8f2c..506680e 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/AddBimfaceFileDlg.cs @@ -61,7 +61,6 @@ this.imgCmbFormatType.Properties.EndUpdate(); } - //楠岃瘉 private bool Valid() { diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.Designer.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.Designer.cs new file mode 100644 index 0000000..842682b --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.Designer.cs @@ -0,0 +1,70 @@ +锘縩amespace Yw.WinFrmUI +{ + partial class Bimface3dViewPage + { + /// <summary> + /// 蹇呴渶鐨勮璁″櫒鍙橀噺銆� + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// 娓呯悊鎵�鏈夋鍦ㄤ娇鐢ㄧ殑璧勬簮銆� + /// </summary> + /// <param name="disposing">濡傛灉搴旈噴鏀炬墭绠¤祫婧愶紝涓� true锛涘惁鍒欎负 false銆�</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 缁勪欢璁捐鍣ㄧ敓鎴愮殑浠g爜 + + /// <summary> + /// 璁捐鍣ㄦ敮鎸佹墍闇�鐨勬柟娉� - 涓嶈淇敼 + /// 浣跨敤浠g爜缂栬緫鍣ㄤ慨鏀规鏂规硶鐨勫唴瀹广�� + /// </summary> + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + bimfaceInterop3dContainer1 = new BimfaceInterop3dContainer(); + svgImg32 = new DevExpress.Utils.SvgImageCollection(components); + ((System.ComponentModel.ISupportInitialize)svgImg32).BeginInit(); + SuspendLayout(); + // + // bimfaceInterop3dContainer1 + // + bimfaceInterop3dContainer1.Dock = DockStyle.Fill; + bimfaceInterop3dContainer1.Location = new Point(0, 0); + bimfaceInterop3dContainer1.Margin = new Padding(4, 3, 4, 3); + bimfaceInterop3dContainer1.Name = "bimfaceInterop3dContainer1"; + bimfaceInterop3dContainer1.Size = new Size(289, 157); + bimfaceInterop3dContainer1.TabIndex = 0; + // + // svgImg32 + // + svgImg32.Add("bletter", "image://svgimages/outlook inspired/bletter.svg"); + svgImg32.Add("bold", "image://svgimages/outlook inspired/bold.svg"); + // + // Bimface3dViewPage + // + Appearance.BackColor = SystemColors.Control; + Appearance.Options.UseBackColor = true; + AutoScaleDimensions = new SizeF(7F, 14F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(bimfaceInterop3dContainer1); + Margin = new Padding(3, 2, 3, 2); + Name = "Bimface3dViewPage"; + Size = new Size(289, 157); + ((System.ComponentModel.ISupportInitialize)svgImg32).EndInit(); + ResumeLayout(false); + } + + #endregion + + private BimfaceInterop3dContainer bimfaceInterop3dContainer1; + private DevExpress.Utils.SvgImageCollection svgImg32; + } +} diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.cs new file mode 100644 index 0000000..bf00227 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.cs @@ -0,0 +1,54 @@ +锘縩amespace Yw.WinFrmUI +{ + public partial class Bimface3dViewPage : DocumentPage + { + public Bimface3dViewPage() + { + InitializeComponent(); + this.PageTitle.Caption = "妯″瀷瑙嗗浘"; + this.PageTitle.HeaderSvgImage = this.svgImg32[1]; + this.PageTitle.SvgImageSize = new Size(24, 24); + } + + private Lazy<Yw.BLL.BimfaceFileStd> _bllBimfaceFileStd = new(() => new Yw.BLL.BimfaceFileStd()); + private long _bimfaceFileId;//bimface鏂囦欢id + private Yw.Dto.BimfaceFileStdDto _bimfaceFile = null;//bimface鏂囦欢 + + /// <summary> + /// 缁戝畾鏁版嵁 + /// </summary> + /// <param name="bimfaceFileId"></param> + public async Task SetBindingData(long bimfaceFileId) + { + _bimfaceFileId = bimfaceFileId; + _bimfaceFile = await _bllBimfaceFileStd.Value.GetByID(bimfaceFileId); + this.PageTitle.Caption = $"{_bimfaceFile.Name}\r\n妯″瀷瑙嗗浘"; + } + + /// <summary> + /// 鍒濆鍖栨暟鎹簮 + /// </summary> + public override async void InitialDataSource() + { + base.InitialDataSource(); + this.bimfaceInterop3dContainer1.LoadCompletedEvent += BimfaceInterop3dContainer1_LoadCompletedEvent; + await this.bimfaceInterop3dContainer1.InitialContainer(); + } + + //椤甸潰鍔犺浇瀹屾垚 + private async void BimfaceInterop3dContainer1_LoadCompletedEvent() + { + if (_bimfaceFile == null) + { + SpinWait.SpinUntil(() => _bimfaceFile != null, 3000); + } + if (_bimfaceFile == null) + { + return; + } + var viewToken = await BimfaceHelper.GetViewToken(_bimfaceFile.BimfaceId); + await this.bimfaceInterop3dContainer1.LoadView(viewToken); + } + + } +} diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.resx b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.resx new file mode 100644 index 0000000..b7016da --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/Bimface3dViewPage.resx @@ -0,0 +1,123 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="svgImg32.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.Designer.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.Designer.cs index 2162bc9..c2ac6d1 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.Designer.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.Designer.cs @@ -31,7 +31,7 @@ components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BimfaceFileMgrPage)); gridControl1 = new DevExpress.XtraGrid.GridControl(); - bimfaceFileViewModelBindingSource = new BindingSource(components); + bimfaceFileMgrViewModelBindingSource = new BindingSource(components); gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView(); colBimfaceId = new DevExpress.XtraGrid.Columns.GridColumn(); colName = new DevExpress.XtraGrid.Columns.GridColumn(); @@ -62,31 +62,35 @@ ribPageGrpView = new DevExpress.XtraBars.Ribbon.RibbonPageGroup(); ribPageGrpSet = new DevExpress.XtraBars.Ribbon.RibbonPageGroup(); ribPageGrpMore = new DevExpress.XtraBars.Ribbon.RibbonPageGroup(); + svgImage32 = new DevExpress.Utils.SvgImageCollection(components); + panelControl1 = new PanelControl(); ((System.ComponentModel.ISupportInitialize)gridControl1).BeginInit(); - ((System.ComponentModel.ISupportInitialize)bimfaceFileViewModelBindingSource).BeginInit(); + ((System.ComponentModel.ISupportInitialize)bimfaceFileMgrViewModelBindingSource).BeginInit(); ((System.ComponentModel.ISupportInitialize)gridView1).BeginInit(); ((System.ComponentModel.ISupportInitialize)repositoryItemButtonEdit1).BeginInit(); ((System.ComponentModel.ISupportInitialize)ribbonControl1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)svgImage32).BeginInit(); + ((System.ComponentModel.ISupportInitialize)panelControl1).BeginInit(); + panelControl1.SuspendLayout(); SuspendLayout(); // // gridControl1 // - gridControl1.DataSource = bimfaceFileViewModelBindingSource; + gridControl1.DataSource = bimfaceFileMgrViewModelBindingSource; gridControl1.Dock = DockStyle.Fill; gridControl1.EmbeddedNavigator.Margin = new Padding(3, 1, 3, 1); - gridControl1.Location = new Point(0, 128); + gridControl1.Location = new Point(0, 1); gridControl1.MainView = gridView1; gridControl1.Margin = new Padding(3, 2, 3, 2); gridControl1.Name = "gridControl1"; gridControl1.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { repositoryItemButtonEdit1 }); - gridControl1.Size = new Size(1287, 495); + gridControl1.Size = new Size(1285, 492); gridControl1.TabIndex = 7; gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { gridView1 }); - gridControl1.Click += gridControl1_Click; // - // bimfaceFileViewModelBindingSource + // bimfaceFileMgrViewModelBindingSource // - bimfaceFileViewModelBindingSource.DataSource = typeof(BimfaceFileViewModel); + bimfaceFileMgrViewModelBindingSource.DataSource = typeof(BimfaceFileMgrViewModel); // // gridView1 // @@ -168,6 +172,7 @@ // colHasRelation.FieldName = "HasRelation"; colHasRelation.Name = "colHasRelation"; + colHasRelation.OptionsColumn.FixedWidth = true; colHasRelation.Visible = true; colHasRelation.VisibleIndex = 9; // @@ -193,13 +198,13 @@ // ribbonControl1.ExpandCollapseItem.Id = 0; ribbonControl1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { ribbonControl1.ExpandCollapseItem, barBtnUpload, barBtnTranslate, barBtnAdminAdd, barBtnDelete, barBtnDetail, barBtnEdit, barBtnLocal, barBtnWeb, barBtnPhone, barBtnSetBim, barBtnReloadData }); - ribbonControl1.Location = new Point(0, 0); + ribbonControl1.Location = new Point(1, 1); ribbonControl1.MaxItemId = 13; ribbonControl1.Name = "ribbonControl1"; ribbonControl1.Pages.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPage[] { ribbonPage1 }); ribbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.False; ribbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide; - ribbonControl1.Size = new Size(1287, 128); + ribbonControl1.Size = new Size(1285, 128); ribbonControl1.ToolbarLocation = DevExpress.XtraBars.Ribbon.RibbonQuickAccessToolbarLocation.Hidden; // // barBtnUpload @@ -276,7 +281,7 @@ // // barBtnSetBim // - barBtnSetBim.Caption = "妯″瀷璁剧疆"; + barBtnSetBim.Caption = "璁剧疆"; barBtnSetBim.Id = 11; barBtnSetBim.ImageOptions.SvgImage = (DevExpress.Utils.Svg.SvgImage)resources.GetObject("barBtnSetBim.ImageOptions.SvgImage"); barBtnSetBim.Name = "barBtnSetBim"; @@ -319,7 +324,7 @@ // ribPageGrpSet.ItemLinks.Add(barBtnSetBim); ribPageGrpSet.Name = "ribPageGrpSet"; - ribPageGrpSet.Text = "璁剧疆"; + ribPageGrpSet.Text = "妯″瀷"; // // ribPageGrpMore // @@ -327,21 +332,42 @@ ribPageGrpMore.Name = "ribPageGrpMore"; ribPageGrpMore.Text = "鏇村"; // + // svgImage32 + // + svgImage32.ImageSize = new Size(32, 32); + svgImage32.Add("bletter", "image://svgimages/outlook inspired/bletter.svg"); + svgImage32.Add("bold", "image://svgimages/outlook inspired/bold.svg"); + // + // panelControl1 + // + panelControl1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; + panelControl1.Controls.Add(gridControl1); + panelControl1.Dock = DockStyle.Fill; + panelControl1.Location = new Point(1, 129); + panelControl1.Name = "panelControl1"; + panelControl1.Padding = new Padding(0, 1, 0, 0); + panelControl1.Size = new Size(1285, 493); + panelControl1.TabIndex = 9; + // // BimfaceFileMgrPage // Appearance.BackColor = SystemColors.Control; Appearance.Options.UseBackColor = true; AutoScaleDimensions = new SizeF(7F, 14F); AutoScaleMode = AutoScaleMode.Font; - Controls.Add(gridControl1); + Controls.Add(panelControl1); Controls.Add(ribbonControl1); Name = "BimfaceFileMgrPage"; + Padding = new Padding(1); Size = new Size(1287, 623); ((System.ComponentModel.ISupportInitialize)gridControl1).EndInit(); - ((System.ComponentModel.ISupportInitialize)bimfaceFileViewModelBindingSource).EndInit(); + ((System.ComponentModel.ISupportInitialize)bimfaceFileMgrViewModelBindingSource).EndInit(); ((System.ComponentModel.ISupportInitialize)gridView1).EndInit(); ((System.ComponentModel.ISupportInitialize)repositoryItemButtonEdit1).EndInit(); ((System.ComponentModel.ISupportInitialize)ribbonControl1).EndInit(); + ((System.ComponentModel.ISupportInitialize)svgImage32).EndInit(); + ((System.ComponentModel.ISupportInitialize)panelControl1).EndInit(); + panelControl1.ResumeLayout(false); ResumeLayout(false); PerformLayout(); } @@ -369,7 +395,7 @@ private DevExpress.XtraBars.Ribbon.RibbonPageGroup ribPageGrpSet; private DevExpress.XtraBars.Ribbon.RibbonPageGroup ribPageGrpMore; private DevExpress.XtraBars.BarButtonItem barBtnReloadData; - private BindingSource bimfaceFileViewModelBindingSource; + private BindingSource bimfaceFileMgrViewModelBindingSource; private DevExpress.XtraGrid.Columns.GridColumn colBimfaceId; private DevExpress.XtraGrid.Columns.GridColumn colName; private DevExpress.XtraGrid.Columns.GridColumn colModelType; @@ -380,5 +406,7 @@ private DevExpress.XtraGrid.Columns.GridColumn colFlags; private DevExpress.XtraGrid.Columns.GridColumn colTagName; private DevExpress.XtraGrid.Columns.GridColumn colHasRelation; + private DevExpress.Utils.SvgImageCollection svgImage32; + private PanelControl panelControl1; } } diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs index 965b551..b7eec82 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.cs @@ -11,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()); @@ -24,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> ///鍒濆鍖栨暟鎹� @@ -74,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(); } @@ -97,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() { @@ -176,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(); @@ -195,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; @@ -206,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) { - 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.Processing) + 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.Processing) - { - 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湪寮�鍙戜腑..."); } @@ -452,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(); @@ -503,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 diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.resx b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.resx index d26aca5..f4835bc 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.resx +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrPage.resx @@ -117,7 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <metadata name="bimfaceFileViewModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="bimfaceFileMgrViewModelBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> <assembly alias="DevExpress.Data.v23.2" name="DevExpress.Data.v23.2, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> @@ -370,4 +370,7 @@ Zz4L </value> </data> + <metadata name="svgImage32.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>311, 17</value> + </metadata> </root> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileViewModel.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrViewModel.cs similarity index 69% rename from WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileViewModel.cs rename to WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrViewModel.cs index a64796b..85d88b6 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileViewModel.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/BimfaceFileMgrViewModel.cs @@ -3,17 +3,17 @@ /// <summary> /// /// </summary> - public class BimfaceFileViewModel + public class BimfaceFileMgrViewModel { /// <summary> /// /// </summary> - public BimfaceFileViewModel() { } + public BimfaceFileMgrViewModel() { } /// <summary> /// /// </summary> - public BimfaceFileViewModel(Yw.Dto.BimfaceFileDto rhs, bool hasRelation) + public BimfaceFileMgrViewModel(Yw.Dto.BimfaceFileDto rhs, bool hasRelation) { this.ID = rhs.ID; this.BimfaceId = rhs.BimfaceId; @@ -26,11 +26,35 @@ this.StorageUrl = rhs.StorageUrl; this.Content = rhs.Content; this.Paras = rhs.Paras; - this.Flags = Yw.Untity.FlagsHelper.ToString(rhs.Flags); + this.FlagsString = Yw.Untity.FlagsHelper.ToString(rhs.Flags); + this.Flags = rhs.Flags; this.TagName = rhs.TagName; this.SortCode = rhs.SortCode; this.Description = rhs.Description; this.HasRelation = hasRelation; + } + + /// <summary> + /// + /// </summary> + public void Reset(Yw.Dto.BimfaceFileDto rhs) + { + this.ID = rhs.ID; + this.BimfaceId = rhs.BimfaceId; + this.Name = rhs.Name; + this.ModelType = (eModelType)rhs.ModelType; + this.FileStatus = (eFileStatus)rhs.FileStatus; + this.FileSize = rhs.FileSize; + this.FormatType = (eFormatType)rhs.FormatType; + this.FileSuffix = rhs.FileSuffix; + this.StorageUrl = rhs.StorageUrl; + this.Content = rhs.Content; + this.Paras = rhs.Paras; + this.FlagsString = Yw.Untity.FlagsHelper.ToString(rhs.Flags); + this.Flags = rhs.Flags; + this.TagName = rhs.TagName; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; } /// <summary> @@ -103,7 +127,13 @@ /// /// </summary> [Display(Name = "鏍囩")] - public string Flags { get; set; } + public string FlagsString { get; set; } + + /// <summary> + /// 鏍囩 + /// </summary> + [Display(Name = "鏍囩")] + public List<string> Flags { get; set; } /// <summary> /// @@ -126,7 +156,7 @@ /// <summary> /// /// </summary> - [Display(Name = "鎸囧畾")] + [Display(Name = "鍏宠仈")] public bool HasRelation { get; set; } } diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.Designer.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.Designer.cs index 2447ef4..840b432 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.Designer.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.Designer.cs @@ -30,6 +30,12 @@ { components = new System.ComponentModel.Container(); layoutControl1 = new DevExpress.XtraLayout.LayoutControl(); + txtExtension = new TextEdit(); + imgCmbFormatType = new ImageComboBoxEdit(); + imgCmbBimfaceModelType = new ImageComboBoxEdit(); + txtFileSize = new TextEdit(); + imgCmbFileStatus = new ImageComboBoxEdit(); + txtBimfaceId = new TextEdit(); txtDescription = new MemoEdit(); btnCancel = new SimpleButton(); btnOk = new SimpleButton(); @@ -40,9 +46,21 @@ layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem(); layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem(); layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem9 = new DevExpress.XtraLayout.LayoutControlItem(); + layoutControlItem10 = new DevExpress.XtraLayout.LayoutControlItem(); dxErrorProvider1 = new DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider(components); ((System.ComponentModel.ISupportInitialize)layoutControl1).BeginInit(); layoutControl1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)txtExtension.Properties).BeginInit(); + ((System.ComponentModel.ISupportInitialize)imgCmbFormatType.Properties).BeginInit(); + ((System.ComponentModel.ISupportInitialize)imgCmbBimfaceModelType.Properties).BeginInit(); + ((System.ComponentModel.ISupportInitialize)txtFileSize.Properties).BeginInit(); + ((System.ComponentModel.ISupportInitialize)imgCmbFileStatus.Properties).BeginInit(); + ((System.ComponentModel.ISupportInitialize)txtBimfaceId.Properties).BeginInit(); ((System.ComponentModel.ISupportInitialize)txtDescription.Properties).BeginInit(); ((System.ComponentModel.ISupportInitialize)txtName.Properties).BeginInit(); ((System.ComponentModel.ISupportInitialize)layoutControlGroup1).BeginInit(); @@ -51,11 +69,23 @@ ((System.ComponentModel.ISupportInitialize)layoutControlItem3).BeginInit(); ((System.ComponentModel.ISupportInitialize)layoutControlItem2).BeginInit(); ((System.ComponentModel.ISupportInitialize)layoutControlItem5).BeginInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem4).BeginInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem6).BeginInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem7).BeginInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem8).BeginInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem9).BeginInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem10).BeginInit(); ((System.ComponentModel.ISupportInitialize)dxErrorProvider1).BeginInit(); SuspendLayout(); // // layoutControl1 // + layoutControl1.Controls.Add(txtExtension); + layoutControl1.Controls.Add(imgCmbFormatType); + layoutControl1.Controls.Add(imgCmbBimfaceModelType); + layoutControl1.Controls.Add(txtFileSize); + layoutControl1.Controls.Add(imgCmbFileStatus); + layoutControl1.Controls.Add(txtBimfaceId); layoutControl1.Controls.Add(txtDescription); layoutControl1.Controls.Add(btnCancel); layoutControl1.Controls.Add(btnOk); @@ -64,49 +94,100 @@ layoutControl1.Location = new Point(0, 0); layoutControl1.Name = "layoutControl1"; layoutControl1.Root = layoutControlGroup1; - layoutControl1.Size = new Size(499, 324); + layoutControl1.Size = new Size(448, 468); layoutControl1.TabIndex = 0; layoutControl1.Text = "layoutControl1"; // + // txtExtension + // + txtExtension.Location = new Point(88, 156); + txtExtension.Name = "txtExtension"; + txtExtension.Size = new Size(348, 20); + txtExtension.StyleController = layoutControl1; + txtExtension.TabIndex = 22; + // + // imgCmbFormatType + // + imgCmbFormatType.Location = new Point(88, 84); + imgCmbFormatType.Name = "imgCmbFormatType"; + imgCmbFormatType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); + imgCmbFormatType.Size = new Size(348, 20); + imgCmbFormatType.StyleController = layoutControl1; + imgCmbFormatType.TabIndex = 18; + // + // imgCmbBimfaceModelType + // + imgCmbBimfaceModelType.Location = new Point(88, 60); + imgCmbBimfaceModelType.Name = "imgCmbBimfaceModelType"; + imgCmbBimfaceModelType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); + imgCmbBimfaceModelType.Size = new Size(348, 20); + imgCmbBimfaceModelType.StyleController = layoutControl1; + imgCmbBimfaceModelType.TabIndex = 8; + // + // txtFileSize + // + txtFileSize.Location = new Point(88, 132); + txtFileSize.Name = "txtFileSize"; + txtFileSize.Size = new Size(348, 20); + txtFileSize.StyleController = layoutControl1; + txtFileSize.TabIndex = 4; + // + // imgCmbFileStatus + // + imgCmbFileStatus.Location = new Point(88, 108); + imgCmbFileStatus.Name = "imgCmbFileStatus"; + imgCmbFileStatus.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo) }); + imgCmbFileStatus.Size = new Size(348, 20); + imgCmbFileStatus.StyleController = layoutControl1; + imgCmbFileStatus.TabIndex = 3; + // + // txtBimfaceId + // + txtBimfaceId.Location = new Point(88, 12); + txtBimfaceId.Name = "txtBimfaceId"; + txtBimfaceId.Size = new Size(348, 20); + txtBimfaceId.StyleController = layoutControl1; + txtBimfaceId.TabIndex = 0; + // // txtDescription // - txtDescription.Location = new Point(59, 36); + txtDescription.Location = new Point(88, 180); txtDescription.Name = "txtDescription"; - txtDescription.Size = new Size(428, 250); + txtDescription.Size = new Size(348, 250); txtDescription.StyleController = layoutControl1; - txtDescription.TabIndex = 13; + txtDescription.TabIndex = 5; // // btnCancel // btnCancel.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Warning; btnCancel.Appearance.Options.UseBackColor = true; btnCancel.DialogResult = DialogResult.Cancel; - btnCancel.Location = new Point(400, 290); + btnCancel.Location = new Point(349, 434); btnCancel.Name = "btnCancel"; btnCancel.Size = new Size(87, 22); btnCancel.StyleController = layoutControl1; - btnCancel.TabIndex = 6; + btnCancel.TabIndex = 7; btnCancel.Text = "鍙栨秷"; // // btnOk // btnOk.Appearance.BackColor = DevExpress.LookAndFeel.DXSkinColors.FillColors.Primary; btnOk.Appearance.Options.UseBackColor = true; - btnOk.Location = new Point(309, 290); + btnOk.Location = new Point(258, 434); btnOk.Name = "btnOk"; btnOk.Size = new Size(87, 22); btnOk.StyleController = layoutControl1; - btnOk.TabIndex = 5; + btnOk.TabIndex = 6; btnOk.Text = "纭畾"; btnOk.Click += btnOk_Click; // // txtName // - txtName.Location = new Point(59, 12); + txtName.Location = new Point(88, 36); txtName.Name = "txtName"; - txtName.Size = new Size(428, 20); + txtName.Size = new Size(348, 20); txtName.StyleController = layoutControl1; - txtName.TabIndex = 4; + txtName.TabIndex = 2; // // layoutControlGroup1 // @@ -114,33 +195,33 @@ layoutControlGroup1.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far; layoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True; layoutControlGroup1.GroupBordersVisible = false; - layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { layoutControlItem1, emptySpaceItem1, layoutControlItem3, layoutControlItem2, layoutControlItem5 }); + layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] { layoutControlItem1, emptySpaceItem1, layoutControlItem3, layoutControlItem2, layoutControlItem5, layoutControlItem4, layoutControlItem6, layoutControlItem7, layoutControlItem8, layoutControlItem9, layoutControlItem10 }); layoutControlGroup1.Name = "layoutControlGroup1"; - layoutControlGroup1.Size = new Size(499, 324); + layoutControlGroup1.Size = new Size(448, 468); layoutControlGroup1.TextVisible = false; // // layoutControlItem1 // layoutControlItem1.AllowHtmlStringInCaption = true; layoutControlItem1.Control = txtName; - layoutControlItem1.Location = new Point(0, 0); + layoutControlItem1.Location = new Point(0, 24); layoutControlItem1.Name = "layoutControlItem1"; - layoutControlItem1.Size = new Size(479, 24); + layoutControlItem1.Size = new Size(428, 24); layoutControlItem1.Text = "<color=red>*</color>鍚嶇О:"; - layoutControlItem1.TextSize = new Size(35, 14); + layoutControlItem1.TextSize = new Size(64, 14); // // emptySpaceItem1 // emptySpaceItem1.AllowHotTrack = false; - emptySpaceItem1.Location = new Point(0, 278); + emptySpaceItem1.Location = new Point(0, 422); emptySpaceItem1.Name = "emptySpaceItem1"; - emptySpaceItem1.Size = new Size(297, 26); + emptySpaceItem1.Size = new Size(246, 26); emptySpaceItem1.TextSize = new Size(0, 0); // // layoutControlItem3 // layoutControlItem3.Control = btnCancel; - layoutControlItem3.Location = new Point(388, 278); + layoutControlItem3.Location = new Point(337, 422); layoutControlItem3.MaxSize = new Size(91, 26); layoutControlItem3.MinSize = new Size(91, 26); layoutControlItem3.Name = "layoutControlItem3"; @@ -152,7 +233,7 @@ // layoutControlItem2 // layoutControlItem2.Control = btnOk; - layoutControlItem2.Location = new Point(297, 278); + layoutControlItem2.Location = new Point(246, 422); layoutControlItem2.MaxSize = new Size(91, 26); layoutControlItem2.MinSize = new Size(91, 26); layoutControlItem2.Name = "layoutControlItem2"; @@ -164,27 +245,93 @@ // layoutControlItem5 // layoutControlItem5.Control = txtDescription; - layoutControlItem5.Location = new Point(0, 24); + layoutControlItem5.Location = new Point(0, 168); layoutControlItem5.Name = "layoutControlItem5"; - layoutControlItem5.Size = new Size(479, 254); - layoutControlItem5.Text = "鎻忚堪:"; - layoutControlItem5.TextSize = new Size(35, 14); + layoutControlItem5.Size = new Size(428, 254); + layoutControlItem5.Text = "璇存槑:"; + layoutControlItem5.TextSize = new Size(64, 14); + // + // layoutControlItem4 + // + layoutControlItem4.AllowHtmlStringInCaption = true; + layoutControlItem4.Control = txtBimfaceId; + layoutControlItem4.Location = new Point(0, 0); + layoutControlItem4.Name = "layoutControlItem4"; + layoutControlItem4.Size = new Size(428, 24); + layoutControlItem4.Text = "<color=red>*</color>BimfaceId:"; + layoutControlItem4.TextSize = new Size(64, 14); + // + // layoutControlItem6 + // + layoutControlItem6.AllowHtmlStringInCaption = true; + layoutControlItem6.Control = imgCmbFileStatus; + layoutControlItem6.Location = new Point(0, 96); + layoutControlItem6.Name = "layoutControlItem6"; + layoutControlItem6.Size = new Size(428, 24); + layoutControlItem6.Text = "<color=red>*</color>鏂囦欢鐘舵��:"; + layoutControlItem6.TextSize = new Size(64, 14); + // + // layoutControlItem7 + // + layoutControlItem7.AllowHtmlStringInCaption = true; + layoutControlItem7.Control = txtFileSize; + layoutControlItem7.Location = new Point(0, 120); + layoutControlItem7.Name = "layoutControlItem7"; + layoutControlItem7.Size = new Size(428, 24); + layoutControlItem7.Text = "鏂囦欢澶у皬:"; + layoutControlItem7.TextSize = new Size(64, 14); + // + // layoutControlItem8 + // + layoutControlItem8.AllowHtmlStringInCaption = true; + layoutControlItem8.Control = imgCmbBimfaceModelType; + layoutControlItem8.Location = new Point(0, 48); + layoutControlItem8.Name = "layoutControlItem8"; + layoutControlItem8.Size = new Size(428, 24); + layoutControlItem8.Text = "<color=red>*</color>妯″瀷绫诲瀷:"; + layoutControlItem8.TextSize = new Size(64, 14); + // + // layoutControlItem9 + // + layoutControlItem9.AllowHtmlStringInCaption = true; + layoutControlItem9.Control = imgCmbFormatType; + layoutControlItem9.Location = new Point(0, 72); + layoutControlItem9.Name = "layoutControlItem9"; + layoutControlItem9.Size = new Size(428, 24); + layoutControlItem9.Text = "<color=red>*</color>鏂囦欢鏍煎紡:"; + layoutControlItem9.TextSize = new Size(64, 14); + // + // layoutControlItem10 + // + layoutControlItem10.AllowHtmlStringInCaption = true; + layoutControlItem10.Control = txtExtension; + layoutControlItem10.Location = new Point(0, 144); + layoutControlItem10.Name = "layoutControlItem10"; + layoutControlItem10.Size = new Size(428, 24); + layoutControlItem10.Text = "<color=red>*</color>鎵╁睍鍚�:"; + layoutControlItem10.TextSize = new Size(64, 14); // // dxErrorProvider1 // dxErrorProvider1.ContainerControl = this; // - // EditBimfaceFileBaseInfoDlg + // EditBimfaceFileDlg // AutoScaleDimensions = new SizeF(7F, 14F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(499, 324); + ClientSize = new Size(448, 468); Controls.Add(layoutControl1); - Name = "EditBimfaceFileBaseInfoDlg"; + Name = "EditBimfaceFileDlg"; StartPosition = FormStartPosition.CenterParent; Text = "缂栬緫妯″瀷鏂囦欢"; ((System.ComponentModel.ISupportInitialize)layoutControl1).EndInit(); layoutControl1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)txtExtension.Properties).EndInit(); + ((System.ComponentModel.ISupportInitialize)imgCmbFormatType.Properties).EndInit(); + ((System.ComponentModel.ISupportInitialize)imgCmbBimfaceModelType.Properties).EndInit(); + ((System.ComponentModel.ISupportInitialize)txtFileSize.Properties).EndInit(); + ((System.ComponentModel.ISupportInitialize)imgCmbFileStatus.Properties).EndInit(); + ((System.ComponentModel.ISupportInitialize)txtBimfaceId.Properties).EndInit(); ((System.ComponentModel.ISupportInitialize)txtDescription.Properties).EndInit(); ((System.ComponentModel.ISupportInitialize)txtName.Properties).EndInit(); ((System.ComponentModel.ISupportInitialize)layoutControlGroup1).EndInit(); @@ -193,6 +340,12 @@ ((System.ComponentModel.ISupportInitialize)layoutControlItem3).EndInit(); ((System.ComponentModel.ISupportInitialize)layoutControlItem2).EndInit(); ((System.ComponentModel.ISupportInitialize)layoutControlItem5).EndInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem4).EndInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem6).EndInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem7).EndInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem8).EndInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem9).EndInit(); + ((System.ComponentModel.ISupportInitialize)layoutControlItem10).EndInit(); ((System.ComponentModel.ISupportInitialize)dxErrorProvider1).EndInit(); ResumeLayout(false); } @@ -211,5 +364,17 @@ private DevExpress.XtraEditors.DXErrorProvider.DXErrorProvider dxErrorProvider1; private DevExpress.XtraEditors.MemoEdit txtDescription; private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5; + private TextEdit txtBimfaceId; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4; + private ImageComboBoxEdit imgCmbFileStatus; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem6; + private TextEdit txtFileSize; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem7; + private ImageComboBoxEdit imgCmbBimfaceModelType; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem8; + private ImageComboBoxEdit imgCmbFormatType; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem9; + private TextEdit txtExtension; + private DevExpress.XtraLayout.LayoutControlItem layoutControlItem10; } } \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.cs b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.cs index 4f372ff..60d7c00 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.cs +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/02-file/EditBimfaceFileDlg.cs @@ -1,4 +1,8 @@ -锘縩amespace Yw.WinFrmUI +锘縰sing DevExpress.CodeParser; +using DevExpress.Mvvm.POCO; +using Mapster; + +namespace Yw.WinFrmUI { /// <summary> /// 缂栬緫妯″瀷鏂囦欢 @@ -18,43 +22,119 @@ /// <summary> /// 缁戝畾鏁版嵁 /// </summary> - //public void SetBindingData(Model.BimFile4Update rhs) - //{ - // _updateModel = rhs; - // this.txtName.EditValue = rhs.FileName; - // this.txtDescription.EditValue = rhs.Description; - //} + public void SetBindingData(BimfaceFileMgrViewModel vm) + { + InitialModelType(); + InitialFormatType(); + InitialFileStatus(); + _updateModel = vm.Adapt<BimfaceFileMgrViewModel, Yw.Dto.UpdateBimfaceFileInput>(); + this.txtBimfaceId.EditValue = vm.BimfaceId; + this.txtName.EditValue = vm.Name; + this.imgCmbBimfaceModelType.EditValue = vm.ModelType; + this.imgCmbFormatType.EditValue = vm.FormatType; + this.imgCmbFileStatus.EditValue = vm.FileStatus; + this.txtFileSize.EditValue = vm.FileSize; + this.txtExtension.EditValue = vm.FileSuffix; + this.txtDescription.EditValue = vm.Description; + } + + //鍒濆鍖栨ā鍨嬬被鍨� + private void InitialModelType() + { + this.imgCmbBimfaceModelType.Properties.BeginUpdate(); + this.imgCmbBimfaceModelType.Properties.Items.Clear(); + this.imgCmbBimfaceModelType.Properties.Items.AddEnum(typeof(eModelType), false); + this.imgCmbBimfaceModelType.EditValue = eModelType.File; + this.imgCmbBimfaceModelType.Properties.EndUpdate(); + this.imgCmbBimfaceModelType.Enabled = false; + } + + //鍒濆鍖栨枃浠舵牸寮� + private void InitialFormatType() + { + this.imgCmbFormatType.Properties.BeginUpdate(); + this.imgCmbFormatType.Properties.Items.Clear(); + this.imgCmbFormatType.Properties.Items.AddEnum(typeof(eFormatType), false); + this.imgCmbFormatType.EditValue = eFormatType._3D; + this.imgCmbFormatType.Properties.EndUpdate(); + } + + //鍒濆鍖栨枃浠剁姸鎬� + private void InitialFileStatus() + { + this.imgCmbFileStatus.Properties.BeginUpdate(); + this.imgCmbFileStatus.Properties.Items.Clear(); + this.imgCmbFileStatus.Properties.Items.AddEnum(typeof(eFileStatus), false); + this.imgCmbFileStatus.EditValue = eFileStatus.ConvertSucceed; + this.imgCmbFileStatus.Properties.EndUpdate(); + } //楠岃瘉 private bool Valid() { this.dxErrorProvider1.ClearErrors(); + if (string.IsNullOrEmpty(this.txtBimfaceId.Text.Trim())) + { + this.dxErrorProvider1.SetError(this.txtBimfaceId, "蹇呭~椤�"); + return false; + } if (string.IsNullOrEmpty(this.txtName.Text.Trim())) { this.dxErrorProvider1.SetError(this.txtName, "蹇呭~椤�"); return false; } + if (string.IsNullOrEmpty(this.txtExtension.Text.Trim())) + { + this.dxErrorProvider1.SetError(this.txtExtension, "蹇呭~椤�"); + return false; + } + if (string.IsNullOrEmpty(this.imgCmbBimfaceModelType.Text.Trim())) + { + this.dxErrorProvider1.SetError(this.imgCmbBimfaceModelType, "蹇呴�夐」"); + return false; + } + if (string.IsNullOrEmpty(this.imgCmbFormatType.Text.Trim())) + { + this.dxErrorProvider1.SetError(this.imgCmbFormatType, "蹇呴�夐」"); + return false; + } + if (string.IsNullOrEmpty(this.imgCmbFileStatus.Text.Trim())) + { + this.dxErrorProvider1.SetError(this.imgCmbFileStatus, "蹇呴�夐」"); + return false; + } + return true; } //纭畾 - private void btnOk_Click(object sender, EventArgs e) + private async void btnOk_Click(object sender, EventArgs e) { - //if (!Valid()) - // return; - //_updateModel.FileName = this.txtName.Text.Trim(); - //_updateModel.Description = this.txtDescription.Text.Trim(); + if (!Valid()) + { + return; + } + _updateModel.BimfaceId = this.txtBimfaceId.Text.Trim(); + _updateModel.Name = this.txtName.Text.Trim(); + _updateModel.ModelType = (int)(eModelType)this.imgCmbBimfaceModelType.EditValue; + _updateModel.FormatType = (int)(eFormatType)this.imgCmbFormatType.EditValue; + _updateModel.FileStatus = (int)(eFileStatus)this.imgCmbFileStatus.EditValue; + _updateModel.FileSuffix = this.txtExtension.Text.Trim(); + _updateModel.FileSize = this.txtFileSize.Text.Trim(); + _updateModel.Description = this.txtDescription.Text.Trim(); - //if (!new BLL.BimFile().Update(_updateModel)) - //{ - // XtraMessageBox.Show("鏇存柊澶辫触锛�"); - // return; - //} + if (!await _bll.Value.Update(_updateModel)) + { + XtraMessageBox.Show("鏇存柊澶辫触锛�"); + return; + } - //if (this.ReloadDataEvent != null) - // this.ReloadDataEvent(_updateModel); - //this.DialogResult = DialogResult.OK; - //this.Close(); + if (this.ReloadDataEvent != null) + { + this.ReloadDataEvent(_updateModel.ID); + } + this.DialogResult = DialogResult.OK; + this.Close(); } diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Properties/DataSources/Yw.WinFrmUI.BimfaceFileMgrViewModel.datasource b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Properties/DataSources/Yw.WinFrmUI.BimfaceFileMgrViewModel.datasource new file mode 100644 index 0000000..fedb119 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Properties/DataSources/Yw.WinFrmUI.BimfaceFileMgrViewModel.datasource @@ -0,0 +1,10 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<!-- + This file is automatically generated by Visual Studio. It is + used to store generic object data source configuration information. + Renaming the file extension or editing the content of this file may + cause the file to be unrecognizable by the program. +--> +<GenericObjectDataSource DisplayName="BimfaceFileMgrViewModel" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> + <TypeInfo>Yw.WinFrmUI.BimfaceFileMgrViewModel, Yw.WinFrmUI.Bimface.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> +</GenericObjectDataSource> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Properties/DataSources/Yw.WinFrmUI.BimfaceFileViewModel.datasource b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Properties/DataSources/Yw.WinFrmUI.BimfaceFileViewModel.datasource deleted file mode 100644 index d172772..0000000 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Properties/DataSources/Yw.WinFrmUI.BimfaceFileViewModel.datasource +++ /dev/null @@ -1,10 +0,0 @@ -锘�<?xml version="1.0" encoding="utf-8"?> -<!-- - This file is automatically generated by Visual Studio. It is - used to store generic object data source configuration information. - Renaming the file extension or editing the content of this file may - cause the file to be unrecognizable by the program. ---> -<GenericObjectDataSource DisplayName="BimfaceFileViewModel" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> - <TypeInfo>Yw.WinFrmUI.BimfaceFileViewModel, Yw.WinFrmUI.Bimface.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> -</GenericObjectDataSource> \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Yw.WinFrmUI.Bimface.Core.csproj.user b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Yw.WinFrmUI.Bimface.Core.csproj.user index 4d503a6..5e8d1c9 100644 --- a/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Yw.WinFrmUI.Bimface.Core.csproj.user +++ b/WinFrmUI/Yw.WinFrmUI.Bimface.Core/Yw.WinFrmUI.Bimface.Core.csproj.user @@ -7,6 +7,9 @@ <Compile Update="02-file\AddBimfaceFileDlg.cs"> <SubType>Form</SubType> </Compile> + <Compile Update="02-file\Bimface3dViewPage.cs"> + <SubType>UserControl</SubType> + </Compile> <Compile Update="02-file\BimfaceFileMgrPage.cs"> <SubType>UserControl</SubType> </Compile> diff --git a/WinFrmUI/Yw.WinFrmUI.Core/00-core/MessageBoxHelper.cs b/WinFrmUI/Yw.WinFrmUI.Core/00-core/MessageBoxHelper.cs new file mode 100644 index 0000000..a689e07 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Core/00-core/MessageBoxHelper.cs @@ -0,0 +1,107 @@ +锘縩amespace Yw.WinFrmUI +{ + /// <summary> + /// + /// </summary> + public class MessageBoxHelper + { + /// <summary> + /// + /// </summary> + /// <param name="message">鏄剧ず淇℃伅</param> + /// <param name="caption">鏍囬</param> + /// <param name="buttons">鏄剧ず鎸夐挳</param> + /// <param name="icon">鍥炬爣</param> + /// <param name="defaultButton">榛樿鎸夐挳</param> + /// <returns></returns> + public static DialogResult Show + ( + string message, + string caption, + MessageBoxButtons buttons = MessageBoxButtons.OKCancel, + MessageBoxIcon icon = MessageBoxIcon.Information, + MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1 + ) + { + return XtraMessageBox.Show(message, caption, buttons, icon, defaultButton); + } + + /// <summary> + /// 鎴愬姛淇℃伅寮圭獥 + /// </summary> + /// <param name="message">鏄剧ず淇℃伅</param> + /// <param name="caption">鏍囬</param> + /// <param name="buttons">鏄剧ず鎸夐挳</param> + /// <param name="defaultButton">榛樿鎸夐挳</param> + /// <returns></returns> + public static DialogResult ShowSuccess + (string message, string caption = "鎴愬姛", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1) + { + return XtraMessageBox.Show(message, caption, buttons, MessageBoxIcon.Information, defaultButton); + } + + /// <summary> + /// 閿欒淇℃伅寮圭獥 + /// </summary> + /// <param name="message">鏄剧ず淇℃伅</param> + /// <param name="caption">鏍囬</param> + /// <param name="buttons">鏄剧ず鎸夐挳</param> + /// <param name="defaultButton">榛樿鎸夐挳</param> + /// <returns></returns> + public static DialogResult ShowError + (string message, string caption = "閿欒", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1) + { + return XtraMessageBox.Show(message, caption, buttons, MessageBoxIcon.Error, defaultButton); + } + + /// <summary> + /// 璀﹀憡淇℃伅寮圭獥 + /// </summary> + /// <param name="message">鏄剧ず淇℃伅</param> + /// <param name="caption">鏍囬</param> + /// <param name="buttons">鏄剧ず鎸夐挳</param> + /// <param name="defaultButton">榛樿鎸夐挳</param> + /// <returns></returns> + public static DialogResult ShowWarning + (string message, string caption = "璀﹀憡", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1) + { + return XtraMessageBox.Show(message, caption, buttons, MessageBoxIcon.Warning, defaultButton); + } + + /// <summary> + /// 鏅�氫俊鎭脊绐� + /// </summary> + /// <param name="message">鏄剧ず淇℃伅</param> + /// <param name="caption">鏍囬</param> + /// <param name="buttons">鏄剧ず鎸夐挳</param> + /// <param name="defaultButton">榛樿鎸夐挳</param> + /// <returns></returns> + public static DialogResult ShowInfo + (string message, string caption = "鎻愮ず", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1) + { + return XtraMessageBox.Show(message, caption, buttons, MessageBoxIcon.Information, defaultButton); + } + + /// <summary> + /// 璇㈤棶淇℃伅寮圭獥 + /// </summary> + /// <param name="message">鏄剧ず淇℃伅</param> + /// <param name="caption">鏍囬</param> + /// <param name="buttons">鏄剧ず鎸夐挳</param> + /// <param name="defaultButton">榛樿鎸夐挳</param> + /// <returns></returns> + public static DialogResult ShowQuestion + (string message, string caption = "璇㈤棶", MessageBoxButtons buttons = MessageBoxButtons.YesNo, MessageBoxDefaultButton defaultButton = MessageBoxDefaultButton.Button1) + { + return XtraMessageBox.Show(message, caption, buttons, MessageBoxIcon.Question, defaultButton); + } + + + + + + + + + } +} \ No newline at end of file diff --git a/WinFrmUI/Yw.WinFrmUI.Core/05-alert/AlertToolHelper.cs b/WinFrmUI/Yw.WinFrmUI.Core/05-alert/AlertToolHelper.cs index 3a19b13..3edf8cf 100644 --- a/WinFrmUI/Yw.WinFrmUI.Core/05-alert/AlertToolHelper.cs +++ b/WinFrmUI/Yw.WinFrmUI.Core/05-alert/AlertToolHelper.cs @@ -41,6 +41,18 @@ Alert.Show(owner, info); } + /// <summary> + /// 鏄剧ず鍙充笅瑙掑脊绐� + /// </summary> + /// <param name="owner"></param> + /// <param name="caption"></param> + /// <param name="text"></param> + public static void ShowAlertInfo(this Control owner, string caption, string text) + { + var form = owner.FindForm(); + form.ShowAlertInfo(caption, text); + } + } } diff --git a/WinFrmUI/Yw.WinFrmUI.Core/06-document/PageFunction.cs b/WinFrmUI/Yw.WinFrmUI.Core/06-document/PageFunction.cs new file mode 100644 index 0000000..4f62bad --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Core/06-document/PageFunction.cs @@ -0,0 +1,13 @@ +锘縩amespace Yw.WinFrmUI +{ + /// <summary> + /// 椤甸潰鍔熻兘 + /// </summary> + public class PageFunction + { + /// <summary> + /// 鏌ョ湅 Bimface 3d 瑙嗗浘 + /// </summary> + public const string ViewBimface3d = "view-bimface-3d"; + } +} diff --git a/WinFrmUI/Yw.WinFrmUI.Core/06-document/PageModular.cs b/WinFrmUI/Yw.WinFrmUI.Core/06-document/PageModular.cs new file mode 100644 index 0000000..a5af858 --- /dev/null +++ b/WinFrmUI/Yw.WinFrmUI.Core/06-document/PageModular.cs @@ -0,0 +1,18 @@ +锘縩amespace Yw.WinFrmUI +{ + /// <summary> + /// 椤甸潰妯″潡 + /// </summary> + public class PageModular + { + /// <summary> + /// Bimface妯″潡 + /// </summary> + public const string Bimface = "bimface"; + + /// <summary> + /// 鍦板浘妯″潡 + /// </summary> + public const string Map = "map"; + } +} -- Gitblit v1.9.3