From b5234c5ab1e9e6826b8d8fc1e95fa752aaa40b74 Mon Sep 17 00:00:00 2001 From: chr <chr@mailcom> Date: 星期六, 02 十一月 2024 10:56:50 +0800 Subject: [PATCH] 优化程序 --- PdmSwPlugin.Main/SwAddIn/MainControl.cs | 82 + .vs/SwPlugin/v17/DocumentLayout.backup.json | 252 ++-- PdmSwPlugin.Common/Util/CustomPropertyUtil.cs | 7 PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml | 88 + PdmSwPlugin.PDM/PdmSwPlugin.PDM.csproj | 3 InnoSetupScript/PdmSwPlugin.iss | 4 SolidWorksListener/Listener.cs | 16 WpfUI/AsyncAttacher.cs | 2 Md5Reader/Properties/AssemblyInfo.cs | 52 + PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs | 4 AutoUpdater/MainWindow.xaml.cs | 83 + PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs | 50 PdmSwPlugin.PropertySetting/SettingControl.xaml.cs | 715 +++++++++++++ Md5Reader/Properties/Resources.Designer.cs | 71 + PdmSwPlugin.Main/MainTab.xaml.cs | 30 Md5Reader/Properties/Settings.Designer.cs | 30 PdmSwPlugin.Common/Util/LimitedConcurrencyLevelTaskScheduler.cs | 10 PdmSwPlugin.PDM/PdmControl.xaml.cs | 364 +++++- Md5Reader/Properties/Settings.settings | 7 .vs/SwPlugin/v17/DocumentLayout.json | 204 ++- PdmSwPlugin.Common/BomIniter/YwtBomIniter.cs | 14 PdmSwPlugin.PropertySetting/Panel/Model/JgjBasePanelModel.cs | 4 PdmSwPlugin.Common/Util/Pdm/BomTreeReader.cs | 9 Md5Reader/MainWindow.xaml.cs | 29 PdmSwPlugin.Common/Control/RichHisWindow.xaml.cs | 1 PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs | 36 Md5Reader/App.xaml | 9 PdmSwPlugin.PropertySetting/SettingControl.xaml | 39 PdmSwPlugin.Main/MainTab.xaml | 11 PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml.cs | 473 +++++++++ Md5Reader/Md5Reader.csproj | 125 ++ PdmSwPlugin.PropertySetting/PdmSwPlugin.PropertySetting.csproj | 14 Md5Reader/Properties/Resources.resx | 117 ++ Md5Reader/App.config | 6 PdmSw/SwAddin.cs | 52 PdmSwPlugin.Main/Constant/PluginConst.cs | 2 Md5Reader/App.xaml.cs | 17 PdmSwPlugin.Common/BomIniter/NameUtil.cs | 9 PdmSwPlugin.Common/Control/RichHisWindow.xaml | 2 Md5Reader/MainWindow.xaml | 22 PdmSwPlugin.Common/Setting/CustomerSetting.cs | 5 PdmSwPlugin.Main/MainControl.xaml.cs | 44 PdmSwPlugin.PDM/packages.config | 1 43 files changed, 2,767 insertions(+), 348 deletions(-) diff --git a/.vs/SwPlugin/v17/DocumentLayout.backup.json b/.vs/SwPlugin/v17/DocumentLayout.backup.json index bf181c2..a0bc88a 100644 --- a/.vs/SwPlugin/v17/DocumentLayout.backup.json +++ b/.vs/SwPlugin/v17/DocumentLayout.backup.json @@ -3,36 +3,48 @@ "WorkspaceRootPath": "D:\\Workspace\\PdmSwPlugin2\\", "Documents": [ { - "AbsoluteMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.drawapprove\\drawapprove.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|solutionrelative:pdmswplugin.drawapprove\\drawapprove.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.main\\constant\\pluginconst.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\constant\\pluginconst.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.pdm\\pdmcontrol.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", - "RelativeMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|solutionrelative:pdmswplugin.pdm\\pdmcontrol.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" - }, - { - "AbsoluteMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.drawapprove\\drawapprove.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", - "RelativeMoniker": "D:0:0:{BE239D32-7253-4D19-8793-159E98545B55}|PdmSwPlugin.DrawApprove\\PdmSwPlugin.DrawApprove.csproj|solutionrelative:pdmswplugin.drawapprove\\drawapprove.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" - }, - { - "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|solutionrelative:pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|d:\\workspace\\pdmswplugin2\\pdmsw\\swaddin.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "AbsoluteMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.common\\entity\\pdm\\pdmbom.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|solutionrelative:pdmswplugin.common\\entity\\pdm\\pdmbom.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.pdm\\pdmcontrol.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|solutionrelative:pdmswplugin.pdm\\pdmcontrol.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, + { + "AbsoluteMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.common\\util\\pdm\\bomtreereader.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|solutionrelative:pdmswplugin.common\\util\\pdm\\bomtreereader.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.common\\bominiter\\ywtbominiter.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|solutionrelative:pdmswplugin.common\\bominiter\\ywtbominiter.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{3AEC586C-B22A-4ADB-B4AB-10AA660F79EC}|Md5Reader\\Md5Reader.csproj|D:\\Workspace\\PdmSwPlugin2\\md5reader\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{3AEC586C-B22A-4ADB-B4AB-10AA660F79EC}|Md5Reader\\Md5Reader.csproj|solutionrelative:md5reader\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.main\\maincontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\maincontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{CB3551F6-0C4A-4537-9A04-1E40CD475479}|SolidWorksListener\\SolidWorksListener.csproj|D:\\Workspace\\PdmSwPlugin2\\solidworkslistener\\listener.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{CB3551F6-0C4A-4537-9A04-1E40CD475479}|SolidWorksListener\\SolidWorksListener.csproj|solutionrelative:solidworkslistener\\listener.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{4536570F-AD3C-4D24-870A-63C9E9CE0FED}|WpfUI\\WpfUI.csproj|D:\\Workspace\\PdmSwPlugin2\\wpfui\\asyncattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{4536570F-AD3C-4D24-870A-63C9E9CE0FED}|WpfUI\\WpfUI.csproj|solutionrelative:wpfui\\asyncattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmsw\\swaddin.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|solutionrelative:pdmsw\\swaddin.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.main\\swaddin\\maincontrol.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\swaddin\\maincontrol.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.main\\eventhandler\\baseattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\eventhandler\\baseattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|d:\\workspace\\pdmswplugin2\\pdmsw\\log4net.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}", - "RelativeMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|solutionrelative:pdmsw\\log4net.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}" } ], "DocumentGroupContainers": [ @@ -42,109 +54,139 @@ "DocumentGroups": [ { "DockedWidth": 200, - "SelectedChildIndex": 2, + "SelectedChildIndex": 4, "Children": [ { "$type": "Document", - "DocumentIndex": 2, - "Title": "DrawApprove.xaml", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\DrawApprove.xaml", - "RelativeDocumentMoniker": "PdmSwPlugin.DrawApprove\\DrawApprove.xaml", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\DrawApprove.xaml", - "RelativeToolTip": "PdmSwPlugin.DrawApprove\\DrawApprove.xaml", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", - "WhenOpened": "2024-10-09T03:31:27.843Z", - "EditorCaption": "" + "DocumentIndex": 5, + "Title": "YwtBomIniter.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "RelativeToolTip": "PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "ViewState": "AgIAAEEAAAAAAAAAAAAUwBIAAAAXAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-31T09:13:45.395Z" }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 3, "Title": "PdmControl.xaml", "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml", "RelativeDocumentMoniker": "PdmSwPlugin.PDM\\PdmControl.xaml", "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml", "RelativeToolTip": "PdmSwPlugin.PDM\\PdmControl.xaml", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", - "WhenOpened": "2024-10-09T03:30:57.686Z", - "EditorCaption": "" + "WhenOpened": "2024-10-31T09:12:36.773Z" }, { "$type": "Document", - "DocumentIndex": 0, - "Title": "DrawApprove.xaml.cs", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "RelativeToolTip": "PdmSwPlugin.DrawApprove\\DrawApprove.xaml.cs", - "ViewState": "AgIAAAYCAAAAAAAAAAAkwCICAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-10-09T03:22:18.864Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 7, - "Title": "log4net.config", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\log4net.config", - "RelativeDocumentMoniker": "PdmSw\\log4net.config", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\log4net.config", - "RelativeToolTip": "PdmSw\\log4net.config", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAQAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|", - "WhenOpened": "2024-09-26T10:24:04.161Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 4, - "Title": "SwAddin.cs", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", - "RelativeDocumentMoniker": "PdmSw\\SwAddin.cs", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", - "RelativeToolTip": "PdmSw\\SwAddin.cs", - "ViewState": "AgIAACIAAAAAAAAAAAA5wCkAAAAvAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-26T08:51:00.927Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 6, - "Title": "BaseAttacher.cs", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "RelativeToolTip": "PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "ViewState": "AgIAAKoAAAAAAAAAAAA0wMcAAAApAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-25T09:56:45.504Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 5, - "Title": "MainControl.cs", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "RelativeToolTip": "PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "ViewState": "AgIAAIwAAAAAAAAAAAA+wOQAAABDAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-25T09:54:37.505Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 1, "Title": "PdmControl.xaml.cs", "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml.cs", "RelativeDocumentMoniker": "PdmSwPlugin.PDM\\PdmControl.xaml.cs", "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml.cs", "RelativeToolTip": "PdmSwPlugin.PDM\\PdmControl.xaml.cs", - "ViewState": "AgIAAM0EAAAAAAAAAAAAAOEEAAAvAAAAAAAAAA==", + "ViewState": "AgIAALUEAAAAAAAAAAAuwMUEAABAAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-25T06:09:00.747Z", + "WhenOpened": "2024-10-31T08:50:14.505Z" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "BomTreeReader.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "RelativeToolTip": "PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "ViewState": "AgIAAPsAAAAAAAAAAAAUwBABAAAgAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-31T08:33:38.547Z" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "PluginConst.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "RelativeToolTip": "PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T04:01:41.756Z", "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "PdmBom.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "RelativeToolTip": "PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "ViewState": "AgIAAIgAAAAAAAAAAAA+wJYAAAAdAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-31T08:32:38.632Z" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "MainWindow.xaml.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\Md5Reader\\MainWindow.xaml.cs", + "RelativeDocumentMoniker": "Md5Reader\\MainWindow.xaml.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\Md5Reader\\MainWindow.xaml.cs", + "RelativeToolTip": "Md5Reader\\MainWindow.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAABDAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-30T02:39:22.183Z" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "MainControl.xaml.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\MainControl.xaml.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Main\\MainControl.xaml.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\MainControl.xaml.cs", + "RelativeToolTip": "PdmSwPlugin.Main\\MainControl.xaml.cs", + "ViewState": "AgIAAMAAAAAAAAAAAAAYwMoAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T04:24:56.766Z" + }, + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "Listener.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\SolidWorksListener\\Listener.cs", + "RelativeDocumentMoniker": "SolidWorksListener\\Listener.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\SolidWorksListener\\Listener.cs", + "RelativeToolTip": "SolidWorksListener\\Listener.cs", + "ViewState": "AgIAANAAAAAAAAAAAADwv90AAAAiAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T03:42:50.289Z" + }, + { + "$type": "Document", + "DocumentIndex": 9, + "Title": "AsyncAttacher.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\WpfUI\\AsyncAttacher.cs", + "RelativeDocumentMoniker": "WpfUI\\AsyncAttacher.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\WpfUI\\AsyncAttacher.cs", + "RelativeToolTip": "WpfUI\\AsyncAttacher.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAJAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T03:36:12.415Z" + }, + { + "$type": "Document", + "DocumentIndex": 10, + "Title": "SwAddin.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", + "RelativeDocumentMoniker": "PdmSw\\SwAddin.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", + "RelativeToolTip": "PdmSw\\SwAddin.cs", + "ViewState": "AgIAABMBAAAAAAAAAAAkwCYBAAAkAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T01:09:55.509Z" } ] } diff --git a/.vs/SwPlugin/v17/DocumentLayout.json b/.vs/SwPlugin/v17/DocumentLayout.json index 145e413..a0bc88a 100644 --- a/.vs/SwPlugin/v17/DocumentLayout.json +++ b/.vs/SwPlugin/v17/DocumentLayout.json @@ -3,24 +3,48 @@ "WorkspaceRootPath": "D:\\Workspace\\PdmSwPlugin2\\", "Documents": [ { - "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.main\\constant\\pluginconst.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\constant\\pluginconst.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|solutionrelative:pdmswplugin.pdm\\pdmcontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, { - "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.pdm\\pdmcontrol.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "AbsoluteMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.common\\entity\\pdm\\pdmbom.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|solutionrelative:pdmswplugin.common\\entity\\pdm\\pdmbom.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.pdm\\pdmcontrol.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", "RelativeMoniker": "D:0:0:{1033FBD8-8700-4CD0-808A-BB97DB057A6B}|PdmSwPlugin.PDM\\PdmSwPlugin.PDM.csproj|solutionrelative:pdmswplugin.pdm\\pdmcontrol.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" }, { - "AbsoluteMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|d:\\workspace\\pdmswplugin2\\pdmsw\\swaddin.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "AbsoluteMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.common\\util\\pdm\\bomtreereader.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|solutionrelative:pdmswplugin.common\\util\\pdm\\bomtreereader.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.common\\bominiter\\ywtbominiter.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{E17EF6B6-EE83-45AA-B0C0-E3A097089E97}|PdmSwPlugin.Common\\PdmSwPlugin.Common.csproj|solutionrelative:pdmswplugin.common\\bominiter\\ywtbominiter.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{3AEC586C-B22A-4ADB-B4AB-10AA660F79EC}|Md5Reader\\Md5Reader.csproj|D:\\Workspace\\PdmSwPlugin2\\md5reader\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{3AEC586C-B22A-4ADB-B4AB-10AA660F79EC}|Md5Reader\\Md5Reader.csproj|solutionrelative:md5reader\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmswplugin.main\\maincontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\maincontrol.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{CB3551F6-0C4A-4537-9A04-1E40CD475479}|SolidWorksListener\\SolidWorksListener.csproj|D:\\Workspace\\PdmSwPlugin2\\solidworkslistener\\listener.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{CB3551F6-0C4A-4537-9A04-1E40CD475479}|SolidWorksListener\\SolidWorksListener.csproj|solutionrelative:solidworkslistener\\listener.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{4536570F-AD3C-4D24-870A-63C9E9CE0FED}|WpfUI\\WpfUI.csproj|D:\\Workspace\\PdmSwPlugin2\\wpfui\\asyncattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{4536570F-AD3C-4D24-870A-63C9E9CE0FED}|WpfUI\\WpfUI.csproj|solutionrelative:wpfui\\asyncattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|D:\\Workspace\\PdmSwPlugin2\\pdmsw\\swaddin.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{7ACEDAA9-2DE8-4485-837A-E7D58812A6DC}|PdmSw\\PdmSw.csproj|solutionrelative:pdmsw\\swaddin.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.main\\swaddin\\maincontrol.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\swaddin\\maincontrol.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|d:\\workspace\\pdmswplugin2\\pdmswplugin.main\\eventhandler\\baseattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{6E609A8C-583B-4607-A510-FA84218C4A31}|PdmSwPlugin.Main\\PdmSwPlugin.Main.csproj|solutionrelative:pdmswplugin.main\\eventhandler\\baseattacher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" } ], "DocumentGroupContainers": [ @@ -34,67 +58,135 @@ "Children": [ { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 5, + "Title": "YwtBomIniter.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "RelativeToolTip": "PdmSwPlugin.Common\\BomIniter\\YwtBomIniter.cs", + "ViewState": "AgIAAEEAAAAAAAAAAAAUwBIAAAAXAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-31T09:13:45.395Z" + }, + { + "$type": "Document", + "DocumentIndex": 3, "Title": "PdmControl.xaml", "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml", "RelativeDocumentMoniker": "PdmSwPlugin.PDM\\PdmControl.xaml", "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml", "RelativeToolTip": "PdmSwPlugin.PDM\\PdmControl.xaml", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", - "WhenOpened": "2024-10-09T03:30:57.686Z", - "EditorCaption": "" + "WhenOpened": "2024-10-31T09:12:36.773Z" }, { "$type": "Document", - "DocumentIndex": 2, - "Title": "SwAddin.cs", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", - "RelativeDocumentMoniker": "PdmSw\\SwAddin.cs", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", - "RelativeToolTip": "PdmSw\\SwAddin.cs", - "ViewState": "AgIAACIAAAAAAAAAAAA5wCkAAAAvAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-26T08:51:00.927Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 4, - "Title": "BaseAttacher.cs", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "RelativeToolTip": "PdmSwPlugin.Main\\EventHandler\\BaseAttacher.cs", - "ViewState": "AgIAAKoAAAAAAAAAAAA0wMcAAAApAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-25T09:56:45.504Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "MainControl.cs", - "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "RelativeDocumentMoniker": "PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "RelativeToolTip": "PdmSwPlugin.Main\\SwAddIn\\MainControl.cs", - "ViewState": "AgIAAIwAAAAAAAAAAAA+wOQAAABDAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-25T09:54:37.505Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 0, + "DocumentIndex": 1, "Title": "PdmControl.xaml.cs", "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml.cs", "RelativeDocumentMoniker": "PdmSwPlugin.PDM\\PdmControl.xaml.cs", "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.PDM\\PdmControl.xaml.cs", "RelativeToolTip": "PdmSwPlugin.PDM\\PdmControl.xaml.cs", - "ViewState": "AgIAANAEAAAAAAAAAAAAAOIEAAAZAAAAAAAAAA==", + "ViewState": "AgIAALUEAAAAAAAAAAAuwMUEAABAAAAAAAAAAA==", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-09-25T06:09:00.747Z", + "WhenOpened": "2024-10-31T08:50:14.505Z" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "BomTreeReader.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "RelativeToolTip": "PdmSwPlugin.Common\\Util\\Pdm\\BomTreeReader.cs", + "ViewState": "AgIAAPsAAAAAAAAAAAAUwBABAAAgAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-31T08:33:38.547Z" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "PluginConst.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "RelativeToolTip": "PdmSwPlugin.Main\\Constant\\PluginConst.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T04:01:41.756Z", "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "PdmBom.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "RelativeToolTip": "PdmSwPlugin.Common\\Entity\\Pdm\\PdmBom.cs", + "ViewState": "AgIAAIgAAAAAAAAAAAA+wJYAAAAdAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-31T08:32:38.632Z" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "MainWindow.xaml.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\Md5Reader\\MainWindow.xaml.cs", + "RelativeDocumentMoniker": "Md5Reader\\MainWindow.xaml.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\Md5Reader\\MainWindow.xaml.cs", + "RelativeToolTip": "Md5Reader\\MainWindow.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAABDAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-30T02:39:22.183Z" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "MainControl.xaml.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\MainControl.xaml.cs", + "RelativeDocumentMoniker": "PdmSwPlugin.Main\\MainControl.xaml.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSwPlugin.Main\\MainControl.xaml.cs", + "RelativeToolTip": "PdmSwPlugin.Main\\MainControl.xaml.cs", + "ViewState": "AgIAAMAAAAAAAAAAAAAYwMoAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T04:24:56.766Z" + }, + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "Listener.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\SolidWorksListener\\Listener.cs", + "RelativeDocumentMoniker": "SolidWorksListener\\Listener.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\SolidWorksListener\\Listener.cs", + "RelativeToolTip": "SolidWorksListener\\Listener.cs", + "ViewState": "AgIAANAAAAAAAAAAAADwv90AAAAiAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T03:42:50.289Z" + }, + { + "$type": "Document", + "DocumentIndex": 9, + "Title": "AsyncAttacher.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\WpfUI\\AsyncAttacher.cs", + "RelativeDocumentMoniker": "WpfUI\\AsyncAttacher.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\WpfUI\\AsyncAttacher.cs", + "RelativeToolTip": "WpfUI\\AsyncAttacher.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAJAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T03:36:12.415Z" + }, + { + "$type": "Document", + "DocumentIndex": 10, + "Title": "SwAddin.cs", + "DocumentMoniker": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", + "RelativeDocumentMoniker": "PdmSw\\SwAddin.cs", + "ToolTip": "D:\\Workspace\\PdmSwPlugin2\\PdmSw\\SwAddin.cs", + "RelativeToolTip": "PdmSw\\SwAddin.cs", + "ViewState": "AgIAABMBAAAAAAAAAAAkwCYBAAAkAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-10-14T01:09:55.509Z" } ] } diff --git a/AutoUpdater/MainWindow.xaml.cs b/AutoUpdater/MainWindow.xaml.cs index 76d46fa..b4b590a 100644 --- a/AutoUpdater/MainWindow.xaml.cs +++ b/AutoUpdater/MainWindow.xaml.cs @@ -2,12 +2,12 @@ using AutoUpdater.Util; using ICSharpCode.SharpZipLib.Zip; using log4net; +using Microsoft.Win32; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; -using System.Runtime.InteropServices; using System.Threading; using System.Windows; using VersionControl; @@ -130,20 +130,27 @@ /// </summary> public void StartListenerProcess() { - string dir = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); - string path1 = Path.Combine(dir, "Listener", "SolidWorksListener.exe"); - if (File.Exists(path1)) + try { - ProcessStartInfo info = new ProcessStartInfo + string dir = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); + string path1 = Path.Combine(dir, "Listener", "SolidWorksListener.exe"); + if (File.Exists(path1)) { - FileName = path1, - WorkingDirectory = Path.GetDirectoryName(path1) - }; + ProcessStartInfo info = new ProcessStartInfo + { + FileName = path1, + WorkingDirectory = Path.GetDirectoryName(path1) + }; - new Process - { - StartInfo = info - }.Start(); + new Process + { + StartInfo = info + }.Start(); + } + } + catch (Exception ex) + { + Logger.Error("Start Listener Process Error!", ex); } } @@ -330,10 +337,60 @@ DoFinished(); } - private void DoFinished() + /// <summary> + /// 妫�鏌ヨ嚜鍚姩娉ㄥ唽琛� + /// </summary> + private void CheckAutoRunRegKey() { + RegistryKey root = null; + RegistryKey key = null; + try + { + root = Registry.CurrentUser; + key = root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); + string name = "SolidWorksListener"; + if (key == null) + { + key = root.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); + } + // 娌℃湁璺緞鎴栬�呰矾寰勬寚鍚慹xe涓嶅锛屽氨鏇存柊鑷惎鍔ㄨ矾寰� + string listenerPath = key.GetValue(name)?.ToString(); + string rootDir = new DirectoryInfo(Assembly.GetExecutingAssembly().Location).Parent.Parent.FullName; + string newPath = Path.Combine(rootDir, "Listener", "SolidWorksListener.exe"); + //listenerPath = listenerPath.Replace("\"", ""); + if (string.IsNullOrEmpty(listenerPath) || new Uri(listenerPath) != new Uri(newPath)) + { + key.SetValue(name, newPath, RegistryValueKind.String); + } + } + catch (Exception e) + { + Logger.Error("CheckAutoRunRegKey Failed!", e); + } + finally + { + try + { + if (key != null) key.Close(); + if (root != null) root.Close(); + } + catch (Exception ex) + { + Logger.Error("Reg Key Close Failed!", ex); + } + } + } + + private void BeforeRestart() + { + CheckAutoRunRegKey(); // 鍚姩鐩戝惉杩涚▼ StartListenerProcess(); + } + + private void DoFinished() + { + BeforeRestart(); label.Content = "鏇存柊瀹屾垚"; bar.IsIndeterminate = false; if (SwAppPath != null) diff --git a/InnoSetupScript/PdmSwPlugin.iss b/InnoSetupScript/PdmSwPlugin.iss index 1f3ea2a..b520d2d 100644 --- a/InnoSetupScript/PdmSwPlugin.iss +++ b/InnoSetupScript/PdmSwPlugin.iss @@ -7,7 +7,7 @@ ; 自动更新程序路径 #define AutoUpdaterDir = "D:\Workspace\PdmSwPlugin2\PdmSw\bin\x64\Release\AutoUpdater\" ; 版本 -#define Version = "_0.0.0.42" +#define Version = "_0.0.0.43_改" ; 生成的Installer存放路径 #define OutPutDir = "Z:\Output" @@ -81,7 +81,7 @@ ;Root: HKLM64; Subkey: "SYSTEM\CurrentControlSet\Services\SolidWorks Listener"; ValueType: dword; ValueName: "Type"; ValueData: 272; Flags: deletevalue ; 监听器2.0 -Root: HKCU64; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "SolidWorksListener"; ValueData: """{app}\Listener\SolidWorksListener.exe"""; Flags: deletevalue uninsdeletevalue +Root: HKCU64; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "SolidWorksListener"; ValueData: "{app}\Listener\SolidWorksListener.exe"; Flags: deletevalue uninsdeletevalue [Icons] diff --git a/Md5Reader/App.config b/Md5Reader/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Md5Reader/App.config @@ -0,0 +1,6 @@ +锘�<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> + </startup> +</configuration> \ No newline at end of file diff --git a/Md5Reader/App.xaml b/Md5Reader/App.xaml new file mode 100644 index 0000000..0444c01 --- /dev/null +++ b/Md5Reader/App.xaml @@ -0,0 +1,9 @@ +锘�<Application x:Class="Md5Reader.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Md5Reader" + StartupUri="MainWindow.xaml"> + <Application.Resources> + + </Application.Resources> +</Application> diff --git a/Md5Reader/App.xaml.cs b/Md5Reader/App.xaml.cs new file mode 100644 index 0000000..1454454 --- /dev/null +++ b/Md5Reader/App.xaml.cs @@ -0,0 +1,17 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Md5Reader +{ + /// <summary> + /// App.xaml 鐨勪氦浜掗�昏緫 + /// </summary> + public partial class App : Application + { + } +} diff --git a/Md5Reader/MainWindow.xaml b/Md5Reader/MainWindow.xaml new file mode 100644 index 0000000..ddc8f6e --- /dev/null +++ b/Md5Reader/MainWindow.xaml @@ -0,0 +1,22 @@ +锘�<Window x:Class="Md5Reader.MainWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Md5Reader" + mc:Ignorable="d" + Title="MD5宸ュ叿" Height="450" Width="800"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition/> + </Grid.ColumnDefinitions> + <Button Grid.Row="0" Grid.Column="0" Padding="20" Click="Button_Click">鎵撳紑鏂囦欢</Button> + <TextBox Grid.Row="0" Grid.Column="1" IsReadOnly="True" x:Name="pathInput"></TextBox> + <TextBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" IsReadOnly="True" TextWrapping="WrapWithOverflow" x:Name="consoleInput"></TextBox> + </Grid> +</Window> diff --git a/Md5Reader/MainWindow.xaml.cs b/Md5Reader/MainWindow.xaml.cs new file mode 100644 index 0000000..9f25293 --- /dev/null +++ b/Md5Reader/MainWindow.xaml.cs @@ -0,0 +1,29 @@ +锘縰sing PdmSwPlugin.Common.Util; +using System.Windows; +using System.Windows.Forms; + +namespace Md5Reader +{ + /// <summary> + /// MainWindow.xaml 鐨勪氦浜掗�昏緫 + /// </summary> + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Multiselect = false; + if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + pathInput.Text = openFileDialog.FileName; + string md5 = MD5Util.Md5SHA1(openFileDialog.FileName); + consoleInput.Text += $"鏂囦欢璺緞: {openFileDialog.FileName}\r\nMD5: {md5}\r\n\r\n"; + } + } + } +} diff --git a/Md5Reader/Md5Reader.csproj b/Md5Reader/Md5Reader.csproj new file mode 100644 index 0000000..ea3edf8 --- /dev/null +++ b/Md5Reader/Md5Reader.csproj @@ -0,0 +1,125 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{3AEC586C-B22A-4ADB-B4AB-10AA660F79EC}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>Md5Reader</RootNamespace> + <AssemblyName>Md5Reader</AssemblyName> + <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x64\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>x64</PlatformTarget> + <LangVersion>7.3</LangVersion> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <OutputPath>bin\x64\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <Optimize>true</Optimize> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x64</PlatformTarget> + <LangVersion>7.3</LangVersion> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="MainWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Compile Include="MainWindow.xaml.cs"> + <DependentUpon>MainWindow.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\PdmSwPlugin.Common\PdmSwPlugin.Common.csproj"> + <Project>{e17ef6b6-ee83-45aa-b0c0-e3a097089e97}</Project> + <Name>PdmSwPlugin.Common</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/Md5Reader/Properties/AssemblyInfo.cs b/Md5Reader/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9ae6b6c --- /dev/null +++ b/Md5Reader/Properties/AssemblyInfo.cs @@ -0,0 +1,52 @@ +锘縰sing System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 鏈夊叧绋嬪簭闆嗙殑涓�鑸俊鎭敱浠ヤ笅 +// 鎺у埗銆傛洿鏀硅繖浜涚壒鎬у�煎彲淇敼 +// 涓庣▼搴忛泦鍏宠仈鐨勪俊鎭�� +[assembly: AssemblyTitle("Md5Reader")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Md5Reader")] +[assembly: AssemblyCopyright("Copyright 漏 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 灏� ComVisible 璁剧疆涓� false 浼氫娇姝ょ▼搴忛泦涓殑绫诲瀷 +//瀵� COM 缁勪欢涓嶅彲瑙併�傚鏋滈渶瑕佷粠 COM 璁块棶姝ょ▼搴忛泦涓殑绫诲瀷 +//璇峰皢姝ょ被鍨嬬殑 ComVisible 鐗规�ц缃负 true銆� +[assembly: ComVisible(false)] + +//鑻ヨ寮�濮嬬敓鎴愬彲鏈湴鍖栫殑搴旂敤绋嬪簭锛岃璁剧疆 +//.csproj 鏂囦欢涓殑 <UICulture>CultureYouAreCodingWith</UICulture> +//鍦� <PropertyGroup> 涓�備緥濡傦紝濡傛灉浣犱娇鐢ㄧ殑鏄編鍥借嫳璇�� +//浣跨敤鐨勬槸缇庡浗鑻辫锛岃灏� <UICulture> 璁剧疆涓� en-US銆� 鐒跺悗鍙栨秷 +//瀵逛互涓� NeutralResourceLanguage 鐗规�х殑娉ㄩ噴銆� 鏇存柊 +//浠ヤ笅琛屼腑鐨勨�渆n-US鈥濅互鍖归厤椤圭洰鏂囦欢涓殑 UICulture 璁剧疆銆� + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //涓婚鐗瑰畾璧勬簮璇嶅吀鎵�澶勪綅缃� + //(鏈湪椤甸潰涓壘鍒拌祫婧愭椂浣跨敤锛� + //鎴栧簲鐢ㄧ▼搴忚祫婧愬瓧鍏镐腑鎵惧埌鏃朵娇鐢�) + ResourceDictionaryLocation.SourceAssembly //甯歌璧勬簮璇嶅吀鎵�澶勪綅缃� + //(鏈湪椤甸潰涓壘鍒拌祫婧愭椂浣跨敤锛� + //銆佸簲鐢ㄧ▼搴忔垨浠讳綍涓婚涓撶敤璧勬簮瀛楀吀涓壘鍒版椂浣跨敤) +)] + + +// 绋嬪簭闆嗙殑鐗堟湰淇℃伅鐢变笅鍒楀洓涓�肩粍鎴�: +// +// 涓荤増鏈� +// 娆$増鏈� +// 鐢熸垚鍙� +// 淇鍙� +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Md5Reader/Properties/Resources.Designer.cs b/Md5Reader/Properties/Resources.Designer.cs new file mode 100644 index 0000000..453224d --- /dev/null +++ b/Md5Reader/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +锘�//------------------------------------------------------------------------------ +// <auto-generated> +// 姝や唬鐮佺敱宸ュ叿鐢熸垚銆� +// 杩愯鏃剁増鏈�: 4.0.30319.42000 +// +// 瀵规鏂囦欢鐨勬洿鏀瑰彲鑳藉鑷翠笉姝g‘鐨勮涓猴紝濡傛灉 +// 閲嶆柊鐢熸垚浠g爜锛屽垯鎵�鍋氭洿鏀瑰皢涓㈠け銆� +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Md5Reader.Properties +{ + + + /// <summary> + /// 寮虹被鍨嬭祫婧愮被锛岀敤浜庢煡鎵炬湰鍦板寲瀛楃涓茬瓑銆� + /// </summary> + // 姝ょ被鏄敱 StronglyTypedResourceBuilder + // 绫婚�氳繃绫讳技浜� ResGen 鎴� Visual Studio 鐨勫伐鍏疯嚜鍔ㄧ敓鎴愮殑銆� + // 鑻ヨ娣诲姞鎴栫Щ闄ゆ垚鍛橈紝璇风紪杈� .ResX 鏂囦欢锛岀劧鍚庨噸鏂拌繍琛� ResGen + // (浠� /str 浣滀负鍛戒护閫夐」)锛屾垨閲嶆柊鐢熸垚 VS 椤圭洰銆� + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// <summary> + /// 杩斿洖姝ょ被浣跨敤鐨勭紦瀛� ResourceManager 瀹炰緥銆� + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Md5Reader.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// 閲嶅啓褰撳墠绾跨▼鐨� CurrentUICulture 灞炴�э紝瀵� + /// 浣跨敤姝ゅ己绫诲瀷璧勬簮绫荤殑鎵�鏈夎祫婧愭煡鎵炬墽琛岄噸鍐欍�� + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Md5Reader/Properties/Resources.resx b/Md5Reader/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Md5Reader/Properties/Resources.resx @@ -0,0 +1,117 @@ +锘�<?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.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: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" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </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" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/Md5Reader/Properties/Settings.Designer.cs b/Md5Reader/Properties/Settings.Designer.cs new file mode 100644 index 0000000..86902cc --- /dev/null +++ b/Md5Reader/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +锘�//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Md5Reader.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Md5Reader/Properties/Settings.settings b/Md5Reader/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/Md5Reader/Properties/Settings.settings @@ -0,0 +1,7 @@ +锘�<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> \ No newline at end of file diff --git a/PdmSw/SwAddin.cs b/PdmSw/SwAddin.cs index f9f530b..937fea0 100644 --- a/PdmSw/SwAddin.cs +++ b/PdmSw/SwAddin.cs @@ -126,6 +126,8 @@ private BaseAttacher attacher; private ISldWorks swApp; + private TaskpaneView panel; + private Form mainForm; // Public Properties public ISldWorks SwApp { @@ -274,7 +276,7 @@ Path.Combine(imageFolder, @"MatChooser_128X128.png") }; // 创建Panel - TaskpaneView panel = SwApp.CreateTaskpaneView3(bitmaps, "PdmSwPlugin" + PluginConst.Version); + panel = SwApp.CreateTaskpaneView3(bitmaps, "PdmSwPlugin" + PluginConst.Version); mainControl = new MainControl((SldWorks)SwApp); // 只能用winform,代理wpf @@ -284,7 +286,7 @@ AutoSize = true, Dock = DockStyle.Fill }; - Form form = new Form + mainForm = new Form { Text = "PdmSwPlugin", ControlBox = false, @@ -292,10 +294,11 @@ KeyPreview = true, Dock = DockStyle.Fill }; - form.Controls.Add(host); - IntPtr ptr = form.Handle; + mainForm.Controls.Add(host); + IntPtr ptr = mainForm.Handle; // IntPtr ptr = WindowIntPtrUtil.FindWindow(null, "Window1"); panel.DisplayWindowFromHandlex64(ptr.ToInt64()); + mainForm.WindowState = FormWindowState.Maximized; } private void LoadPlugins() @@ -327,23 +330,36 @@ /// <returns></returns> public bool DisconnectFromSW() { - RemoveCommandMgr(); - RemovePMP(); - mainControl.StopTcpServer(); - attacher.DetachEventHandlers(); - attacher = null; + try + { + RemoveCommandMgr(); + RemovePMP(); + mainControl.StopTcpServer(); + mainControl.DeActiveHandler(); + attacher.DetachEventHandlers(); + attacher = null; - System.Runtime.InteropServices.Marshal.ReleaseComObject(iCmdMgr); - iCmdMgr = null; - System.Runtime.InteropServices.Marshal.ReleaseComObject(SwApp); - swApp = null; - //The addin _must_ call GC.Collect() here in order to retrieve all managed code pointers - GC.Collect(); - GC.WaitForPendingFinalizers(); + mainForm.Close(); + mainForm = null; + mainControl = null; + panel.DeleteView(); + panel = null; - GC.Collect(); - GC.WaitForPendingFinalizers(); + Marshal.ReleaseComObject(iCmdMgr); + iCmdMgr = null; + Marshal.ReleaseComObject(SwApp); + swApp = null; + //The addin _must_ call GC.Collect() here in order to retrieve all managed code pointers + GC.Collect(); + GC.WaitForPendingFinalizers(); + //GC.Collect(); + //GC.WaitForPendingFinalizers(); + } + catch (Exception ex) + { + Logger.Error("DisconnectFromSW Failed!", ex); + } return true; } #endregion diff --git a/PdmSwPlugin.Common/BomIniter/NameUtil.cs b/PdmSwPlugin.Common/BomIniter/NameUtil.cs index 79cec69..f3bb049 100644 --- a/PdmSwPlugin.Common/BomIniter/NameUtil.cs +++ b/PdmSwPlugin.Common/BomIniter/NameUtil.cs @@ -5,8 +5,6 @@ { public class NameUtil { - public static readonly PluginSetting setting = PluginSetting.Instance; - /// <summary> /// 鍒ゆ柇鏂囨。鏄惁鏄巻鍙叉枃妗� /// </summary> @@ -14,12 +12,15 @@ /// <returns>true 鏄� false 涓嶆槸</returns> public static bool IsHistoryDoc(string name) { + CustomerSetting setting = CustomerSetting.Instance; if (string.IsNullOrEmpty(name)) return false; - if (setting.HistoryDateFlag < 0) return false; + string historyFlagStr = setting["historyFlag"]; + _ = long.TryParse(historyFlagStr, out long flag); + if (flag < 0) return false; try { long historyFlag = long.Parse(name.Substring(0, 8)); - if (historyFlag <= setting.HistoryDateFlag) + if (historyFlag <= flag) { return true; } diff --git a/PdmSwPlugin.Common/BomIniter/YwtBomIniter.cs b/PdmSwPlugin.Common/BomIniter/YwtBomIniter.cs index 5aae542..6b105f0 100644 --- a/PdmSwPlugin.Common/BomIniter/YwtBomIniter.cs +++ b/PdmSwPlugin.Common/BomIniter/YwtBomIniter.cs @@ -10,8 +10,6 @@ public class YwtBomIniter : BomIniter { public static PluginSetting setting = PluginSetting.Instance; - public string jgjNameRegx { get; private set; } = CustomerSetting.Instance["jgjNameRegx"]; - public string standardNameRegx { get; private set; } = CustomerSetting.Instance["standardNameRegx"]; public void InitBom(PdmBom bom) { @@ -27,16 +25,20 @@ bom.xc = false; bom.mn = false; + string jgjNameRegx = CustomerSetting.Instance["jgjNameRegx"]; + string standardNameRegx = CustomerSetting.Instance["standardNameRegx"]; + if (Regex.IsMatch(childName, jgjNameRegx)) { - if (bom._drawInfo != null) { + if (bom._drawInfo != null) + { bom._drawInfo.HistoryData = NameUtil.IsHistoryDoc(childName); } string docType = bom.properties.Get("鏂囦欢鏍煎紡"); if (string.IsNullOrEmpty(docType)) { - bom.produceWay = "鏍囧噯浠�"; + bom.produceWay = "鍔犲伐浠�"; } else { @@ -72,12 +74,14 @@ /// <returns></returns> public bool IsJgjPanel(ModelDoc2 doc) { + string jgjNameRegx = CustomerSetting.Instance["jgjNameRegx"]; string fileName = Path.GetFileNameWithoutExtension(doc.GetPathName()); return Regex.IsMatch(fileName, jgjNameRegx); } public bool IsJgj(ModelDoc2 doc) { + string jgjNameRegx = CustomerSetting.Instance["jgjNameRegx"]; string fileName = Path.GetFileNameWithoutExtension(doc.GetPathName()); return Regex.IsMatch(fileName, jgjNameRegx); } @@ -85,6 +89,8 @@ public bool IsStandard(ModelDoc2 doc) { string fileName = doc.GetPathName(); + string standardNameRegx = CustomerSetting.Instance["standardNameRegx"]; + fileName = Path.GetFileNameWithoutExtension(fileName); return Regex.IsMatch(fileName, standardNameRegx); } diff --git a/PdmSwPlugin.Common/Control/RichHisWindow.xaml b/PdmSwPlugin.Common/Control/RichHisWindow.xaml index ca08eb9..9167624 100644 --- a/PdmSwPlugin.Common/Control/RichHisWindow.xaml +++ b/PdmSwPlugin.Common/Control/RichHisWindow.xaml @@ -11,9 +11,9 @@ Height="600" Width="1200"> <DataGrid x:Name="table" ItemsSource="{Binding HisList}" AutoGenerateColumns="False" - EnableRowVirtualization="False" CanUserAddRows="False" ColumnWidth="*" + ScrollViewer.CanContentScroll="False" CanUserSortColumns="False" CanUserDeleteRows="False"> <DataGrid.Columns> diff --git a/PdmSwPlugin.Common/Control/RichHisWindow.xaml.cs b/PdmSwPlugin.Common/Control/RichHisWindow.xaml.cs index 3893ec3..ce3c459 100644 --- a/PdmSwPlugin.Common/Control/RichHisWindow.xaml.cs +++ b/PdmSwPlugin.Common/Control/RichHisWindow.xaml.cs @@ -62,6 +62,7 @@ else { this.HisList = new ObservableCollection<DrawAuditHis>(hisList); + table.ScrollIntoView(HisList[0]); } } diff --git a/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs b/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs index d8f53e0..7cddf17 100644 --- a/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs +++ b/PdmSwPlugin.Common/Entity/Pdm/PdmBom.cs @@ -43,6 +43,7 @@ public Component2 component { get; set; } public bool lost { get; set; } = false; + public bool isHidden { get; set; } = false; public bool suppressed { get; set; } = false; public bool lightWeight { get; set; } = false; @@ -147,6 +148,8 @@ private int? _checkRuleResult = 0; + public bool isHidden; + public int? checkRuleResult { get => _checkRuleResult; @@ -204,7 +207,10 @@ public Dictionary<string, string> properties => BomInfo?.properties; public string d3FilePath => BomInfo?.d3FilePath; public string filePath => BomInfo?.filePath; - public bool lost => BomInfo?.lost == true; + public bool lost => BomInfo?.lost == true || isHidden; + + public bool isHidden = false; + public bool suppressed => BomInfo?.suppressed == true; public bool lightWeight => BomInfo?.lightWeight == true; @@ -243,7 +249,7 @@ /// <summary> /// 瑙勫垯妫�鏌ョ粨鏋� /// </summary> - public int? checkRuleResult => (IsHistoryData || skipCheck) ? 3 : _drawInfo?.checkRuleResult; + public int? checkRuleResult => (IsHistoryData || skipCheck) ? 3 : (isHidden ? 2 : _drawInfo?.checkRuleResult); /// <summary> /// 妫�鏌ユ槸鍚K /// </summary> @@ -260,6 +266,8 @@ } } + public List<string> ErrorMsgs; + /// <summary> /// 鏄惁闇�瑕佸鏍� /// </summary> @@ -273,7 +281,7 @@ if (ExcludeFromBOM) return false; // 妯$粍涓嶅鏍� if (produceWay == "妯$粍") return false; - // 寰呭鏍哥殑涓嶅啿绐佹彁浜� + // 寰呭鏍哥殑涓嶉噸澶嶆彁浜� if (drawStatus == "submitted" || drawStatus == "resubmitted") return false; if (IsHistoryData) { @@ -300,14 +308,25 @@ if (ExcludeFromBOM) return null; if (IsHistoryData) { + bool err = false; + string msg = $"鍘嗗彶鍥剧焊銆恵partModel}銆�"; if (localDocChanged) { - return $"鍘嗗彶鍥剧焊銆恵partModel}銆戝彉鏇村悗鏈噸鏂板鏍�"; + err = true; + msg += "鍙樻洿鍚庢湭閲嶆柊瀹℃牳;"; } else if (drawStatus == "rejected" || drawStatus == "submitted" || drawStatus == "resubmitted") { - return $"鍘嗗彶鍥剧焊銆恵partModel}銆戞湭閫氳繃瀹℃牳"; + err = true; + msg += "鏈�氳繃瀹℃牳"; } + + if (isHidden) + { + err = true; + msg += "琚殣钘�;"; + } + return err ? msg : null; } if (!IsHistoryData) { @@ -316,7 +335,12 @@ if (!skipCheck && !checkRuleOk) { error = true; - msg += "鏈�氳繃瑙勫垯妫�鏌�"; + msg += "鏈�氳繃瑙勫垯妫�鏌�;"; + } + if (!skipCheck && isHidden) + { + error = true; + msg += "琚殣钘�;"; } if (produceWay == "鍔犲伐浠�" && drawStatus != "completed") { diff --git a/PdmSwPlugin.Common/Setting/CustomerSetting.cs b/PdmSwPlugin.Common/Setting/CustomerSetting.cs index 3fec6ac..79a7bda 100644 --- a/PdmSwPlugin.Common/Setting/CustomerSetting.cs +++ b/PdmSwPlugin.Common/Setting/CustomerSetting.cs @@ -16,10 +16,7 @@ public static void Set(Dictionary<string, string> Settings) { - if (Instance == null) - { - Instance = new CustomerSetting(Settings); - } + Instance = new CustomerSetting(Settings); } public string this[string field] diff --git a/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs b/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs index f40a1f3..136ad88 100644 --- a/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs +++ b/PdmSwPlugin.Common/Util/CustomPropertyUtil.cs @@ -31,6 +31,13 @@ } } + /// <summary> + /// 鑾峰彇鏂囨。灞炴�� + /// </summary> + /// <param name="currentModelDoc">鏂囨。</param> + /// <param name="needResolve">鏄惁杞崲鍊�</param> + /// <param name="skipName">璺宠繃鐨刵ame</param> + /// <returns></returns> public static Dictionary<string, string> GetCustomProperties2(ModelDoc2 currentModelDoc, bool needResolve, HashSet<string> skipName = null) diff --git a/PdmSwPlugin.Common/Util/LimitedConcurrencyLevelTaskScheduler.cs b/PdmSwPlugin.Common/Util/LimitedConcurrencyLevelTaskScheduler.cs index 13e41d6..dbbebdc 100644 --- a/PdmSwPlugin.Common/Util/LimitedConcurrencyLevelTaskScheduler.cs +++ b/PdmSwPlugin.Common/Util/LimitedConcurrencyLevelTaskScheduler.cs @@ -8,15 +8,15 @@ /// <summary> /// https://learn.microsoft.com/zh-cn/dotnet/api/system.threading.tasks.taskscheduler?view=netframework-4.7.2 /// </summary> - public class LimitedConcurrencyLevelTaskScheduler : TaskScheduler + public class LimitedConcurrencyLevelTaskSchedulerMsn : TaskScheduler { - public static LimitedConcurrencyLevelTaskScheduler Instance { get; private set; } + public static LimitedConcurrencyLevelTaskSchedulerMsn Instance { get; private set; } public static TaskFactory Factory { get; private set; } - static LimitedConcurrencyLevelTaskScheduler() + static LimitedConcurrencyLevelTaskSchedulerMsn() { - Instance = new LimitedConcurrencyLevelTaskScheduler(Environment.ProcessorCount * 10); + Instance = new LimitedConcurrencyLevelTaskSchedulerMsn(Environment.ProcessorCount * 10); Factory = new TaskFactory(Instance); } @@ -34,7 +34,7 @@ private int _delegatesQueuedOrRunning = 0; // Creates a new instance with the specified degree of parallelism. - public LimitedConcurrencyLevelTaskScheduler(int maxDegreeOfParallelism) + public LimitedConcurrencyLevelTaskSchedulerMsn(int maxDegreeOfParallelism) { if (maxDegreeOfParallelism < 1) throw new ArgumentOutOfRangeException("maxDegreeOfParallelism"); _maxDegreeOfParallelism = maxDegreeOfParallelism; diff --git a/PdmSwPlugin.Common/Util/Pdm/BomTreeReader.cs b/PdmSwPlugin.Common/Util/Pdm/BomTreeReader.cs index bd955b9..f8bba5f 100644 --- a/PdmSwPlugin.Common/Util/Pdm/BomTreeReader.cs +++ b/PdmSwPlugin.Common/Util/Pdm/BomTreeReader.cs @@ -16,7 +16,7 @@ { public BomTreeReader() { - factory = LimitedConcurrencyLevelTaskScheduler.Factory; + factory = LimitedConcurrencyLevelTaskSchedulerMsn.Factory; } public TaskFactory factory; @@ -260,6 +260,10 @@ private static PdmBom ConcatCacheBom(BomInfo info, int level, PdmBom parent, Component2 component) { if (info == null) return null; + //if (component.IsHidden(true)) + //{ + // info.isHidden = true; + //} PdmBom bom = new PdmBom { BomInfo = info, @@ -267,7 +271,8 @@ level = level, quantity = 1, parent = parent, - component = component + component = component, + isHidden = component.IsHidden(true) }; // 灏佽Bom淇℃伅 bom.Init(); diff --git a/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs b/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs index 620746a..32b593d 100644 --- a/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs +++ b/PdmSwPlugin.DrawApprove/DrawApprove.xaml.cs @@ -260,16 +260,24 @@ private void OpenDrw_Click(object sender, RoutedEventArgs e) { - Button btn = sender as Button; - DrawAudit da = btn.DataContext as DrawAudit; - string filePath = GetRealFilePath(da.d2RelativePath); - if (!File.Exists(filePath)) + try { - this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板伐绋嬪浘鏂囦欢锛岃矾寰�:{filePath}"); - return; + Button btn = sender as Button; + DrawAudit da = btn.DataContext as DrawAudit; + string filePath = GetRealFilePath(da.d2RelativePath); + if (!File.Exists(filePath)) + { + this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板伐绋嬪浘鏂囦欢锛岃矾寰�:{filePath}"); + return; + } + OpenDocMayError(filePath, (int)swDocumentTypes_e.swDocDRAWING, (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly, + ""); } - OpenDocMayError(filePath, (int)swDocumentTypes_e.swDocDRAWING, (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly, - ""); + catch (Exception ex) + { + this.Error($"鎵撳紑宸ョ▼鍥惧紓甯革紒{ex}"); + Logger.Error("Open Drw Error!", ex); + } } private string GetRealFilePath(string relativePath) @@ -282,17 +290,25 @@ private void OpenDoc_Click(object sender, RoutedEventArgs e) { - Button btn = sender as Button; - DrawAudit da = btn.DataContext as DrawAudit; - string filePath = GetRealFilePath(da.d3RelativePath); - if (!File.Exists(filePath)) + try { - this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板浘绾告枃浠讹紝璺緞:{filePath}"); - return; - } + Button btn = sender as Button; + DrawAudit da = btn.DataContext as DrawAudit; + string filePath = GetRealFilePath(da.d3RelativePath); + if (!File.Exists(filePath)) + { + this.Error($"鏈嶅姟鍣ㄤ腑鏈壘鍒板浘绾告枃浠讹紝璺緞:{filePath}"); + return; + } - OpenDocMayError(filePath, (int)FileExtentionChecker.Check(filePath, out _), (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly, - ""); + OpenDocMayError(filePath, (int)FileExtentionChecker.Check(filePath, out _), (int)swOpenDocOptions_e.swOpenDocOptions_ReadOnly, + ""); + } + catch (Exception ex) + { + this.Error($"鎵撳紑鍥剧焊寮傚父锛亄ex}"); + Logger.Error("Open 3D Doc Error!", ex); + } } public List<DrawAudit> RefreshList() diff --git a/PdmSwPlugin.Main/Constant/PluginConst.cs b/PdmSwPlugin.Main/Constant/PluginConst.cs index 6470d7c..522d835 100644 --- a/PdmSwPlugin.Main/Constant/PluginConst.cs +++ b/PdmSwPlugin.Main/Constant/PluginConst.cs @@ -3,6 +3,6 @@ public class PluginConst { public static readonly string AppId = "DF23E96F-A469-4302-8367-7FA2F798CD09"; - public static readonly string Version = "0.0.0.42"; + public static readonly string Version = "0.0.0.44"; } } diff --git a/PdmSwPlugin.Main/MainControl.xaml.cs b/PdmSwPlugin.Main/MainControl.xaml.cs index f2ed4ac..8f0049f 100644 --- a/PdmSwPlugin.Main/MainControl.xaml.cs +++ b/PdmSwPlugin.Main/MainControl.xaml.cs @@ -18,6 +18,8 @@ using SuperSocket.SocketBase; using SuperSocket.SocketBase.Protocol; using PdmSwPlugin.Main.Tcp; +using SolidWorks.Interop.swconst; +using System.Windows.Interop; namespace PdmSwPlugin.Main { @@ -121,6 +123,20 @@ string updaterPath = "AutoUpdater\\AutoUpdater.exe"; string exePath = new DirectoryInfo(Assembly.GetExecutingAssembly().Location).Parent.FullName; string exeFileName = $"{exePath}\\{updaterPath}"; + //if (SwApp.SendMsgToUser2("妫�娴嬪埌鎻掍欢鏇存柊锛屾槸鍚︾珛鍒绘洿鏂帮紵锛堣娉ㄦ剰淇濆瓨褰撳墠宸ヤ綔锛�", (int)swMessageBoxIcon_e.swMbInformation, (int)swMessageBoxBtn_e.swMbYesNo) + // == (int)swMessageBoxResult_e.swMbHitYes) + //{ + // Process updaterProcess = new Process + // { + // StartInfo = new ProcessStartInfo + // { + // FileName = exeFileName, + // Arguments = mainProcessId + "" + // } + // }; + // updaterProcess.Start(); + //} + // 闈炲繀瑕佹洿鏂� new Task(() => { @@ -209,9 +225,29 @@ public void Logout() { - string binPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "HengXin", "PdmSwPlugin", "bin"); - File.Delete(binPath); - DeActiveHandler(); + try + { + // 鍒犻櫎缂撳瓨bin鏂囦欢 + string binPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "HengXin", "PdmSwPlugin", "bin"); + File.Delete(binPath); + } + catch (Exception ex) + { + //SwApp.SendMsgToUser2("鐢ㄦ埛缂撳瓨娓呯悊澶辫触锛�", (int)swMessageBoxIcon_e.swMbWarning, (int)swMessageBoxBtn_e.swMbOk); + Logger.Error("Delete User Bin File Failed.", ex); + } + + try + { + // 娓呴櫎UserControl浜嬩欢 + DeActiveHandler(); + } + catch (Exception ex) + { + SwApp.SendMsgToUser2("鍙戠敓鏈煡寮傚父锛岃鎯呰瑙佹棩蹇楋紒", (int)swMessageBoxIcon_e.swMbWarning, (int)swMessageBoxBtn_e.swMbOk); + Logger.Error("DeActiveHandler Failed.", ex); + } + mainTab.tabControl.Items.Clear(); PdmUser.SetLoginUser(null); mainBorder.Child = new LoginControl(LoginSuccess); @@ -238,7 +274,7 @@ private void self_Unloaded(object sender, RoutedEventArgs e) { - StopTcpServer(); + // StopTcpServer(); } } } diff --git a/PdmSwPlugin.Main/MainTab.xaml b/PdmSwPlugin.Main/MainTab.xaml index df56dfe..8501c1b 100644 --- a/PdmSwPlugin.Main/MainTab.xaml +++ b/PdmSwPlugin.Main/MainTab.xaml @@ -19,9 +19,12 @@ <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <TabControl Grid.Row="0" x:Name="tabControl"></TabControl> - <StatusBar Grid.Row="1" Padding="0" Margin="0" VerticalContentAlignment="Center"> - <Label x:Name="userLabel" FontWeight="Bold" Padding="0" Margin="0" /> - <Button Style="{StaticResource LinkButton}" Click="Button_Click">閫�鍑虹櫥褰�</Button> - </StatusBar> + <DockPanel Grid.Row="1" Margin="0" LastChildFill="False"> + <Label DockPanel.Dock="Left" x:Name="userLabel" FontWeight="Bold" Padding="0" Margin="0,0,20,0" /> + <Button DockPanel.Dock="Left" Style="{StaticResource LinkButton}" Click="Button_Click">閫�鍑虹櫥褰�</Button> + <Button DockPanel.Dock="Right" Style="{StaticResource LinkButton}" Margin="0,0,20,0" Click="Refresh_Click">鍒锋柊</Button> + <Label DockPanel.Dock="Right" x:Name="configLabel" FontWeight="Bold" Padding="0" Margin="0,0,20,0" /> + <Label DockPanel.Dock="Right" FontWeight="Bold" Padding="0" Content="鍘嗗彶鑺傜偣:" /> + </DockPanel> </Grid> </UserControl> diff --git a/PdmSwPlugin.Main/MainTab.xaml.cs b/PdmSwPlugin.Main/MainTab.xaml.cs index b006421..96c975c 100644 --- a/PdmSwPlugin.Main/MainTab.xaml.cs +++ b/PdmSwPlugin.Main/MainTab.xaml.cs @@ -5,6 +5,10 @@ using System.Windows; using System.Windows.Controls; using SolidWorks.Interop.swconst; +using PdmSwPlugin.Common.Setting; +using System.Threading.Tasks; +using PdmSwPlugin.Common.Util.Http; +using System.Collections.Generic; namespace PdmSwPlugin.Main { @@ -19,6 +23,7 @@ this.logout = logout; InitializeComponent(); userLabel.Content = $"娆㈣繋鎮紝{PdmUser.LoginUser?.realname}"; + configLabel.Content = CustomerSetting.Instance["historyFlag"]; } private SldWorks swApp; @@ -37,5 +42,30 @@ logout(); } } + + private void Refresh_Click(object sender, RoutedEventArgs e) + { + configLabel.Content = "鍒锋柊涓�..."; + Task.Run(() => + { + try + { + Result<Dictionary<string, string>> res = HttpClientCreator.PostSyncAction<Dictionary<string, string>>("openApi/wpf/refreshConfig", null); + Dictionary<string, string> setting = res.HandleResult(); + CustomerSetting.Set(setting); + } + catch (Exception ex) + { + + } + finally + { + Dispatcher.Invoke(() => + { + configLabel.Content = CustomerSetting.Instance["historyFlag"]; + }); + } + }); + } } } diff --git a/PdmSwPlugin.Main/SwAddIn/MainControl.cs b/PdmSwPlugin.Main/SwAddIn/MainControl.cs index 36758e6..6b1208c 100644 --- a/PdmSwPlugin.Main/SwAddIn/MainControl.cs +++ b/PdmSwPlugin.Main/SwAddIn/MainControl.cs @@ -17,6 +17,9 @@ using PdmSwPlugin.MaterialSelect; using PdmSwPlugin.PriceCheck; using PdmSwPlugin.Common.Setting; +using Microsoft.Win32; +using System.IO; +using System.Diagnostics; namespace PdmSwPlugin.Main { @@ -28,7 +31,7 @@ { public SldWorks SwApp { get; private set; } - private ILog Logger = LogManager.GetLogger("Main"); + private ILog Logger; private PluginSetting GlobalConfig; private string[] plugins = { @@ -55,11 +58,88 @@ public MainControl(SldWorks swAddin) { + var log = LogManager.GetLogger("Main"); + Logger = log; SwApp = swAddin; GlobalConfig = PluginSetting.Instance; InitializeComponent(); self.DataContext = this; InitTcpServer(); + try + { + CheckAutoRunRegKey(); + StartListenerProcess(); + } + catch (Exception e) + { + log.Error("Start Listener Error!", e); + } + } + + /// <summary> + /// 璁剧疆鐩戝惉鍣ㄨ嚜鍚姩 + /// </summary> + private void CheckAutoRunRegKey() + { + RegistryKey root = null; + RegistryKey key = null; + try + { + root = Registry.CurrentUser; + key = root.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); + string name = "SolidWorksListener"; + if (key == null) + { + key = root.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); + } + // 娌℃湁璺緞鎴栬�呰矾寰勬寚鍚慹xe涓嶅锛屽氨鏇存柊鑷惎鍔ㄨ矾寰� + string listenerPath = key.GetValue(name)?.ToString(); + string rootDir = new DirectoryInfo(Assembly.GetExecutingAssembly().Location).Parent.FullName; + string newPath = Path.Combine(rootDir, "Listener", "SolidWorksListener.exe"); + if (string.IsNullOrEmpty(listenerPath) || new Uri(listenerPath) != new Uri(newPath)) + { + key.SetValue(name, newPath, RegistryValueKind.String); + } + + } + catch (Exception e) + { + Logger.Error("CheckAutoRunRegKey Failed!", e); + } + finally + { + try + { + if (key != null) key.Close(); + if (root != null) root.Close(); + } + catch (Exception ex) + { + Logger.Error("Reg Key Close Failed!", ex); + } + } + } + + /// <summary> + /// 鍚姩Listener鐩稿叧杩涚▼ + /// </summary> + public void StartListenerProcess() + { + string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + string path1 = Path.Combine(dir, "Listener", "SolidWorksListener.exe"); + if (File.Exists(path1)) + { + ProcessStartInfo info = new ProcessStartInfo + { + FileName = path1, + WorkingDirectory = Path.GetDirectoryName(path1) + }; + + new Process + { + StartInfo = info + }.Start(); + } } // 鏈湴璋冭瘯鐢紝杩炴帴SolidWorks diff --git a/PdmSwPlugin.PDM/PdmControl.xaml.cs b/PdmSwPlugin.PDM/PdmControl.xaml.cs index 6f5a86b..6e6148a 100644 --- a/PdmSwPlugin.PDM/PdmControl.xaml.cs +++ b/PdmSwPlugin.PDM/PdmControl.xaml.cs @@ -39,6 +39,7 @@ using System.Windows.Input; using NPOI.POIFS.Properties; using NPOI.POIFS.Crypt; +using System.Threading.Tasks.Schedulers; namespace PdmSwPlugin.PDM { @@ -144,11 +145,11 @@ this.Warning("璇锋墦寮�涓�寮犲浘绾�"); return new ObservableCollection<PdmBom>(); } - if (7 == doc.GetBlockingState()) - { - this.Warning("璇风瓑寰呮枃妗e姞杞藉畬姣�"); - return new ObservableCollection<PdmBom>(); - } + //if (7 == doc.GetBlockingState()) + //{ + // this.Warning("璇风瓑寰呮枃妗e姞杞藉畬姣�"); + // return new ObservableCollection<PdmBom>(); + //} DateTime beforeDT = DateTime.Now; @@ -896,7 +897,7 @@ public Dictionary<string, DrawInfo> GetAllProperties(List<string> ErrMsgs) { - Dictionary<string, DrawInfo> result = new Dictionary<string, DrawInfo>(); + ConcurrentDictionary<string, DrawInfo> result = new ConcurrentDictionary<string, DrawInfo>(); PdmBom topBom = model.BomTree[0]; CountdownEvent counter = new CountdownEvent(1); _ = ThreadPool.QueueUserWorkItem( @@ -906,7 +907,65 @@ ); counter.Wait(); counter.Dispose(); - return result; + return new Dictionary<string, DrawInfo>(result); + } + + /// <summary> + /// 鑾峰彇鍏ㄩ儴灞炴�� + /// </summary> + /// <param name="param"></param> + public void GetAll(object param) + { + object[] datas = param as object[]; + PdmBom bom = (PdmBom)datas[0]; + ModelDoc2 sldDoc = bom.doc; + Component2 component = bom.component; + ConcurrentDictionary<string, DrawInfo> result = (ConcurrentDictionary<string, DrawInfo>)datas[1]; + CountdownEvent counter = (CountdownEvent)datas[2]; + List<string> ErrMsgs = (List<string>)datas[3]; + int level = (int)datas[4]; + try + { + counter.TryAddCount(); + string filepath = bom.partNo; + + + if (result.ContainsKey(filepath)) + { + return; + } + + if (!bom.skipCheck) + { + result[filepath] = GetSingleDrawInfo(bom); + } + + ObservableCollection<PdmBom> children = bom.modules; + if (children != null) + { + foreach (PdmBom child in children) + { + _ = ThreadPool.QueueUserWorkItem( + new WaitCallback(GetAll), + new object[] { child, result, counter, ErrMsgs, 1 }); + } + } + MaskAdorner.ShowMessage(content, filepath); + } + catch (Exception e) + { + bom.drawInfo.checkRuleResult = 2; + bom.drawInfo.errMessages = new List<string> { e.Message }; + Logger.Error($"V{PdmUser.LoginUser.pluginVersion},[{bom.filePath}] Read MASS Properies Failed.", e); + } + finally + { + counter.Signal(); + if (level == 0) + { + counter.Signal(); + } + } } /// <summary> @@ -926,6 +985,7 @@ Dictionary<string, string> allProperties = new Dictionary<string, string>(); allProperties["鐗╂枡鍨嬪彿"] = bom.partModel; DrawInfo drawInfo = bom._drawInfo; + drawInfo.isHidden = bom.isHidden; drawInfo.allProperties = allProperties; allProperties["鍘嬬缉"] = bom.suppressed.ToString(); allProperties["杞婚噺鍖�"] = bom.lightWeight.ToString(); @@ -947,7 +1007,7 @@ // 宸ョ▼鍥句竴鑷存�ф鏌� allProperties["宸ョ▼鍥炬槸鍚﹀瓨鍦�"] = drawExists.ToString(); allProperties["md5"] = bom.localD3Md5; - if (bom.lost || sldDoc == null) + if (bom.lost || bom.BomInfo.isHidden || sldDoc == null) { allProperties["鍥剧焊鏄惁瀛樺湪"] = "false"; return drawInfo; @@ -1005,17 +1065,28 @@ return drawInfo; } - /// <summary> - /// 鑾峰彇鍏ㄩ儴灞炴�� - /// </summary> - /// <param name="param"></param> - public void GetAll(object param) + public Dictionary<string, DrawInfo> GetAllPropertiesByTask(List<string> ErrMsgs) + { + ConcurrentDictionary<string, DrawInfo> result = new ConcurrentDictionary<string, DrawInfo>(); + PdmBom topBom = model.BomTree[0]; + CountdownEvent counter = new CountdownEvent(1); + Task.Run(() => + { + GetAllByTask(new object[] { + topBom, result, counter, ErrMsgs, 0 }); + }); + counter.Wait(); + counter.Dispose(); + return new Dictionary<string, DrawInfo>(result); + } + + public void GetAllByTask(object param) { object[] datas = param as object[]; PdmBom bom = (PdmBom)datas[0]; ModelDoc2 sldDoc = bom.doc; Component2 component = bom.component; - Dictionary<string, DrawInfo> result = (Dictionary<string, DrawInfo>)datas[1]; + ConcurrentDictionary<string, DrawInfo> result = (ConcurrentDictionary<string, DrawInfo>)datas[1]; CountdownEvent counter = (CountdownEvent)datas[2]; List<string> ErrMsgs = (List<string>)datas[3]; int level = (int)datas[4]; @@ -1023,24 +1094,34 @@ { counter.TryAddCount(); string filepath = bom.partNo; - if (result.ContainsKey(filepath)) + lock (result) { - return; + if (result.ContainsKey(filepath)) + { + if (bom.isHidden) + { + result[filepath].isHidden = true; + } + return; + } + if (!bom.skipCheck) + { + result[filepath] = GetSingleDrawInfo(bom); + } } - if (!bom.skipCheck) - { - result[filepath] = GetSingleDrawInfo(bom); - } + + ObservableCollection<PdmBom> children = bom.modules; if (children != null) { foreach (PdmBom child in children) { - _ = ThreadPool.QueueUserWorkItem( - new WaitCallback(GetAll), - new object[] { child, result, counter, ErrMsgs, 1 }); + Task.Run(() => + { + GetAllByTask(new object[] { child, result, counter, ErrMsgs, 1 }); + }); } } MaskAdorner.ShowMessage(content, filepath); @@ -1054,7 +1135,10 @@ finally { counter.Signal(); - if (level == 0) counter.Signal(); + if (level == 0) + { + counter.Signal(); + } } } @@ -1096,78 +1180,127 @@ return allSuccess; } - public void sb(dynamic[] datas) { - /*Dictionary<string, DrawInfo> properties = datas[0]; - string key = datas[1]; - KeyValuePair<string, DrawInfo> property = datas[2]; - List<string> temp = datas[3]; - CountdownEvent counter = datas[4]; - try - { - - int iii, ref bool allSuccess - - Logger.Info($"{key} checking rule..."); - iii++; - Result<DrawInfo> result = Client.PostSyncAction<DrawInfo>(property.Value, "wpf/bom/openApi/checkRuleSingle"); - DrawInfo checkResult = result.HandleResult(); - properties[key].checkRuleResult = checkResult.checkRuleResult; - properties[key].errMessages = checkResult.errMessages; - var msgs = checkResult.errMessages; - if (!properties[key].HistoryData && !checkResult.checkRuleOk) - { - allSuccess = false; - } - - if (!properties[key].HistoryData && msgs != null && msgs.Count > 0) - { - lock (temp) - { - foreach (string msg in msgs) - { - temp.Add($"鐗╂枡銆恵key}銆戞湭閫氳繃瑙勫垯妫�鏌ワ紒{msg}"); - } - } - } - MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); - } - catch (Exception ex) - { - properties[key].checkRuleResult = 2; - properties[key].errMessages = new List<string> { "鍙戣捣妫�鏌ュけ璐ワ紝璇烽噸璇�" }; - lock (temp) - { - temp.Add($"鐗╂枡銆恵key}銆戝彂璧锋鏌ュけ璐ワ紝璇烽噸璇�"); - } - allSuccess = false; - MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); - } - finally - { - counter.Signal(); - }*/ - } - public bool DoCheckRuleAsync(out List<string> messages) { var temp = new List<string>(); bool allSuccess = true; - Dictionary<string, DrawInfo> properties = GetAllProperties(temp); + Dictionary<string, DrawInfo> properties = GetAllPropertiesByTask(temp); MaskAdorner.ShowMessage(content, "姝e湪璇锋眰鏁版嵁..."); - var factory = LimitedConcurrencyLevelTaskScheduler.Factory; + // var factory = LimitedConcurrencyLevelTaskScheduler.Factory; CountdownEvent counter = new CountdownEvent(properties.Count); - int iii = 1; + int iii = 0; foreach (KeyValuePair<string, DrawInfo> property in properties) { - string key = property.Key; - _ = ThreadPool.QueueUserWorkItem( - (WaitCallback)delegate + /// 杩欎釜鏂规硶鏈�蹇紝浣嗕笉濂界鎺э紝鍥犱负涓嶇煡閬撳睘鎬у瓧鍏告湁澶氬ぇ + Task.Run(() => { - + string key = property.Key; + iii++; try { Logger.Error($"{key} checking rule..."); - iii++; + Result<DrawInfo> result = Client.PostSyncAction<DrawInfo>(property.Value, "wpf/bom/openApi/checkRuleSingle"); + DrawInfo checkResult = result.HandleResult(); + properties[key].checkRuleResult = checkResult.checkRuleResult; + properties[key].errMessages = checkResult.errMessages; + var msgs = checkResult.errMessages; + if (!properties[key].HistoryData && (!checkResult.checkRuleOk||property.Value.isHidden)) + { + allSuccess = false; + } + + if (!properties[key].HistoryData) + { + lock (temp) + { + if (property.Value.isHidden) + { + temp.Add($"鐗╂枡銆恵key}銆戣璁剧疆涓洪殣钘�!"); + } + if (msgs != null && msgs.Count > 0) + { + foreach (string msg in msgs) + { + temp.Add($"鐗╂枡銆恵key}銆戞湭閫氳繃瑙勫垯妫�鏌ワ紒{msg}"); + } + } + } + } + MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); + } + catch (Exception ex) + { + properties[key].checkRuleResult = 2; + properties[key].errMessages = new List<string> { "鍙戣捣妫�鏌ュけ璐ワ紝璇烽噸璇�" }; + lock (temp) + { + temp.Add($"鐗╂枡銆恵key}銆戝彂璧锋鏌ュけ璐ワ紝璇烽噸璇�"); + } + allSuccess = false; + MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); + } + finally + { + counter.Signal(); + } + }); + + //LimitedConcurrencyLevelTaskScheduler scheduler = new LimitedConcurrencyLevelTaskScheduler(int.MaxValue); + //Task.Factory.StartNew(() => { + // string key = property.Key; + // iii++; + // try + // { + // Logger.Error($"{key} checking rule..."); + // Result<DrawInfo> result = Client.PostSyncAction<DrawInfo>(property.Value, "wpf/bom/openApi/checkRuleSingle"); + // DrawInfo checkResult = result.HandleResult(); + // properties[key].checkRuleResult = checkResult.checkRuleResult; + // properties[key].errMessages = checkResult.errMessages; + // var msgs = checkResult.errMessages; + // if (!properties[key].HistoryData && !checkResult.checkRuleOk) + // { + // allSuccess = false; + // } + + // if (!properties[key].HistoryData && msgs != null && msgs.Count > 0) + // { + // lock (temp) + // { + // foreach (string msg in msgs) + // { + // temp.Add($"鐗╂枡銆恵key}銆戞湭閫氳繃瑙勫垯妫�鏌ワ紒{msg}"); + // } + // } + // } + // MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); + // } + // catch (Exception ex) + // { + // properties[key].checkRuleResult = 2; + // properties[key].errMessages = new List<string> { "鍙戣捣妫�鏌ュけ璐ワ紝璇烽噸璇�" }; + // lock (temp) + // { + // temp.Add($"鐗╂枡銆恵key}銆戝彂璧锋鏌ュけ璐ワ紝璇烽噸璇�"); + // } + // allSuccess = false; + // MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); + // } + // finally + // { + // counter.Signal(); + // } + //}, CancellationToken.None, TaskCreationOptions.None, scheduler); + + + /// 涓嬮潰涓や釜閮藉湪绠℃帶Task鏁伴噺锛屼絾杩樻槸寰堟參 + /*string key = property.Key; + _ = ThreadPool.QueueUserWorkItem( + (WaitCallback)delegate + { + iii++; + try + { + Logger.Error($"{key} checking rule..."); Result<DrawInfo> result = Client.PostSyncAction<DrawInfo>(property.Value, "wpf/bom/openApi/checkRuleSingle"); DrawInfo checkResult = result.HandleResult(); properties[key].checkRuleResult = checkResult.checkRuleResult; @@ -1205,12 +1338,53 @@ { counter.Signal(); } - }); + });*/ - /* factory.StartNew(() => - { + //factory.StartNew(() => + //{ + // string key = property.Key; + // iii++; + // try + // { + // Logger.Error($"{key} checking rule..."); + // Result<DrawInfo> result = Client.PostSyncAction<DrawInfo>(property.Value, "wpf/bom/openApi/checkRuleSingle"); + // DrawInfo checkResult = result.HandleResult(); + // properties[key].checkRuleResult = checkResult.checkRuleResult; + // properties[key].errMessages = checkResult.errMessages; + // var msgs = checkResult.errMessages; + // if (!properties[key].HistoryData && !checkResult.checkRuleOk) + // { + // allSuccess = false; + // } - });*/ + // if (!properties[key].HistoryData && msgs != null && msgs.Count > 0) + // { + // lock (temp) + // { + // foreach (string msg in msgs) + // { + // temp.Add($"鐗╂枡銆恵key}銆戞湭閫氳繃瑙勫垯妫�鏌ワ紒{msg}"); + // } + // } + // } + // MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); + // } + // catch (Exception ex) + // { + // properties[key].checkRuleResult = 2; + // properties[key].errMessages = new List<string> { "鍙戣捣妫�鏌ュけ璐ワ紝璇烽噸璇�" }; + // lock (temp) + // { + // temp.Add($"鐗╂枡銆恵key}銆戝彂璧锋鏌ュけ璐ワ紝璇烽噸璇�"); + // } + // allSuccess = false; + // MaskAdorner.ShowMessage(content, $"鐗╂枡銆恵key}銆戞鏌ュ畬鎴�"); + // } + // finally + // { + // counter.Signal(); + // } + //}); } counter.Wait(); counter.Dispose(); @@ -1245,7 +1419,7 @@ try { RefreshBomList(SwApp.IActiveDoc2); - if (!DoCheckRule(out List<string> msgs)) + if (!DoCheckRuleAsync(out List<string> msgs)) { Dispatcher.Invoke(() => { @@ -1615,13 +1789,19 @@ return; } - if (bom.checkRuleOk) + if (bom.checkRuleOk && !bom.isHidden) { this.Show("瑙勫垯妫�鏌ラ�氳繃"); } else { - MultiExWindow exWin = new MultiExWindow(this, "妫�鏌ョ粨鏋�", bom.drawInfo.errMessages); + List<string> errs = new List<string>(); + if (bom.isHidden) + { + errs.Add("鏂囨。琚缃负闅愯棌"); + } + errs.AddRange(bom.drawInfo.errMessages); + MultiExWindow exWin = new MultiExWindow(this, "妫�鏌ョ粨鏋�", errs); exWin.ShowDialog(); } } @@ -1817,7 +1997,7 @@ { throw new CantCheckInException(new List<string> { "璇锋墦寮�涓�寮犲浘绾�" }); } - DoCheckRule(out _); + DoCheckRuleAsync(out _); // 绛涢�夋墍鏈夊湪鐗╂枡鏄庣粏琛ㄤ腑锛屼笉璺宠繃妫�鏌ュ苟涓旀鏌ユ湭閫氳繃鐨勶紝绫诲瀷鏄姞宸ヤ欢鐨勬湭閫氳繃瀹℃牳鐨勶紝鍔犲伐浠跺鏍搁�氳繃鐨勪絾鍥剧焊鍙樻洿鐨� List<string> errs = model.bomTreeReader.CacheList.Select(b => b.NeedStopCheckIn()) .Where(s => s != null).ToList(); diff --git a/PdmSwPlugin.PDM/PdmSwPlugin.PDM.csproj b/PdmSwPlugin.PDM/PdmSwPlugin.PDM.csproj index 2ab1039..470d944 100644 --- a/PdmSwPlugin.PDM/PdmSwPlugin.PDM.csproj +++ b/PdmSwPlugin.PDM/PdmSwPlugin.PDM.csproj @@ -98,6 +98,9 @@ <Reference Include="NPOI.OpenXmlFormats, Version=2.6.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> <HintPath>..\PdmSw\packages\NPOI.2.6.0\lib\net472\NPOI.OpenXmlFormats.dll</HintPath> </Reference> + <Reference Include="ParallelExtensionsExtras, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\MSFT.ParallelExtensionsExtras.1.2.0\lib\ParallelExtensionsExtras.dll</HintPath> + </Reference> <Reference Include="SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13, processorArchitecture=MSIL"> <HintPath>..\PdmSw\packages\SixLabors.Fonts.1.0.0-beta19\lib\netstandard2.0\SixLabors.Fonts.dll</HintPath> </Reference> diff --git a/PdmSwPlugin.PDM/packages.config b/PdmSwPlugin.PDM/packages.config index 2a4494e..0569c47 100644 --- a/PdmSwPlugin.PDM/packages.config +++ b/PdmSwPlugin.PDM/packages.config @@ -4,6 +4,7 @@ <package id="MathNet.Numerics.Signed" version="4.15.0" targetFramework="net472" /> <package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" /> <package id="Microsoft.IO.RecyclableMemoryStream" version="2.2.0" targetFramework="net472" /> + <package id="MSFT.ParallelExtensionsExtras" version="1.2.0" targetFramework="net472" /> <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" /> <package id="NPOI" version="2.6.0" targetFramework="net472" /> <package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" /> diff --git a/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs b/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs index 4076f04..c9ae722 100644 --- a/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs +++ b/PdmSwPlugin.PropertySetting/CommonSettingControl.xaml.cs @@ -53,8 +53,8 @@ public const string size = "澶栧舰灏哄"; public static readonly ObservableCollection<string> MaterialTypes = new ObservableCollection<string> { "鏅�氫欢", - "鏄撴崯浠�","澶囦欢" - }; + "鏈虹僵","鏈烘灦","澶ф澘" + };// "鏄撴崯浠�","澶囦欢", public static readonly ObservableCollection<string> DocTypes = new ObservableCollection<string> { "妯$粍", "鍔犲伐浠�" }; public static readonly HashSet<string> SpecialJgjType = new HashSet<string> { "鍨嬫潗浠�", "閲戝睘鏉跨剨鎺ヤ欢" }; diff --git a/PdmSwPlugin.PropertySetting/Panel/Model/JgjBasePanelModel.cs b/PdmSwPlugin.PropertySetting/Panel/Model/JgjBasePanelModel.cs index 889a30d..6b01453 100644 --- a/PdmSwPlugin.PropertySetting/Panel/Model/JgjBasePanelModel.cs +++ b/PdmSwPlugin.PropertySetting/Panel/Model/JgjBasePanelModel.cs @@ -45,8 +45,8 @@ } private ObservableCollection<string> _materialTypeItems = new ObservableCollection<string> { "鏅�氫欢", - "鏄撴崯浠�","澶囦欢" - }; + "鏈虹僵","鏈烘灦","澶ф澘" + };// "鏄撴崯浠�","澶囦欢", public ObservableCollection<string> materialTypeItems { get => _materialTypeItems; diff --git a/PdmSwPlugin.PropertySetting/PdmSwPlugin.PropertySetting.csproj b/PdmSwPlugin.PropertySetting/PdmSwPlugin.PropertySetting.csproj index 062077d..09ef8f2 100644 --- a/PdmSwPlugin.PropertySetting/PdmSwPlugin.PropertySetting.csproj +++ b/PdmSwPlugin.PropertySetting/PdmSwPlugin.PropertySetting.csproj @@ -105,6 +105,9 @@ </Reference> </ItemGroup> <ItemGroup> + <Compile Include="SettingControl.xaml.cs"> + <DependentUpon>SettingControl.xaml</DependentUpon> + </Compile> <Compile Include="CommonSettingControl.xaml.cs"> <DependentUpon>CommonSettingControl.xaml</DependentUpon> </Compile> @@ -133,6 +136,13 @@ <Compile Include="PropertySettingControl.xaml.cs"> <DependentUpon>PropertySettingControl.xaml</DependentUpon> </Compile> + <Compile Include="Tab\JgjPartTab.xaml.cs"> + <DependentUpon>JgjPartTab.xaml</DependentUpon> + </Compile> + <Page Include="SettingControl.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="CommonSettingControl.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -161,6 +171,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Tab\JgjPartTab.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> diff --git a/PdmSwPlugin.PropertySetting/SettingControl.xaml b/PdmSwPlugin.PropertySetting/SettingControl.xaml new file mode 100644 index 0000000..3a4674b --- /dev/null +++ b/PdmSwPlugin.PropertySetting/SettingControl.xaml @@ -0,0 +1,39 @@ +锘�<UserControl x:Class="PdmSwPlugin.PropertySetting.SettingControl" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + mc:Ignorable="d" + d:DesignHeight="450" d:DesignWidth="800"> + <UserControl.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="/PdmSwPlugin.Common;component/Style/ToolBar.xaml"/> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </UserControl.Resources> + + <StackPanel> + <ToolBarTray Background="#FFF" ToolBarTray.IsLocked="True" > + <ToolBar Style="{StaticResource CommonToolBar}" ToolBar.OverflowMode="Never" Band="1" BandIndex="1" Height="30" Background="#FFF"> + <Button ToolTip="鍒锋柊" Content="鍒锋柊" Click="Refresh_Click" FontSize="16"/> + + <Button ToolTip="淇濆瓨" Content="淇濆瓨" FontFamily="{StaticResource iconfont}" FontSize="16" + Click="SaveButton_Click"/> + <!--<Button ToolTip="鍙﹀瓨" Content="" FontFamily="{StaticResource iconfont}" FontSize="16" + Click="SaveAsButton_Click"/>--> + <!--<Button ToolTip="鍙﹀瓨"> + <Image Source="Image/save.png"/> + </Button>--> + <Button ToolTip="鍔犺浇鍙�夐」" Content="鍔犺浇鍙�夐」" Click="LoadComboBox_Click" FontSize="16"/> + </ToolBar> + </ToolBarTray> + <Label Content="{Binding ReadDocPath}"/> + <AdornerDecorator x:Name="content"> + <StackPanel x:Name="contentPanel"> + + </StackPanel> + </AdornerDecorator> + </StackPanel> +</UserControl> + diff --git a/PdmSwPlugin.PropertySetting/SettingControl.xaml.cs b/PdmSwPlugin.PropertySetting/SettingControl.xaml.cs new file mode 100644 index 0000000..06fb90a --- /dev/null +++ b/PdmSwPlugin.PropertySetting/SettingControl.xaml.cs @@ -0,0 +1,715 @@ +锘縰sing log4net; +using PdmSwPlugin.Commmon.Util.UI; +using PdmSwPlugin.Common.Util; +using PdmSwPlugin.Common.Util.Http; +using PdmSwPlugin.PropertySetting.Interface; +using SolidWorks.Interop.sldworks; +using SolidWorks.Interop.swconst; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Net.Http; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using PdmSwPlugin.Common.Interface; +using PdmSwPlugin.Common; +using PdmSwPlugin.PropertySetting.Entity; +using PdmSwPlugin.PropertySetting.Panel; +using System.Windows.Threading; +using PdmSwPlugin.Common.Setting; +using System.IO; +using System.Runtime.InteropServices; + +namespace PdmSwPlugin.PropertySetting +{ + + /// <summary> + /// CommonSettingControl.xaml 鐨勪氦浜掗�昏緫 + /// </summary> + [PdmSwPlugin(Title = "灞炴�ц缃�")] + public partial class SettingControl : UserControl, ISwAppSetter, INotifyPropertyChanged + , IActiveDocChangeHandler, ITabControlSelectionChangeHandler + { + private static ILog Logger = LogManager.GetLogger("PropertySetting"); + + #region 涓嶈兘鍏敤鐨勪笢瑗匡紝鐪熸湁浣犵殑鍟奀# + public event PropertyChangedEventHandler PropertyChanged; + public void RaisePropertyChanged(string name) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + public void RaiseAndSetIfChanged<T>(ref T old, T @new, [CallerMemberName] string propertyName = null) + { + old = @new; + if (propertyName != null) + { + RaisePropertyChanged(propertyName); + } + } + #endregion + + public readonly Dictionary<string, UserControl> controlCache = new Dictionary<string, UserControl>(); + + #region 灞炴�� + public SldWorks SwApp { get; private set; } + /// <summary> + /// 婵�娲荤殑鏂囨。 + /// </summary> + public ModelDoc2 activeDoc { set; get; } + /// <summary> + /// 涓婃璇诲彇鐨勬枃妗� + /// </summary> + public ModelDoc2 LastReadDoc { get; set; } + /// <summary> + /// 褰撳墠璇诲彇鐨勬枃妗� + /// </summary> + public ModelDoc2 ReadDoc { get; set; } + /// <summary> + /// 褰撳墠璇诲彇鐨勭粍浠� + /// </summary> + public Component2 ReadComponent { get; set; } + + private HttpClient Client { get; set; } + + Dictionary<string, JgjType> settings; + #endregion + + #region UI缁戝畾 + private string _readDocPath; + public string ReadDocPath + { + get => _readDocPath; + set => RaiseAndSetIfChanged(ref _readDocPath, value); + } + #endregion + private HttpClientCreator clientCreator { get; set; } + + private UserControl ActiveOpter { get; set; } + + public SettingControl() + { + clientCreator = new HttpClientCreator(new HttpConfig(PluginSetting.Instance.BaseAddress)); + InitializeComponent(); + DataContext = this; + } + + public SettingControl(SldWorks SwApp) : this() + { + this.SwApp = SwApp; + } + + public void InitPropertyData() + { + if (Client == null) + { + Client = clientCreator.GetClient(); + } + DefaultPanel defaultPanel = new DefaultPanel(); + controlCache.Add("default", defaultPanel); + + JgjPartPanel jgjPart = new JgjPartPanel(); + controlCache.Add("jgjPart", jgjPart); + + JgjModulePanel jgjModule = new JgjModulePanel(); + controlCache.Add("jgjModule", jgjModule); + + var stPart = new StandardPartPanel(); + controlCache.Add("standardPart", stPart); + + var stModule = new StandardModulePanel(); + controlCache.Add("standardModule", stModule); + LoadComboxItemSource(); + Refresh_Click(null, null); + } + + private void Jgj_SinglePropertyChanged(object sender, string name, object value) + { + // CustomPropertyUtil.SetCustomProperties(ReadDoc, name, (string)value); + } + + /// <summary> + /// 浠庢湇鍔″櫒鍔犺浇鍚勭閫夐」 + /// </summary> + private void LoadComboxItemSource() + { + try + { + Result<Dictionary<string, JgjType>> res = Client.GetSyncAction<Dictionary<string, JgjType>>("design/rule/openApi/test"); + Dictionary<string, JgjType> datas = res.HandleResult(); + settings = datas; + foreach (var key in controlCache.Keys) + { + (controlCache[key] as IPropertyOpt).SetSettings(settings); + } + } + catch (Exception ex) + { + Logger.Error("Request Jgj properties failed.", ex); + this.Error($"璇锋眰鍔犲伐浠跺睘鎬уけ璐ワ紒{ex.Message}"); + } + } + + private void UpdateActiveDoc() + { + if (activeDoc != null) + { + DetachDocNotify(activeDoc); + } + + activeDoc = SwApp.ActiveDoc; + if (activeDoc != null) + { + AttachDocNotify(activeDoc); + int docType = activeDoc.GetType(); + if (docType == (int)swDocumentTypes_e.swDocASSEMBLY) + { + activeDoc.ClearSelection2(true); + } + } + UpdateUI(activeDoc); + } + + /// <summary> + /// 闄勫姞涓�浜涙彃浠惰寖鍥村唴鐨勪簨浠� + /// </summary> + /// <param name="doc"></param> + private void AttachDocNotify(ModelDoc2 doc) + { + int docType = doc.GetType(); + if (docType == (int)swDocumentTypes_e.swDocASSEMBLY) + { + AssemblyDoc ass = doc as AssemblyDoc; + ass.UserSelectionPostNotify += Ass_UserSelectionPostNotify; + ass.DestroyNotify2 += ActiveDocDestroyNotify2; + } + else if (docType == (int)swDocumentTypes_e.swDocPART) + { + PartDoc part = doc as PartDoc; + part.DestroyNotify2 += ActiveDocDestroyNotify2; + } + else if (docType == (int)swDocumentTypes_e.swDocDRAWING) + { + DrawingDoc draw = doc as DrawingDoc; + draw.DestroyNotify2 += ActiveDocDestroyNotify2; + } + } + + /// <summary> + /// 绉婚櫎鎻掍欢鑼冨洿鍐呯殑涓�浜涗簨浠� + /// </summary> + /// <param name="doc"></param> + private void DetachDocNotify(ModelDoc2 doc) + { + try + { + int docType = doc.GetType(); + if (docType == (int)swDocumentTypes_e.swDocASSEMBLY) + { + AssemblyDoc ass = doc as AssemblyDoc; + ass.UserSelectionPostNotify -= Ass_UserSelectionPostNotify; + ass.DestroyNotify2 -= ActiveDocDestroyNotify2; + } + else if (docType == (int)swDocumentTypes_e.swDocPART) + { + PartDoc part = doc as PartDoc; + part.DestroyNotify2 -= ActiveDocDestroyNotify2; + } + else if (docType == (int)swDocumentTypes_e.swDocDRAWING) + { + DrawingDoc draw = doc as DrawingDoc; + draw.DestroyNotify2 -= ActiveDocDestroyNotify2; + } + } + catch (COMException e) + { + // 濡傛灉sw鎶婁笉鏄閰嶄綋/闆朵欢浣�/宸ョ▼鍥剧殑鏂囨。鍏充簡锛屾湁鏃朵細鎶ヨ繖涓棶棰橈紝鐣欎釜鏃ュ織涓嶆姤閿欎簡 + Logger.Warn("COMObject detach event failed.", e); + activeDoc = null; + } + } + + private int ActiveDocDestroyNotify2(int DestroyType) + { + if (activeDoc == null) + { + return 0; + } + DetachDocNotify(activeDoc); + activeDoc = null; + ReadComponent = null; + UpdateUI(null); + return 0; + } + + public void UpdateUI(ModelDoc2 doc) + { + AlertSaveWindow(); + LastReadDoc = ReadDoc; + ReadDoc = doc; + Dispatcher.Invoke(() => + { + SwitchVisiable(); + // LoadDocProperties(); + }); + } + + /// <summary> + /// 鍒ゆ柇鏄惁闇�瑕佸脊绐楁彁绀轰繚瀛� + /// </summary> + public void AlertSaveWindow() + { + IPropertyOpt opt = ActiveOpter as IPropertyOpt; + if (opt != null && opt.GetDocChanged()) + { + // 鍘嗗彶鏂囨。鐩存帴閲嶇疆 + string fullName = Path.GetFileName(ReadDocPath); + if (NameUtil.IsHistoryDoc(fullName)) + { + opt.ResetProperty(out string errMsg); + return; + } + + string Message = $"{fullName}灞炴�у彂鐢熷彉鏇达紝鏄惁淇濆瓨?"; + if (SwApp.SendMsgToUser2(Message, (int)swMessageBoxIcon_e.swMbWarning + , (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitYes) + { + SaveDoc(true); + } + else + { + opt.ResetProperty(out string errMsg); + } + } + } + + private int Ass_UserSelectionPostNotify() + { + var swSelMgr = (SelectionMgr)activeDoc.SelectionManager; + var i = swSelMgr.GetSelectedObjectCount2(-1); + if (i > 0) + { + try + { + Component2 component = swSelMgr.GetSelectedObjectsComponent4(1, -1); + ModelDoc2 doc = activeDoc; + ReadComponent = null; + if (component != null) + { + doc = component.IGetModelDoc(); + ReadComponent = component; + } + UpdateUI(doc); + } + catch (Exception ex) + { + Logger.Error("Ass Change Component Error.", ex); + this.Error($"鍒锋柊灞炴�уけ璐ワ紒{ex.Message}"); + } + } + return 1; + } + + /// <summary> + /// 鏍规嵁婵�娲荤殑鏂囨。绫诲瀷锛屽彉鏇村睘鎬у彲瑙� + /// </summary> + private void SwitchVisiable() + { + HashSet<string> skipName = new HashSet<string> { + NameConstant.materialCode + }; + + IPropertyOpt last = ActiveOpter as IPropertyOpt; + string contentKey = "default"; + int? docType = ReadDoc?.GetType(); + UserControl control; + IPropertyOpt newOne; + Dictionary<string, string> properties; + if (docType == (int)swDocumentTypes_e.swDocDRAWING) + { + ReadDocPath = ReadDoc.GetPathName(); + contentKey = "default"; + control = controlCache[contentKey]; + newOne = control as IPropertyOpt; + newOne.SetProperties(null, "褰撳墠涓嶆敮鎸佸伐绋嬪浘", true, out _); + } + else if (docType == (int)swDocumentTypes_e.swDocPART) + { + ReadDocPath = ReadDoc.GetPathName(); + properties = CustomPropertyUtil.GetCustomProperties2(ReadDoc, true, skipName); + string fileType = properties.Get(NameConstant.docType); + /*if (fileType == "鍔犲伐浠�" || fileType == "妯$粍") + { + contentKey = "jgjPart"; + }*/ + if (BomIniterHolder.Instance.IsJgj(ReadDoc)) + { + contentKey = "jgjPart"; + } + else + { + contentKey = "standardPart"; + } + control = controlCache[contentKey]; + newOne = control as IPropertyOpt; + newOne.SetProperties(ReadDoc, properties, true, out _); + } + else if (docType == (int)swDocumentTypes_e.swDocASSEMBLY) + { + ReadDocPath = ReadDoc.GetPathName(); + if (ReadDoc.IsOpenedViewOnly()) + { + contentKey = "default"; + control = controlCache[contentKey]; + newOne = control as IPropertyOpt; + newOne.SetProperties(null, "褰撳墠澶勪簬鍙妯″紡", true, out _); + } + else if (ReadDoc.IsOpenedReadOnly()) + { + contentKey = "default"; + control = controlCache[contentKey]; + newOne = control as IPropertyOpt; + newOne.SetProperties(null, "褰撳墠澶勪簬鍙妯″紡", true, out _); + } + else + { + // !Equals(LastReadDoc, ReadDoc) + properties = CustomPropertyUtil.GetCustomProperties2(ReadDoc, true, skipName); + string fileType = properties.Get(NameConstant.docType); + /*if (fileType == "鍔犲伐浠�" || fileType == "妯$粍") + { + contentKey = "jgjPart"; + }*/ + if (BomIniterHolder.Instance.IsJgj(ReadDoc)) + { + contentKey = "jgjModule"; + } + else + { + contentKey = "standardModule"; + } + control = controlCache[contentKey]; + newOne = control as IPropertyOpt; + newOne.SetProperties(ReadDoc, properties, true, out _); + } + } + else + { + contentKey = "default"; + control = controlCache[contentKey]; + newOne = control as IPropertyOpt; + + string PathName = ReadComponent?.GetPathName(); + if (PathName == null) + { + ReadDocPath = ""; + newOne.SetProperties(ReadDoc, "璇锋墦寮�涓�涓枃妗�", true, out _); + } + else + { + ReadDocPath = PathName; + string name = Path.GetFileNameWithoutExtension(PathName); + newOne.SetProperties(ReadDoc, $"銆恵name}銆戞湭鎵惧埌鏂囨。锛岃妫�鏌ユ槸鍚﹁鍘嬬缉鎴栬交閲忓寲", true, out _); + } + } + if (last != null) + { + last.UpdateProperty -= Jgj_SinglePropertyChanged; + last = null; + } + ActiveOpter = control; + contentPanel.Children.Clear(); + newOne.UpdateProperty += Jgj_SinglePropertyChanged; + contentPanel.Children.Add(control); + } + + /// <summary> + /// 鏍规嵁婵�娲荤殑鏂囨。绫诲瀷锛屽彉鏇村睘鎬у彲瑙� + /// </summary> + private void SwitchVisiable2() + { + HashSet<string> skipName = new HashSet<string> { + NameConstant.materialCode + }; + + IPropertyOpt last = ActiveOpter as IPropertyOpt; + string contentKey = "default"; + int? docType = ReadDoc?.GetType(); + UserControl control; + IPropertyOpt newOne; + Dictionary<string, string> properties; + if (docType == (int)swDocumentTypes_e.swDocDRAWING) + { + ReadDocPath = ReadDoc.GetPathName(); + + control = new DefaultPanel(); + newOne = control as IPropertyOpt; + newOne.SetSettings(settings); + newOne.SetProperties(null, "褰撳墠涓嶆敮鎸佸伐绋嬪浘", true, out _); + } + else if (docType == (int)swDocumentTypes_e.swDocPART) + { + ReadDocPath = ReadDoc.GetPathName(); + properties = CustomPropertyUtil.GetCustomProperties2(ReadDoc, true, skipName); + string fileType = properties.Get(NameConstant.docType); + /*if (fileType == "鍔犲伐浠�" || fileType == "妯$粍") + { + contentKey = "jgjPart"; + }*/ + if (BomIniterHolder.Instance.IsJgj(ReadDoc)) + { + control = new JgjPartPanel(); + } + else + { + control = new StandardPartPanel(); + } + newOne = control as IPropertyOpt; + newOne.SetSettings(settings); + newOne.SetProperties(ReadDoc, properties, true, out _); + } + else if (docType == (int)swDocumentTypes_e.swDocASSEMBLY) + { + ReadDocPath = ReadDoc.GetPathName(); + // !Equals(LastReadDoc, ReadDoc) + properties = CustomPropertyUtil.GetCustomProperties2(ReadDoc, true, skipName); + string fileType = properties.Get(NameConstant.docType); + /*if (fileType == "鍔犲伐浠�" || fileType == "妯$粍") + { + contentKey = "jgjPart"; + }*/ + if (BomIniterHolder.Instance.IsJgj(ReadDoc)) + { + control = new JgjModulePanel(); + } + else + { + control = new StandardModulePanel(); + } + newOne = control as IPropertyOpt; + newOne.SetSettings(settings); + newOne.SetProperties(ReadDoc, properties, true, out _); + } + else + { + control = new DefaultPanel(); + newOne = control as IPropertyOpt; + + string PathName = ReadComponent?.GetPathName(); + if (PathName == null) + { + ReadDocPath = ""; + newOne.SetSettings(settings); + newOne.SetProperties(ReadDoc, "璇锋墦寮�涓�涓枃妗�", true, out _); + } + else + { + ReadDocPath = PathName; + string name = Path.GetFileNameWithoutExtension(PathName); + newOne.SetSettings(settings); + newOne.SetProperties(ReadDoc, $"銆恵name}銆戞湭鎵惧埌鏂囨。锛岃妫�鏌ユ槸鍚﹁鍘嬬缉鎴栬交閲忓寲", true, out _); + } + } + if (last != null) + { + last.UpdateProperty -= Jgj_SinglePropertyChanged; + last = null; + } + ActiveOpter = control; + contentPanel.Children.Clear(); + newOne.UpdateProperty += Jgj_SinglePropertyChanged; + contentPanel.Children.Add(control); + } + + /// <summary> + /// 浠庢縺娲荤殑鏂囨。涓鍙栧弬鏁� + /// </summary> + private void LoadDocProperties() + { + IPropertyOpt opt = ActiveOpter as IPropertyOpt; + string ErrMsg = null; + if (ReadDoc == null) + { + string PathName = ReadComponent?.GetPathName(); + if (PathName == null) + { + ReadDocPath = ""; + opt.SetProperties(ReadDoc, "璇锋墦寮�涓�涓枃妗�", true, out ErrMsg); + return; + } + ReadDocPath = PathName; + string name = Path.GetFileNameWithoutExtension(PathName); + opt.SetProperties(ReadDoc, $"銆恵name}銆戞湭鎵惧埌鏂囨。锛岃妫�鏌ユ槸鍚﹁鍘嬬缉鎴栬交閲忓寲", true, out ErrMsg); + return; + } + int docType = ReadDoc.GetType(); + ReadDocPath = ReadDoc.GetPathName(); + if (docType == (int)swDocumentTypes_e.swDocDRAWING) + { + opt.SetProperties(null, "褰撳墠涓嶆敮鎸佸伐绋嬪浘", true, out ErrMsg); + return; + } + HashSet<string> skipName = new HashSet<string> { + NameConstant.materialCode + }; + Dictionary<string, string> properties = CustomPropertyUtil.GetCustomProperties2(ReadDoc, true, skipName); + opt.SetProperties(ReadDoc, properties, !Equals(LastReadDoc, ReadDoc), out ErrMsg); + } + + private void ClearDocProperties() + { + IPropertyOpt opt = ActiveOpter as IPropertyOpt; + opt.ClearAllProperties(out string ErrMsg); + } + + /// <summary> + /// 灏嗗睘鎬ц缃繘鏂囨。锛屾敞鎰忥紝骞舵病鏈変繚瀛� + /// </summary> + /// <param name="doc">鏂囨。</param> + private void SetDocProperty(ModelDoc2 doc, Dictionary<string, string> props) + { + CustomPropertyUtil.SetCustomProperties(doc, props); + } + + public void SetSwApp(SldWorks SwApp) + { + this.SwApp = SwApp; + } + + + private void SaveDoc(bool qiaoqiaode) + { + + int errors = 0, warnings = 0; + + if ((ActiveOpter as IPropertyOpt).SaveDoc(ref errors, ref warnings)) + { + // if (!qiaoqiaode) this.Info("淇濆瓨鎴愬姛"); + } + } + + private void SaveButton_Click(object sender, RoutedEventArgs e) + { + if (ReadDoc == null) + { + return; + } + SaveDoc(false); + } + + public void RefreshData() + { + MaskAdorner.ShowMask(content, "灞炴�у姞杞戒腑锛岃绋嶅��..."); + Task.Run(() => + { + try + { + UpdateActiveDoc(); + } + catch (COMException come) + { + // 棰戠箒鍏抽棴浼氭姏鍑鸿繖涓紓甯革紝涓嶇浜� + Logger.Warn("Read property COMObject failed.", come); + } + catch (Exception ex) + { + Logger.Error($"璇诲彇鍙傛暟寮傚父锛屾枃浠讹細[{ReadDocPath}]!", ex); + this.Error($"璇诲彇鍙傛暟寮傚父锛歿ex.Message}"); + } + finally + { + MaskAdorner.HideMask(content); + } + }); + } + + private void Refresh_Click(object sender, RoutedEventArgs e) + { + RefreshData(); + } + + private void LoadComboBox_Click(object sender, RoutedEventArgs e) + { + MaskAdorner.ShowMask(content, "鍔犺浇MES璁剧疆锛岃绋嶅��..."); + Task.Run(() => + { + try + { + LoadComboxItemSource(); + } + finally + { + MaskAdorner.HideMask(content); + } + }); + } + + private void PropertySettingControl_Initialized(object sender, EventArgs e) + { + InitPropertyData(); + } + + /// <summary> + /// 婵�娲荤殑鏂囨。鍙樻洿瑙﹀彂 + /// </summary> + /// <param name="lastDoc"></param> + /// <param name="doc"></param> + /// <param name="comp"></param> + public void OnSwActiveDocChange(ModelDoc2 lastDoc, ModelDoc2 doc, Component2 comp) + { + // CurrentChanged(); + RefreshData(); + } + + public void OnSwActiveDocSaved(ModelDoc2 doc, Component2 comp) + { + // 璇诲彇鏂囦欢锛岃缃弬鏁� + // LoadDocProperties(); + } + + public void OnCustomPropertyChange(string propName, string Configuration, string oldValue, string NewValue, int valueType) + { + if (oldValue == NewValue) + { + return; + } + IPropertyOpt opt = ActiveOpter as IPropertyOpt; + opt.UpdateSingleProperty(propName, NewValue); + } + + public void OnDocDestroy(ModelDoc2 doc) + { + + } + + public void AfterDocDestroy() + { + + } + + public void OnTabControlSelectionChange(object sender, SelectionChangedEventArgs e) + { + if (e.RemovedItems == null) + { + return; + } + + foreach (object obj in e.RemovedItems) + { + if (obj is TabItem item) + { + if (item.Content == this) + { + AlertSaveWindow(); + break; + } + } + else + { + return; + } + } + } + } +} diff --git a/PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml b/PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml new file mode 100644 index 0000000..86fa228 --- /dev/null +++ b/PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml @@ -0,0 +1,88 @@ +锘�<UserControl x:Class="PdmSwPlugin.PropertySetting.Tab.JgjPartTab" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:PdmSwPlugin.PropertySetting.Tab" + mc:Ignorable="d" + x:Name="self" d:DesignHeight="900" d:DesignWidth="800" Background="#FFF"> + <UserControl.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="/PdmSwPlugin.Common;component/Style/ToolBar.xaml"/> + <ResourceDictionary Source="/PdmSwPlugin.Common;component/Style/ComboxStyle.xaml"/> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </UserControl.Resources> + + <StackPanel> + <StackPanel x:Name="materialCodePanel"> + <Label Content="鐗╂枡缂栫爜"/> + <TextBox x:Name="materialCodeText" IsReadOnly="True" Text="{Binding materialCode,UpdateSourceTrigger=PropertyChanged}"/> + </StackPanel> + + <StackPanel x:Name="weightPanel"> + <Label Content="閲嶉噺锛坘g锛�"/> + <TextBox IsReadOnly="True" x:Name="weightText" Text="{Binding weight}"/> + </StackPanel> + + <StackPanel x:Name="materialNamePanel"> + <Label Content="鐗╂枡鍚嶇О"/> + <TextBox x:Name="materialNameText" Text="{Binding materialName,UpdateSourceTrigger=PropertyChanged}"/> + </StackPanel> + + <StackPanel x:Name="jgjTypePanel"> + <Label Content="鍔犲伐浠剁被鍨�"/> + <ComboBox x:Name="jgjTypeInput" Style="{StaticResource ShowTextCombox}" + Text="{Binding jgjType,Mode=TwoWay}" + ItemsSource="{Binding jgjTypeItems}" /> + </StackPanel> + + <StackPanel x:Name="stuffPanel"> + <Label Content="鏉愯川"/> + <ComboBox x:Name="stuffInput" Style="{StaticResource ShowTextCombox}" + Text="{Binding stuff,Mode=TwoWay}" + ItemsSource="{Binding stuffItems}" + DropDownOpened="stuffInput_DropDownOpened"/> + </StackPanel> + + <StackPanel x:Name="surfacePanel"> + <Label Content="琛ㄩ潰澶勭悊"/> + <ComboBox x:Name="surfaceInput" Style="{StaticResource ShowTextCombox}" + Text="{Binding surface,Mode=TwoWay}" + ItemsSource="{Binding surfaceItems}" DropDownOpened="stuffInput_DropDownOpened"/> + </StackPanel> + + <StackPanel x:Name="heatPanel"> + <Label Content="鐑鐞�"/> + <ComboBox x:Name="heatInput" Style="{StaticResource ShowTextCombox}" + Text="{Binding heat,Mode=TwoWay}" + ItemsSource="{Binding heatItems}" DropDownOpened="stuffInput_DropDownOpened"/> + </StackPanel> + + <StackPanel x:Name="materialTypePanel"> + <Label Content="鐗╂枡绫诲瀷"/> + <ComboBox ItemsSource="{Binding materialTypeItems}" SelectedItem="{Binding materialType,Mode=TwoWay}"/> + </StackPanel> + + <StackPanel x:Name="createUserPanel"> + <Label Content="璁捐浜哄憳"/> + <TextBox x:Name="createUserText" Text="{Binding designer,UpdateSourceTrigger=PropertyChanged}"/> + </StackPanel> + + <StackPanel x:Name="remarkPanel"> + <Label Content="澶囨敞"/> + <TextBox x:Name="remarkText" Text="{Binding remark,UpdateSourceTrigger=PropertyChanged}" /> + </StackPanel> + + <StackPanel x:Name="formatPanel"> + <Label Content="鏂囦欢鏍煎紡"/> + <ComboBox ItemsSource="{Binding docTypeItems}" IsEnabled="{Binding DocTypeEnabled}" +SelectedItem="{Binding docType,Mode=TwoWay}"/> + </StackPanel> + + <StackPanel x:Name="versionChangePanel"> + <CheckBox Content="鐗堟湰鍙樻洿" IsChecked="{Binding versionChangeBind}"/> + </StackPanel> + </StackPanel> +</UserControl> diff --git a/PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml.cs b/PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml.cs new file mode 100644 index 0000000..cc1d149 --- /dev/null +++ b/PdmSwPlugin.PropertySetting/Tab/JgjPartTab.xaml.cs @@ -0,0 +1,473 @@ +锘縰sing PdmSwPlugin.Common.CustomHandler; +using PdmSwPlugin.Common.Util; +using PdmSwPlugin.PropertySetting.Entity; +using PdmSwPlugin.PropertySetting.Interface; +using PdmSwPlugin.PropertySetting.Panel.Attr; +using SolidWorks.Interop.sldworks; +using SolidWorks.Interop.swconst; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.IO; +using System.Runtime.CompilerServices; +using System.Windows.Controls; + +namespace PdmSwPlugin.PropertySetting.Tab +{ + /// <summary> + /// JgjPartTab.xaml 鐨勪氦浜掗�昏緫 + /// </summary> + public partial class JgjPartTab : UserControl, INotifyPropertyChanged, IPropertyOpt + { + #region 涓嶈兘鍏敤鐨勪笢瑗匡紝鐪熸湁浣犵殑鍟奀# + public event PropertyChangedEventHandler PropertyChanged; + public void RaisePropertyChanged(string name) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + + public void RaiseAndSetIfChanged<T>(ref T old, T @new, [CallerMemberName] string propertyName = null) + { + old = @new; + if (propertyName != null) + { + RaisePropertyChanged(propertyName); + /*var attr = this.GetType().GetProperty(propertyName)?.GetCustomAttribute<PropertySettingAttr>(); + if (attr == null) + { + return; + } + if (attr.NeedSave) + { + UpdateProperty?.Invoke(this, attr.Name, @new); + }*/ + } + } + #endregion + + public void ccc<T>(ref T old, T @new, [CallerMemberName] string propertyName = null) + { + old = @new; + if (propertyName != null) + { + RaisePropertyChanged(propertyName); + } + } + + public event PanelPropertyChanged UpdateProperty; + + /// <summary> + /// 鍒濆鏁版嵁 + /// </summary> + private Dictionary<string, string> InitData = new Dictionary<string, string>(); + /// <summary> + /// 瀹為檯鏁版嵁 + /// </summary> + private Dictionary<string, string> SaveData = new Dictionary<string, string>(); + + private Dictionary<string, JgjType> datas; + private Dictionary<string, ObservableCollection<string>> stuffItemCache; + + private Dictionary<string, ObservableCollection<string>> surfaceItemCache; + + private Dictionary<string, ObservableCollection<string>> heatItemCache; + + private ModelDoc2 doc; + + #region 涓嬫媺妗嗘暟鎹簮 + private ObservableCollection<string> _jgjTypeItems; + public ObservableCollection<string> jgjTypeItems + { + get => _jgjTypeItems; + set => RaiseAndSetIfChanged(ref _jgjTypeItems, value); + } + + private ObservableCollection<string> _stuffItems; + public ObservableCollection<string> stuffItems + { + get => _stuffItems; + set => RaiseAndSetIfChanged(ref _stuffItems, value); + } + + private ObservableCollection<string> _surfaceItems; + public ObservableCollection<string> surfaceItems + { + get => _surfaceItems; + set => RaiseAndSetIfChanged(ref _surfaceItems, value); + } + + private ObservableCollection<string> _heatItems; + public ObservableCollection<string> heatItems + { + get => _heatItems; + set => RaiseAndSetIfChanged(ref _heatItems, value); + } + + private ObservableCollection<string> _materialTypeItems = NameConstant.MaterialTypes; + public ObservableCollection<string> materialTypeItems + { + get => _materialTypeItems; + set => RaiseAndSetIfChanged(ref _materialTypeItems, value); + } + + private ObservableCollection<string> _docTypeItems = NameConstant.DocTypes; + public ObservableCollection<string> docTypeItems + { + get => _docTypeItems; + set => RaiseAndSetIfChanged(ref _docTypeItems, value); + } + #endregion + + private bool _docTypeEnabled = true; + [PropertySettingAttr(NeedInit = false, NeedSave = false)] + public bool DocTypeEnabled + { + get => _docTypeEnabled; + set => RaiseAndSetIfChanged(ref _docTypeEnabled, value); + } + + #region UI灞炴�� + private string _materialCode; + [PropertySettingAttr(Name = NameConstant.materialCode, defaultValue = "$PRP:\"SW-File Name\"")] + public string materialCode + { + get => _materialCode; + set + { + RaiseAndSetIfChanged(ref _materialCode, value); + } + } + + private string _materialName; + [PropertySettingAttr(Name = NameConstant.materialName)] + public string materialName + { + get => _materialName; + set + { + RaiseAndSetIfChanged(ref _materialName, value); + } + } + + private string _jgjType; + [PropertySettingAttr(Name = NameConstant.jgjType)] + public string jgjType + { + get => _jgjType; + set + { + string temp = value;// jgjTypeItems.Contains(value) ? value : "鏃�"; + var datas = stuffItemCache.Get(temp, new ObservableCollection<string> { "鏃�" }); + RaiseAndSetIfChanged(ref _stuffItems, datas, "stuffItems"); + RaiseAndSetIfChanged(ref _jgjType, temp); + UpdateField("jgjType", temp); + } + } + + private string _stuff; + [PropertySettingAttr(Name = NameConstant.stuff)] + public string stuff + { + get => _stuff; + set + { + string temp = value;// stuffItems.Contains(value) ? value : "鏃�"; + var sDatas = surfaceItemCache.Get($"{jgjType}_{temp}", new ObservableCollection<string> { "鏃�" }); + var hDatas = heatItemCache.Get($"{jgjType}_{temp}", new ObservableCollection<string> { "鏃�" }); + ccc(ref _surfaceItems, sDatas, "surfaceItems"); + ccc(ref _heatItems, hDatas, "heatItems"); + ccc(ref _stuff, temp); + } + } + + private string _surface; + [PropertySettingAttr(Name = NameConstant.surface)] + public string surface + { + get => _surface; + set + { + string temp = value;// surfaceItems.Contains(value) ? value : "鏃�"; + ccc(ref _surface, temp); + } + } + + private string _heat; + [PropertySettingAttr(Name = NameConstant.heat)] + public string heat + { + get => _heat; + set + { + string temp = value;// heatItems.Contains(value) ? value : "鏃�"; + ccc(ref _heat, temp); + } + } + + private string _weight = ""; + [PropertySettingAttr(Name = NameConstant.weight, NeedSave = false)] + public string weight + { + get => CustomPropertyUtil.GetMass(doc); + set + { + ccc(ref _weight, value); + } + } + + [PropertySettingAttr(Name = NameConstant.weight, NeedInit = false)] + public string weightEval + { + get => doc == null ? null : $"\"SW-璐ㄩ噺@{Path.GetFileName(doc.GetPathName())}\""; + set { } + } + + private string _materialType = ""; + [PropertySettingAttr(Name = NameConstant.materialType, defaultValue = "鏅�氫欢")] + public string materialType + { + get => _materialType; + set + { + RaiseAndSetIfChanged(ref _materialType, value); + } + } + + private string _designer = ""; + [PropertySettingAttr(Name = NameConstant.designer)] + public string designer + { + get => _designer; + set + { + RaiseAndSetIfChanged(ref _designer, value); + } + } + + private string _remark = ""; + [PropertySettingAttr(Name = NameConstant.remark)] + public string remark + { + get => _remark; + set + { + RaiseAndSetIfChanged(ref _remark, value); + } + } + + private string _docType = ""; + [PropertySettingAttr(Name = NameConstant.docType, defaultValue = "鍔犲伐浠�")] + public string docType + { + get => _docType; + set + { + string temp = value; + if (NameConstant.SpecialJgjType.Contains(jgjType)) + { + temp = "鍔犲伐浠�"; + } + ccc(ref _docType, temp); + } + } + + private string _versionChange = "0"; + [PropertySettingAttr(Name = NameConstant.versionChange, defaultValue = "0")] + public string versionChange + { + get => _versionChange; + set + { + RaiseAndSetIfChanged(ref _versionChange, value); + RaiseAndSetIfChanged(ref _versionChangeBind, value == "1", "versionChangeBind"); + } + } + + private bool _versionChangeBind = false; + [PropertySettingAttr(Name = NameConstant.versionChange, NeedSave = false, NeedInit = false)] + public bool versionChangeBind + { + get => _versionChangeBind; + set + { + RaiseAndSetIfChanged(ref _versionChangeBind, value); + RaiseAndSetIfChanged(ref _versionChange, value ? "1" : "0", "versionChange"); + } + } + #endregion + + public JgjPartTab() + { + InitializeComponent(); + DataContext = this; + } + + /// <summary> + /// 璁剧疆灞炴�� + /// </summary> + /// <param name="properties"></param> + /// <param name="errMsg"></param> + /// <returns></returns> + public bool SetProperties(ModelDoc2 doc, object properties, bool docChange, out string errMsg) + { + this.doc = doc; + var data = docChange ? InitData : null; + return NameConstant.SetProperties(this, properties, data, out errMsg); + } + + public bool SaveDoc(ref int err, ref int warn) + { + Dictionary<string, string> props = GetAllProperties(); + CustomPropertyUtil.SetCustomProperties(doc, props); + if (doc.Save3((int)swSaveAsOptions_e.swSaveAsOptions_AvoidRebuildOnSave, + ref err, ref warn)) + { + InitData = props; + return true; + } + return false; + } + + /// <summary> + /// 鑾峰彇灞炴�� + /// </summary> + /// <returns></returns> + public Dictionary<string, string> GetAllProperties() + { + return NameConstant.GetAllProperties(this); + } + + public bool UpdateSingleProperty(string name, string value) + { + return NameConstant.UpdateSingleProperty(this, name, value); + } + + public void RefreshItem() + { + if (datas == null) + { + return; + } + var finalStuffs = stuffItemCache.Get(jgjType, new ObservableCollection<string> { "鏃�" }); + string key = $"{jgjType}_{stuff}"; + var finalSurfaces = surfaceItemCache.Get(key, new ObservableCollection<string> { "鏃�" }); + var finalHeats = heatItemCache.Get(key, new ObservableCollection<string> { "鏃�" }); + + Dispatcher.Invoke(() => + { + stuffItems = finalStuffs; + surfaceItems = finalSurfaces; + heatItems = finalHeats; + }); + } + + public bool SetSettings(object settings) + { + Dictionary<string, JgjType> datas = settings as Dictionary<string, JgjType>; + this.datas = datas; + + stuffItemCache = new Dictionary<string, ObservableCollection<string>>(); + + surfaceItemCache = new Dictionary<string, ObservableCollection<string>>(); + + heatItemCache = new Dictionary<string, ObservableCollection<string>>(); + + ObservableCollection<string> jgjTypes = new ObservableCollection<string> { "鏃�" }; + + foreach (string key in datas.Keys) + { + jgjTypes.Add(key); + JgjType type = datas[key]; + ObservableCollection<string> stuffs = new ObservableCollection<string> { "鏃�" }; + + Dictionary<string, StuffType> stuffDatas = type.stuffMap; + foreach (string stuff in stuffDatas.Keys) + { + if (stuff != "鏃�") + { + stuffs.Add(stuff); + } + StuffType stuffType = stuffDatas[stuff]; + string key2 = key + "_" + stuff; + + ObservableCollection<string> surfaces = new ObservableCollection<string> { "鏃�" }; + ObservableCollection<string> heats = new ObservableCollection<string> { "鏃�" }; + foreach (string surface in stuffType.surfaceParam) + { + if (surface != "鏃�") surfaces.Add(surface); + } + foreach (string heat in stuffType.heatParam) + { + if (heat != "鏃�") heats.Add(heat); + } + surfaceItemCache.Add(key2, surfaces); + heatItemCache.Add(key2, heats); + } + stuffItemCache.Add(key, stuffs); + if (!stuffItemCache.ContainsKey("鏃�")) + { + stuffItemCache.Add("鏃�", new ObservableCollection<string> { "鏃�" }); + } + } + + Dispatcher.Invoke(() => + { + jgjTypeItems = jgjTypes; + }); + return true; + } + + public bool ClearAllProperties(out string ErrMsg) + { + ErrMsg = null; + return true; + } + + public bool GetDocChanged() + { + return NameConstant.CompareWithInit(this, InitData); + } + + public bool ResetProperty(out string errMsg) + { + return SetProperties(doc, InitData, false, out errMsg); + } + + private void stuffInput_DropDownOpened(object sender, System.EventArgs e) + { + ComboBox comboBox = sender as ComboBox; + if (comboBox == null) return; + if (comboBox.Name == "stuffInput") + { + stuffItems = stuffItemCache.Get(jgjType, new ObservableCollection<string> { "鏃�" }); + } + else if (comboBox.Name == "surfaceInput") + { + string key = $"{jgjType}_{stuff}"; + surfaceItems = surfaceItemCache.Get(key, new ObservableCollection<string> { "鏃�" }); + } + else if (comboBox.Name == "heatInput") + { + string key = $"{jgjType}_{stuff}"; + heatItems = heatItemCache.Get(key, new ObservableCollection<string> { "鏃�" }); + } + } + + private void UpdateField(string field, string value) + { + if (field == "jgjType") + { + if (NameConstant.SpecialJgjType.Contains(value)) + { + docType = "鍔犲伐浠�"; + DocTypeEnabled = false; + } + else + { + DocTypeEnabled = true; + } + return; + } + } + } +} diff --git a/SolidWorksListener/Listener.cs b/SolidWorksListener/Listener.cs index 1719930..531f88a 100644 --- a/SolidWorksListener/Listener.cs +++ b/SolidWorksListener/Listener.cs @@ -6,6 +6,7 @@ using System.Net; using System.Reflection; using System.Runtime.InteropServices; +using System.Security.Principal; using System.Text; using System.Timers; using System.Windows; @@ -84,7 +85,7 @@ // WinAPI_Interop.ShowServiceMessage(msg, "鎻愮ず"); // ShowMessageBox(msg, "鎻愮ず"); string exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - string alertPath = Path.GetFullPath(Path.Combine(exeDir,"..","Alert.exe")); + string alertPath = Path.GetFullPath(Path.Combine(exeDir, "..", "Alert.exe")); if (File.Exists(alertPath)) { Process.Start(alertPath); @@ -221,9 +222,16 @@ private bool IsSwRunning() { Process[] ps = Process.GetProcessesByName("SLDWORKS"); - bool IsRunning = (ps != null && ps.Length > 0); + bool IsRunning = false; + if (ps == null || ps.Length <= 0) + { + log.Debug($"Sw Is Running: {IsRunning}"); + return false; + } + IsRunning = true; + string username = WindowsIdentity.GetCurrent().Name; log.Debug($"Sw Is Running: {IsRunning}"); - return IsRunning; + return false; } /// <summary> @@ -232,7 +240,7 @@ private void HandleErr() { log.Debug($"err_count: {err_count}"); - if (++err_count > 3) + if (++err_count > 5) { if (IsSwRunning()) { diff --git a/WpfUI/AsyncAttacher.cs b/WpfUI/AsyncAttacher.cs index 68c6498..2fecf64 100644 --- a/WpfUI/AsyncAttacher.cs +++ b/WpfUI/AsyncAttacher.cs @@ -22,7 +22,7 @@ while (modDoc != null) { - LimitedConcurrencyLevelTaskScheduler.Factory.StartNew(() => { + Task.Factory.StartNew(() => { if (!OpenDocContext.IsOpenDoc(modDoc)) { AttachModelDocEventHandler(modDoc); -- Gitblit v1.9.1