提交 eabde2e9 编写于 作者: leaky114's avatar leaky114

22.3.10 增加批量打印相关

上级 b0cc2db6
......@@ -11,7 +11,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyTitle("InAI")>
<Assembly: AssemblyDescription("InventorAddIn For Inventor 2015")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("InAI")>
<Assembly: AssemblyProduct("InAI For 2015")>
<Assembly: AssemblyCopyright("leaky114")>
<Assembly: AssemblyTrademark("")>
......@@ -28,5 +28,5 @@ Imports System.Runtime.InteropServices
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.22.2.16")>
<Assembly: AssemblyFileVersionAttribute("1.22.2.16")>
\ No newline at end of file
<Assembly: AssemblyVersion("1.22.03.10")>
<Assembly: AssemblyFileVersionAttribute("1.22.03.10")>
\ No newline at end of file
......@@ -58,3 +58,10 @@
1.22.2.25
[+]优化按BOM导入ERP数据
[+]增加在线帮助
1.22.3.3
[+]增加针对Inventor版本的更新策略
1.22.3.10
[+]优化批量打印【从部件导入】的策略
[+]增加批量打印文件列表操作右键菜单
......@@ -269,6 +269,8 @@ Public Class frmAutoPartNumber
LV.Items.Clear()
LV.BeginUpdate()
'获取结构化的bom页面
For Each oBOMView As BOMView In oBOM.BOMViews
If oBOMView.ViewType = BOMViewTypeEnum.kStructuredBOMViewType Then
......@@ -301,6 +303,8 @@ Public Class frmAutoPartNumber
End If
Next
LV.EndUpdate()
End Sub
'移出项
......
......@@ -11,6 +11,7 @@ Public Class frmInventoryCoding
Private Sub btnLoadFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadFile.Click
btnLoadFile.Enabled = False
lvwFileList.Items.Clear()
SetStatusBarText()
......@@ -38,6 +39,8 @@ Public Class frmInventoryCoding
'Set a reference to the "Structured" BOMView
Dim oBOMView As BOMView
lvwFileList.BeginUpdate()
'获取结构化的bom页面
For Each oBOMView In oBOM.BOMViews
If oBOMView.ViewType = BOMViewTypeEnum.kStructuredBOMViewType Then
......@@ -45,6 +48,8 @@ Public Class frmInventoryCoding
QueryBOMRowToLoadiPro(oBOMView.BOMRows, lvwFileList)
End If
Next
lvwFileList.EndUpdate()
'==============================================================================================
......
......@@ -22,6 +22,7 @@ Partial Class frmPrint
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.btnStart = New System.Windows.Forms.Button()
Me.btnClose = New System.Windows.Forms.Button()
Me.btnAddFile = New System.Windows.Forms.Button()
......@@ -40,11 +41,15 @@ Partial Class frmPrint
Me.chkBlack = New System.Windows.Forms.CheckBox()
Me.btnLoadAsm = New System.Windows.Forms.Button()
Me.btnLoadIdw = New System.Windows.Forms.Button()
Me.btnRemove = New System.Windows.Forms.Button()
Me.lvwFileListView = New System.Windows.Forms.ListView()
Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.cmsRemove = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.tsmiRemove = New System.Windows.Forms.ToolStripMenuItem()
Me.tsmiRemoveFilter = New System.Windows.Forms.ToolStripMenuItem()
Me.tsmiSaveFilter = New System.Windows.Forms.ToolStripMenuItem()
Me.grpOption.SuspendLayout()
CType(Me.nudCopies, System.ComponentModel.ISupportInitialize).BeginInit()
Me.cmsRemove.SuspendLayout()
Me.SuspendLayout()
'
'btnStart
......@@ -71,7 +76,7 @@ Partial Class frmPrint
'btnAddFile
'
Me.btnAddFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnAddFile.Location = New System.Drawing.Point(107, 413)
Me.btnAddFile.Location = New System.Drawing.Point(118, 413)
Me.btnAddFile.Name = "btnAddFile"
Me.btnAddFile.Size = New System.Drawing.Size(85, 28)
Me.btnAddFile.TabIndex = 1
......@@ -81,7 +86,7 @@ Partial Class frmPrint
'btnClearList
'
Me.btnClearList.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnClearList.Location = New System.Drawing.Point(476, 413)
Me.btnClearList.Location = New System.Drawing.Point(446, 413)
Me.btnClearList.Name = "btnClearList"
Me.btnClearList.Size = New System.Drawing.Size(85, 28)
Me.btnClearList.TabIndex = 3
......@@ -91,7 +96,7 @@ Partial Class frmPrint
'btnAddFolder
'
Me.btnAddFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnAddFolder.Location = New System.Drawing.Point(200, 413)
Me.btnAddFolder.Location = New System.Drawing.Point(219, 413)
Me.btnAddFolder.Name = "btnAddFolder"
Me.btnAddFolder.Size = New System.Drawing.Size(85, 28)
Me.btnAddFolder.TabIndex = 2
......@@ -231,7 +236,7 @@ Partial Class frmPrint
'btnLoadAsm
'
Me.btnLoadAsm.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnLoadAsm.Location = New System.Drawing.Point(14, 413)
Me.btnLoadAsm.Location = New System.Drawing.Point(17, 413)
Me.btnLoadAsm.Name = "btnLoadAsm"
Me.btnLoadAsm.Size = New System.Drawing.Size(85, 28)
Me.btnLoadAsm.TabIndex = 0
......@@ -240,22 +245,13 @@ Partial Class frmPrint
'
'btnLoadIdw
'
Me.btnLoadIdw.Location = New System.Drawing.Point(293, 413)
Me.btnLoadIdw.Location = New System.Drawing.Point(320, 413)
Me.btnLoadIdw.Name = "btnLoadIdw"
Me.btnLoadIdw.Size = New System.Drawing.Size(110, 28)
Me.btnLoadIdw.TabIndex = 34
Me.btnLoadIdw.Text = "导入已打开文件"
Me.btnLoadIdw.UseVisualStyleBackColor = True
'
'btnRemove
'
Me.btnRemove.Location = New System.Drawing.Point(411, 413)
Me.btnRemove.Name = "btnRemove"
Me.btnRemove.Size = New System.Drawing.Size(57, 28)
Me.btnRemove.TabIndex = 35
Me.btnRemove.Text = "移出"
Me.btnRemove.UseVisualStyleBackColor = True
'
'lvwFileListView
'
Me.lvwFileListView.AllowColumnReorder = True
......@@ -263,6 +259,7 @@ Partial Class frmPrint
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lvwFileListView.AutoArrange = False
Me.lvwFileListView.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1})
Me.lvwFileListView.ContextMenuStrip = Me.cmsRemove
Me.lvwFileListView.FullRowSelect = True
Me.lvwFileListView.Location = New System.Drawing.Point(15, 11)
Me.lvwFileListView.Name = "lvwFileListView"
......@@ -277,6 +274,30 @@ Partial Class frmPrint
Me.ColumnHeader1.Text = "文件名"
Me.ColumnHeader1.Width = 650
'
'cmsRemove
'
Me.cmsRemove.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsmiRemove, Me.tsmiRemoveFilter, Me.tsmiSaveFilter})
Me.cmsRemove.Name = "cmsRemove"
Me.cmsRemove.Size = New System.Drawing.Size(125, 70)
'
'tsmiRemove
'
Me.tsmiRemove.Name = "tsmiRemove"
Me.tsmiRemove.Size = New System.Drawing.Size(124, 22)
Me.tsmiRemove.Text = "移除"
'
'tsmiRemoveFilter
'
Me.tsmiRemoveFilter.Name = "tsmiRemoveFilter"
Me.tsmiRemoveFilter.Size = New System.Drawing.Size(124, 22)
Me.tsmiRemoveFilter.Text = "筛选移除"
'
'tsmiSaveFilter
'
Me.tsmiSaveFilter.Name = "tsmiSaveFilter"
Me.tsmiSaveFilter.Size = New System.Drawing.Size(124, 22)
Me.tsmiSaveFilter.Text = "筛选保留"
'
'frmPrint
'
Me.AcceptButton = Me.btnStart
......@@ -284,7 +305,6 @@ Partial Class frmPrint
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.btnClose
Me.ClientSize = New System.Drawing.Size(831, 450)
Me.Controls.Add(Me.btnRemove)
Me.Controls.Add(Me.btnLoadIdw)
Me.Controls.Add(Me.btnLoadAsm)
Me.Controls.Add(Me.grpOption)
......@@ -306,6 +326,7 @@ Partial Class frmPrint
Me.grpOption.ResumeLayout(False)
Me.grpOption.PerformLayout()
CType(Me.nudCopies, System.ComponentModel.ISupportInitialize).EndInit()
Me.cmsRemove.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
......@@ -325,10 +346,13 @@ Partial Class frmPrint
Friend WithEvents btnAddFile As System.Windows.Forms.Button
Friend WithEvents btnLoadAsm As System.Windows.Forms.Button
Friend WithEvents btnLoadIdw As System.Windows.Forms.Button
Friend WithEvents btnRemove As System.Windows.Forms.Button
Friend WithEvents lvwFileListView As System.Windows.Forms.ListView
Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
Friend WithEvents chkClose As System.Windows.Forms.CheckBox
Friend WithEvents chkSave As System.Windows.Forms.CheckBox
Friend WithEvents cmsRemove As System.Windows.Forms.ContextMenuStrip
Friend WithEvents tsmiRemoveFilter As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents tsmiSaveFilter As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents tsmiRemove As System.Windows.Forms.ToolStripMenuItem
End Class
......@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="cmsRemove.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>49</value>
</metadata>
......
......@@ -20,12 +20,15 @@ Public Class frmPrint
Dim sPrinterName As String = ""
sPrinterName = cmbPrinter.Text
For i = 0 To lvwFileListView.Items.Count - 1
lvwFileListView.Items(i).Selected = True
'For i = 0 To lvwFileListView.Items.Count - 1
For Each olistviewitem As ListViewItem In lvwFileListView.Items
'lvwFileListView.Items(i).Selected = True
olistviewitem.Selected = True
'打开文件
Dim InvDocFullFileName As String '工程图全文件名
InvDocFullFileName = lvwFileListView.Items(i).Text
InvDocFullFileName = olistviewitem.Text
If IsFileExsts(InvDocFullFileName) = False Then '跳过不存在的文件
GoTo 999
......@@ -89,19 +92,25 @@ Public Class frmPrint
.Multiselect = True '多开文件打开
If .ShowDialog = Windows.Forms.DialogResult.OK Then '如果打开窗口OK
If .FileName <> "" Then '如果有选中文件
For Each FullFileName As String In .FileNames
lvwFileListView.Items.Add(FullFileName)
For Each IdwFullFileName As String In .FileNames
AddItemToListView(lvwFileListView, IdwFullFileName)
Next
End If
Else
Exit Sub
End If
Me.Text = "批量打印 (共" & lvwFileListView.Items.Count & "张)"
End With
End Sub
'清空文件列表
Private Sub btnClearList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearList.Click
lvwFileListView.Items.Clear()
Me.Text = "批量打印"
End Sub
'添加文件夹
......@@ -134,6 +143,7 @@ Public Class frmPrint
GetAllFile(Present_Folder, destinationFolder, lvwFileListView)
Me.Text = "批量打印 (共" & lvwFileListView.Items.Count & "张)"
End Sub
'打印文档,打印机名称
......@@ -253,46 +263,120 @@ Public Class frmPrint
End If
End With
' 获取所有引用文档
Dim oAllReferencedDocuments As DocumentsEnumerator
oAllReferencedDocuments = AssDoc.AllReferencedDocuments
' 遍历这些文档
' ' 获取所有引用文档
' Dim oAllReferencedDocuments As DocumentsEnumerator
' oAllReferencedDocuments = AssDoc.AllReferencedDocuments
' ' 遍历这些文档
' For Each ReferencedDocument As Inventor.Document In oAllReferencedDocuments
' Dim FullFileName As String
' FullFileName = ReferencedDocument.FullDocumentName
' Dim IdwFullFileName As String
' IdwFullFileName = GetNewExtensionFileName(FullFileName, ".idw")
' If IsFileExsts(IdwFullFileName) = False Then '跳过不存在的文件
' GoTo 999
' End If
For Each ReferencedDocument As Inventor.Document In oAllReferencedDocuments
' If InStr(FullFileName, ContentCenterFiles) > 0 Then '跳过零件库文件
' GoTo 999
' End If
Dim FullFileName As String
FullFileName = ReferencedDocument.FullDocumentName
' lvwFileListView.Items.Add(IdwFullFileName)
'999:
' Next
'===================================
'基于bom结构化数据,可跳过参考的文件
' Set a reference to the BOM
Dim oBOM As BOM
oBOM = AssDoc.ComponentDefinition.BOM
oBOM.StructuredViewEnabled = True
'Set a reference to the "Structured" BOMView
Dim oBOMView As BOMView
Me.Cursor = Cursors.WaitCursor
lvwFileListView.BeginUpdate()
'获取结构化的bom页面
For Each oBOMView In oBOM.BOMViews
If oBOMView.ViewType = BOMViewTypeEnum.kStructuredBOMViewType Then
'遍历这个bom页面
QueryBOMRowToLoadFile(oBOMView.BOMRows, lvwFileListView)
End If
Next
lvwFileListView.EndUpdate()
Me.Cursor = Cursors.Default
Me.Text = "批量打印 (共" & lvwFileListView.Items.Count & "张)"
End Sub
Private Sub QueryBOMRowToLoadFile(ByVal oBOMRows As BOMRowsEnumerator, olistiview As ListView)
Dim i As Integer
Dim iStepCount As Short
iStepCount = oBOMRows.Count
'Create a new ProgressBar object.
'Dim oProgressBar As Inventor.ProgressBar
'oProgressBar = ThisApplication.CreateProgressBar(False, iStepCount, "当前文件: ")
For i = 1 To oBOMRows.Count
' Get the current row.
Dim oBOMRow As BOMRow
oBOMRow = oBOMRows.Item(i)
Dim oFullFileName As String
oFullFileName = oBOMRow.ReferencedFileDescriptor.FullFileName
'测试文件
Debug.Print(oFullFileName)
' Set the message for the progress bar
'oProgressBar.Message = oFullFileName
Dim IdwFullFileName As String
IdwFullFileName = GetNewExtensionFileName(FullFileName, ".idw")
IdwFullFileName = GetNewExtensionFileName(oFullFileName, ".idw")
If IsFileExsts(IdwFullFileName) = False Then '跳过不存在的文件
GoTo 999
End If
If InStr(FullFileName, ContentCenterFiles) > 0 Then '跳过零件库文件
If InStr(oFullFileName, ContentCenterFiles) > 0 Then '跳过零件库文件
GoTo 999
End If
lvwFileListView.Items.Add(IdwFullFileName)
AddItemToListView(lvwFileListView, IdwFullFileName)
'遍历下一级
If (Not oBOMRow.ChildRows Is Nothing) Then
Call QueryBOMRowToLoadFile(oBOMRow.ChildRows, olistiview)
End If
999:
'oProgressBar.UpdateProgress()
Next
End Sub
'oProgressBar.Close()
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
ListViewDel(lvwFileListView)
End Sub
'移出项
Private Sub ListViewDel(ByVal ListView As ListView)
For i As Integer = ListView.SelectedIndices.Count - 1 To 0 Step -1
ListView.Items.RemoveAt(ListView.SelectedIndices(i))
Next
Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub btnLoadIdw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadIdw.Click
Try
lblsuggest.Visible = False
......@@ -305,13 +389,97 @@ Public Class frmPrint
For Each oInventorDocument As Inventor.Document In ThisApplication.Documents
If oInventorDocument.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
lvwFileListView.Items.Add(oInventorDocument.FullDocumentName)
AddItemToListView(lvwFileListView, oInventorDocument.FullDocumentName)
End If
Next
Me.Text = "批量打印 (共" & lvwFileListView.Items.Count & "张)"
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
'移除
Private Sub tsmiRemove_Click(sender As System.Object, e As System.EventArgs) Handles tsmiRemove.Click
ListViewDel(lvwFileListView)
Me.Text = "批量打印 (共" & lvwFileListView.Items.Count & "张)"
End Sub
'筛选移除
Private Sub tsmiRemoveFilter_Click(sender As System.Object, e As System.EventArgs) Handles tsmiRemoveFilter.Click
Dim strFilter As String
Dim frmInputBox As New frmInputBox
999:
With frmInputBox
.txtInPut.Text = ""
.Text = "筛选文件"
.lblDescribe.Text = "按图号输入筛选字段。"
.StartPosition = FormStartPosition.CenterScreen
.ShowDialog()
End With
If (frmInputBox.DialogResult = Windows.Forms.DialogResult.OK) And (frmInputBox.txtInPut.Text <> "") Then
strFilter = frmInputBox.txtInPut.Text
Else
Exit Sub
End If
For Each oListViewItem As ListViewItem In lvwFileListView.Items
Dim InvDocFullFileName As String '工程图全文件名
InvDocFullFileName = oListViewItem.Text
Dim InvDocFullFileONlyName As String
InvDocFullFileONlyName = GetFileNameInfo(InvDocFullFileName).ONlyName
If InStr(InvDocFullFileONlyName, strFilter) <> 0 Then
oListViewItem.Remove()
End If
Next
Me.Text = "批量打印 (共" & lvwFileListView.Items.Count & "张)"
End Sub
'筛选保留
Private Sub tsmiSaveFilter_Click(sender As System.Object, e As System.EventArgs) Handles tsmiSaveFilter.Click
Dim strFilter As String
Dim frmInputBox As New frmInputBox
999:
With frmInputBox
.txtInPut.Text = ""
.Text = "筛选文件"
.lblDescribe.Text = "按图号输入筛选字段。"
.StartPosition = FormStartPosition.CenterScreen
.ShowDialog()
End With
If (frmInputBox.DialogResult = Windows.Forms.DialogResult.OK) And (frmInputBox.txtInPut.Text <> "") Then
strFilter = frmInputBox.txtInPut.Text
Else
Exit Sub
End If
For Each oListViewItem As ListViewItem In lvwFileListView.Items
Dim InvDocFullFileName As String '工程图全文件名
InvDocFullFileName = oListViewItem.Text
Dim InvDocFullFileONlyName As String
InvDocFullFileONlyName = GetFileNameInfo(InvDocFullFileName).ONlyName
If InStr(InvDocFullFileONlyName, strFilter) = 0 Then
oListViewItem.Remove()
End If
Next
Me.Text = "批量打印 (共" & lvwFileListView.Items.Count & "张)"
End Sub
End Class
\ No newline at end of file
......@@ -24,7 +24,6 @@ Partial Class frmSaveAs
Private Sub InitializeComponent()
Me.btnStart = New System.Windows.Forms.Button()
Me.btnClose = New System.Windows.Forms.Button()
Me.lstFileList = New System.Windows.Forms.ListBox()
Me.btnAddFile = New System.Windows.Forms.Button()
Me.btnClearList = New System.Windows.Forms.Button()
Me.btnAddFolder = New System.Windows.Forms.Button()
......@@ -36,11 +35,13 @@ Partial Class frmSaveAs
Me.rdoLocal = New System.Windows.Forms.RadioButton()
Me.btnRemove = New System.Windows.Forms.Button()
Me.btnOpenFolder = New System.Windows.Forms.Button()
Me.SuspendLayout()
Me.lvwFileListView = New System.Windows.Forms.ListView()
Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(),System.Windows.Forms.ColumnHeader)
Me.SuspendLayout
'
'btnStart
'
Me.btnStart.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnStart.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.btnStart.Location = New System.Drawing.Point(385, 298)
Me.btnStart.Name = "btnStart"
Me.btnStart.Size = New System.Drawing.Size(57, 28)
......@@ -49,7 +50,7 @@ Partial Class frmSaveAs
'
'btnClose
'
Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnClose.Location = New System.Drawing.Point(448, 298)
Me.btnClose.Name = "btnClose"
......@@ -57,86 +58,74 @@ Partial Class frmSaveAs
Me.btnClose.TabIndex = 1
Me.btnClose.Text = "关闭"
'
'lstFileList
'
Me.lstFileList.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lstFileList.FormattingEnabled = True
Me.lstFileList.HorizontalScrollbar = True
Me.lstFileList.ItemHeight = 12
Me.lstFileList.Location = New System.Drawing.Point(12, 10)
Me.lstFileList.Name = "lstFileList"
Me.lstFileList.Size = New System.Drawing.Size(493, 220)
Me.lstFileList.TabIndex = 15
'
'btnAddFile
'
Me.btnAddFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnAddFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.btnAddFile.Location = New System.Drawing.Point(23, 298)
Me.btnAddFile.Name = "btnAddFile"
Me.btnAddFile.Size = New System.Drawing.Size(69, 28)
Me.btnAddFile.TabIndex = 0
Me.btnAddFile.Text = "添加文件"
Me.btnAddFile.UseVisualStyleBackColor = True
Me.btnAddFile.UseVisualStyleBackColor = true
'
'btnClearList
'
Me.btnClearList.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnClearList.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.btnClearList.Location = New System.Drawing.Point(189, 298)
Me.btnClearList.Name = "btnClearList"
Me.btnClearList.Size = New System.Drawing.Size(69, 28)
Me.btnClearList.TabIndex = 20
Me.btnClearList.Text = "清除列表"
Me.btnClearList.UseVisualStyleBackColor = True
Me.btnClearList.UseVisualStyleBackColor = true
'
'btnAddFolder
'
Me.btnAddFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnAddFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.btnAddFolder.Location = New System.Drawing.Point(100, 298)
Me.btnAddFolder.Name = "btnAddFolder"
Me.btnAddFolder.Size = New System.Drawing.Size(81, 28)
Me.btnAddFolder.TabIndex = 21
Me.btnAddFolder.Text = "添加文件夹"
Me.btnAddFolder.UseVisualStyleBackColor = True
Me.btnAddFolder.UseVisualStyleBackColor = true
'
'chkDwg
'
Me.chkDwg.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.chkDwg.AutoSize = True
Me.chkDwg.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.chkDwg.AutoSize = true
Me.chkDwg.Location = New System.Drawing.Point(20, 245)
Me.chkDwg.Name = "chkDwg"
Me.chkDwg.Size = New System.Drawing.Size(90, 16)
Me.chkDwg.TabIndex = 22
Me.chkDwg.Text = "AutoCAD.dwg"
Me.chkDwg.UseVisualStyleBackColor = True
Me.chkDwg.UseVisualStyleBackColor = true
'
'chkPdf
'
Me.chkPdf.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.chkPdf.AutoSize = True
Me.chkPdf.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.chkPdf.AutoSize = true
Me.chkPdf.Location = New System.Drawing.Point(135, 245)
Me.chkPdf.Name = "chkPdf"
Me.chkPdf.Size = New System.Drawing.Size(78, 16)
Me.chkPdf.TabIndex = 23
Me.chkPdf.Text = "Adobe.pdf"
Me.chkPdf.UseVisualStyleBackColor = True
Me.chkPdf.UseVisualStyleBackColor = true
'
'chkPic
'
Me.chkPic.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.chkPic.AutoSize = True
Me.chkPic.Enabled = False
Me.chkPic.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.chkPic.AutoSize = true
Me.chkPic.Enabled = false
Me.chkPic.Location = New System.Drawing.Point(231, 245)
Me.chkPic.Name = "chkPic"
Me.chkPic.Size = New System.Drawing.Size(72, 16)
Me.chkPic.TabIndex = 24
Me.chkPic.Text = "图片.jpg"
Me.chkPic.UseVisualStyleBackColor = True
Me.chkPic.Visible = False
Me.chkPic.UseVisualStyleBackColor = true
Me.chkPic.Visible = false
'
'txtString
'
Me.txtString.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.txtString.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.txtString.Location = New System.Drawing.Point(20, 267)
Me.txtString.Name = "txtString"
Me.txtString.Size = New System.Drawing.Size(445, 21)
......@@ -144,55 +133,77 @@ Partial Class frmSaveAs
'
'rdoSameFolder
'
Me.rdoSameFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.rdoSameFolder.AutoSize = True
Me.rdoSameFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.rdoSameFolder.AutoSize = true
Me.rdoSameFolder.Location = New System.Drawing.Point(416, 245)
Me.rdoSameFolder.Name = "rdoSameFolder"
Me.rdoSameFolder.Size = New System.Drawing.Size(95, 16)
Me.rdoSameFolder.TabIndex = 28
Me.rdoSameFolder.Text = "同一个文件夹"
Me.rdoSameFolder.UseVisualStyleBackColor = True
Me.rdoSameFolder.UseVisualStyleBackColor = true
'
'rdoLocal
'
Me.rdoLocal.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.rdoLocal.AutoSize = True
Me.rdoLocal.Checked = True
Me.rdoLocal.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.rdoLocal.AutoSize = true
Me.rdoLocal.Checked = true
Me.rdoLocal.Location = New System.Drawing.Point(318, 245)
Me.rdoLocal.Name = "rdoLocal"
Me.rdoLocal.Size = New System.Drawing.Size(83, 16)
Me.rdoLocal.TabIndex = 27
Me.rdoLocal.TabStop = True
Me.rdoLocal.TabStop = true
Me.rdoLocal.Text = "当前文件夹"
Me.rdoLocal.UseVisualStyleBackColor = True
Me.rdoLocal.UseVisualStyleBackColor = true
'
'btnRemove
'
Me.btnRemove.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.btnRemove.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
Me.btnRemove.Location = New System.Drawing.Point(266, 298)
Me.btnRemove.Name = "btnRemove"
Me.btnRemove.Size = New System.Drawing.Size(69, 28)
Me.btnRemove.TabIndex = 30
Me.btnRemove.Text = "移除"
Me.btnRemove.UseVisualStyleBackColor = True
Me.btnRemove.UseVisualStyleBackColor = true
'
'btnOpenFolder
'
Me.btnOpenFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnOpenFolder.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.btnOpenFolder.Location = New System.Drawing.Point(471, 267)
Me.btnOpenFolder.Name = "btnOpenFolder"
Me.btnOpenFolder.Size = New System.Drawing.Size(34, 21)
Me.btnOpenFolder.TabIndex = 31
Me.btnOpenFolder.Text = "..."
Me.btnOpenFolder.UseVisualStyleBackColor = True
Me.btnOpenFolder.UseVisualStyleBackColor = true
'
'lvwFileListView
'
Me.lvwFileListView.AllowColumnReorder = true
Me.lvwFileListView.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
Me.lvwFileListView.AutoArrange = false
Me.lvwFileListView.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1})
Me.lvwFileListView.FullRowSelect = true
Me.lvwFileListView.Location = New System.Drawing.Point(12, 12)
Me.lvwFileListView.Name = "lvwFileListView"
Me.lvwFileListView.Size = New System.Drawing.Size(493, 217)
Me.lvwFileListView.Sorting = System.Windows.Forms.SortOrder.Ascending
Me.lvwFileListView.TabIndex = 37
Me.lvwFileListView.UseCompatibleStateImageBehavior = false
Me.lvwFileListView.View = System.Windows.Forms.View.Details
'
'ColumnHeader1
'
Me.ColumnHeader1.Text = "文件名"
Me.ColumnHeader1.Width = 650
'
'frmSaveAs
'
Me.AcceptButton = Me.btnStart
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 12!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.btnClose
Me.ClientSize = New System.Drawing.Size(517, 340)
Me.Controls.Add(Me.lvwFileListView)
Me.Controls.Add(Me.btnOpenFolder)
Me.Controls.Add(Me.btnRemove)
Me.Controls.Add(Me.txtString)
......@@ -204,24 +215,22 @@ Partial Class frmSaveAs
Me.Controls.Add(Me.btnAddFolder)
Me.Controls.Add(Me.btnClearList)
Me.Controls.Add(Me.btnAddFile)
Me.Controls.Add(Me.lstFileList)
Me.Controls.Add(Me.btnClose)
Me.Controls.Add(Me.btnStart)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.MaximizeBox = false
Me.MinimizeBox = false
Me.Name = "frmSaveAs"
Me.ShowIcon = False
Me.ShowInTaskbar = False
Me.ShowIcon = false
Me.ShowInTaskbar = false
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "工程图批量另存"
Me.ResumeLayout(False)
Me.PerformLayout()
Me.ResumeLayout(false)
Me.PerformLayout
End Sub
End Sub
Friend WithEvents btnStart As System.Windows.Forms.Button
Friend WithEvents btnClose As System.Windows.Forms.Button
Friend WithEvents lstFileList As System.Windows.Forms.ListBox
Friend WithEvents btnAddFile As System.Windows.Forms.Button
Friend WithEvents btnClearList As System.Windows.Forms.Button
Friend WithEvents btnAddFolder As System.Windows.Forms.Button
......@@ -233,5 +242,7 @@ Partial Class frmSaveAs
Friend WithEvents rdoLocal As System.Windows.Forms.RadioButton
Friend WithEvents btnRemove As System.Windows.Forms.Button
Friend WithEvents btnOpenFolder As System.Windows.Forms.Button
Friend WithEvents lvwFileListView As System.Windows.Forms.ListView
Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
End Class
......@@ -17,17 +17,18 @@ Public Class frmSaveAs
Dim JpgFullFileName As String = Nothing 'jpg文件全文件名
Dim IdwFullFileName As String = Nothing '工程图全文件名
If lstFileList.Items.Count = 0 Then
If lvwFileListView.Items.Count = 0 Then
MsgBox("未添加工程图文件。", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "批量另存为")
Exit Sub
End If
For i = 0 To lstFileList.Items.Count - 1
lstFileList.SelectedIndex = i
For i = 0 To lvwFileListView.Items.Count - 1
'lvwFileListView.SelectedIndices.Item = i
'打开文件
IdwFullFileName = lstFileList.Items(i)
IdwFullFileName = lvwFileListView.Items(i).Text
If IsFileExsts(IdwFullFileName) = False Then '跳过不存在的文件
GoTo 999
......@@ -91,8 +92,8 @@ Public Class frmSaveAs
oInventorDocument.SaveAs(PdfFullFileName, True)
End Select
'关闭,不保存文件
'关闭,不保存文件
oInventorDocument.Close(True)
999:
......@@ -104,7 +105,7 @@ Public Class frmSaveAs
'关闭
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
lstFileList.Items.Clear()
lvwFileListView.Items.Clear()
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
......@@ -121,7 +122,7 @@ Public Class frmSaveAs
If .ShowDialog = Windows.Forms.DialogResult.OK Then '如果打开窗口OK
If .FileName <> "" Then '如果有选中文件
For Each FullFileName As String In .FileNames
lstFileList.Items.Add(FullFileName)
lvwFileListView.Items.Add(FullFileName)
Next
End If
Else
......@@ -132,7 +133,7 @@ Public Class frmSaveAs
'清空文件列表
Private Sub btnClearList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearList.Click
lstFileList.Items.Clear()
lvwFileListView.Items.Clear()
End Sub
'添加文件夹
......@@ -161,7 +162,7 @@ Public Class frmSaveAs
Present_Folder = My.Computer.FileSystem.GetParentPath(destinationFolder)
End If
GetAllFile(Present_Folder, destinationFolder, lstFileList)
GetAllFile(Present_Folder, destinationFolder, lvwFileListView)
End Sub
......@@ -192,9 +193,7 @@ Public Class frmSaveAs
'移除选择列
Private Sub btnRemove_Click(sender As System.Object, e As System.EventArgs) Handles btnRemove.Click
If lstFileList.SelectedItem <> 0 Then
lstFileList.Items.Remove(lstFileList.SelectedItem)
End If
ListViewDel(lvwFileListView)
End Sub
'选择文件夹
......
......@@ -15,9 +15,16 @@ Public Class frmUpdate
Dim DisplayVersion As String
DisplayVersion = ThisApplication.SoftwareVersion.DisplayVersion
Dim UpdateDownloadUrl As String
Dim UpdateInfoFileName As String = "Update.xml"
UpdateDownloadUrl = "\\likai-pc\发行版\更新包\" & DisplayVersion & "\{0}"
Dim UpdateParameter As String
UpdateParameter = UpdateDownloadUrl & " " & UpdateInfoFileName
simupdate = My.Application.Info.DirectoryPath & "\simupdater.exe"
If IsFileExsts(simupdate) = True Then
Process.Start(simupdate, DisplayVersion)
Process.Start(simupdate, "\\likai-pc\发行版\更新包\2011\{0} update.xml")
Else
MsgBox("缺失升级程序 simupdater.exe,请到本软件仓库下载。", MsgBoxStyle.OkOnly, "检查更新")
Process.Start(GitWeb)
......@@ -41,7 +48,6 @@ Public Class frmUpdate
chk检查更新.Checked = True
End Select
Dim fileReader As System.IO.StreamReader
fileReader = My.Computer.FileSystem.OpenTextFileReader(InNewVison)
Dim NewVersion As String = Nothing
......@@ -76,20 +82,20 @@ Public Class frmUpdate
'读取更新日志
Dim readText As String = File.ReadAllText(ChangeLog)
txtWhatNew.Text = readText
Me.ShowDialog()
'Me.ShowDialog()
Else
If IsShowUpdateMsg = True Then
MsgBox("当前为最新版。", MsgBoxStyle.OkOnly, "检查更新")
End If
Me.Close()
End If
End If
End If
Catch ex As Exception
Me.Close()
'MsgBox(ex.Message)
'MsgBox("未链接到服务器。", MsgBoxStyle.OkOnly, "检查更新")
Me.Close()
End Try
End Sub
......
......@@ -191,10 +191,11 @@ Module BasicFileSystem
End If
End Function
'删除一个文件(文件名,是否删除到回收站选项)
Public Function DelFile(ByVal FullFileName As String, ByVal RecycleOption As FileIO.RecycleOption) As Boolean
If IsFileExsts(FullFileName) Then
My.Computer.FileSystem.DeleteFile(FullFileName, FileIO.UIOption.OnlyErrorDialogs, RecycleOption, FileIO.UICancelOption.DoNothing)
My.Computer.FileSystem.DeleteFile(FullFileName, FileIO.UIOption.OnlyErrorDialogs, RecycleOption, FileIO.UICancelOption.ThrowException)
End If
DelFile = IsFileExsts(FullFileName) Xor True
End Function
......@@ -206,7 +207,6 @@ Module BasicFileSystem
DelFile(f, FileIO.RecycleOption.SendToRecycleBin)
Next
End If
Return True
End Function
'删除文件夹(文件夹)
......@@ -245,7 +245,7 @@ Module BasicFileSystem
End Function
'扫描文件夹
Public Sub GetAllFile(ByVal Boot_Folder As String, ByVal Source_Folder As String, ByVal olistbox As Object)
Public Sub GetAllFile(ByVal Boot_Folder As String, ByVal Source_Folder As String, ByVal olistbox As Object) ' ListBox)
' 源文件夹父文件夹 ,源文件夹 , 目标文件夹
Dim strDir As String() = System.IO.Directory.GetDirectories(Source_Folder)
Dim strFile As String() = System.IO.Directory.GetFiles(Source_Folder)
......@@ -262,7 +262,12 @@ Module BasicFileSystem
'Debug.Print(strFile(i))
File_Attribute = My.Computer.FileSystem.GetFileInfo(strFile(i))
If (LCase(File_Attribute.Extension) = IDW) And (Strings.InStr(File_Attribute.FullName, "OldVersions") = 0) Then
olistbox.Items.Add(File_Attribute.FullName)
AddItemToListView(olistbox, File_Attribute.FullName)
'olistbox.Items.Add(File_Attribute.FullName)
End If
Next
End If
......@@ -287,31 +292,18 @@ Module BasicFileSystem
inf = My.Computer.FileSystem.GetDirectoryInfo(strDir(i))
If inf.Name = "OldVersions" Then
'按文件删除,速度太慢,改为直接删除文件夹
'Dim strFile As String() = System.IO.Directory.GetFiles(strDir(i))
'For Each f As String In strFile
' SetStatusBarText(f)
' Select Case DeletePermanently
' Case True '永久删除
' DelFile(f, FileIO.RecycleOption.DeletePermanently)
' Case False '删除到垃圾箱
' DelFile(f, FileIO.RecycleOption.SendToRecycleBin)
' End Select
'Next
'按文件夹名删除
Dim directoryname As String
directoryname = inf.FullName
SetStatusBarText(directoryname)
Dim strFile As String() = System.IO.Directory.GetFiles(strDir(i))
Select Case DeletePermanently
Case True '永久删除
DelFolder(directoryname, FileIO.RecycleOption.DeletePermanently)
For Each f As String In strFile
SetStatusBarText(f)
Select Case DeletePermanently
Case True '永久删除
DelFile(f, FileIO.RecycleOption.DeletePermanently)
Case False '删除到垃圾箱
DelFile(f, FileIO.RecycleOption.SendToRecycleBin)
End Select
Case False '删除到垃圾箱
DelFolder(directoryname, FileIO.RecycleOption.SendToRecycleBin)
End Select
Next
End If
DelOldFile(strDir(i), DeletePermanently)
......@@ -328,8 +320,6 @@ Module BasicFileSystem
Dim strDir As String() = System.IO.Directory.GetDirectories(Boot_Folder)
Dim i As Integer
SetStatusBarText("扫描文件夹.......")
If strDir.Length > 0 Then
For i = 0 To strDir.Length - 1
Debug.Print(strDir(i))
......@@ -352,4 +342,25 @@ Module BasicFileSystem
End If
End Sub
End Module
\ No newline at end of file
'检查 listview中是否存在重复项,再添加
Public Function AddItemToListView(olistiview As ListView, ItemText As String) As Boolean
For Each oListViewItem As ListViewItem In olistiview.Items
If oListViewItem.Text = ItemText Then
AddItemToListView = False
Exit Function
End If
Next
olistiview.Items.Add(ItemText)
AddItemToListView = True
End Function
'移出 listview 中的选择项
Public Sub ListViewDel(ByVal ListView As ListView)
For i As Integer = ListView.SelectedIndices.Count - 1 To 0 Step -1
ListView.Items.RemoveAt(ListView.SelectedIndices(i))
Next
End Sub
End Module
B'设置为一个动作,可一次撤销
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册