개정판 272662f9
Design change
DTI_PID/SPPIDConverter/Main.vb | ||
---|---|---|
26 | 26 |
Private _Main_trd As Thread |
27 | 27 |
|
28 | 28 |
|
29 |
|
|
30 |
|
|
31 |
|
|
29 | 32 |
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
30 |
SetUpListViewColumns() |
|
31 |
LoadTree() |
|
33 |
|
|
32 | 34 |
If My.Settings.DBPath <> "" And My.Settings.Plant_Hierarchy <> "" Then |
33 | 35 |
Dim sDBPath As String = My.Settings.DBPath |
34 | 36 |
LoadDB(sDBPath) |
37 |
|
|
35 | 38 |
'TestPID() |
36 | 39 |
Else |
37 | 40 |
MessageBox.Show("설정값을 먼저 확인해주세요") |
... | ... | |
197 | 200 |
errHandler: |
198 | 201 |
' LogAndRaiseError ModuleName & "::GetConfigInfo " |
199 | 202 |
End Function |
200 |
Private Sub LoadTree() |
|
201 |
|
|
202 |
Dim i As Integer |
|
203 |
Dim j() As String |
|
204 |
j = Directory.GetLogicalDrives |
|
205 |
For i = 0 To UBound(j) |
|
206 |
|
|
207 |
Dim cdrive As System.IO.DriveInfo |
|
208 |
cdrive = My.Computer.FileSystem.GetDriveInfo(j(i).ToString) |
|
209 |
|
|
210 |
Select Case cdrive.DriveType |
|
211 |
Case DriveType.Fixed |
|
212 |
Tree_XMLFiles.Nodes.Add(j(i), j(i).ToString, 3) |
|
213 |
Case DriveType.CDRom |
|
214 |
Tree_XMLFiles.Nodes.Add(j(i), j(i).ToString, 11) |
|
215 |
Case DriveType.Network |
|
216 |
Tree_XMLFiles.Nodes.Add(j(i), j(i).ToString, 5) |
|
217 |
Case DriveType.Removable |
|
218 |
Tree_XMLFiles.Nodes.Add(j(i), j(i).ToString, 12) |
|
219 |
End Select |
|
220 |
|
|
221 |
Next |
|
222 |
End Sub |
|
223 |
|
|
224 |
Private Sub SetUpListViewColumns() |
|
225 |
' TODO: Add code to set up listview columns |
|
226 |
ListView_File.Columns.Add(" Name ") |
|
227 |
' ListView_File.Columns.Add(" Size ") |
|
228 |
' ListView_File.Columns.Add(" Extension ") |
|
229 |
ListView_File.Columns.Add(" Date Modified ") |
|
230 |
SetView(View.Details) |
|
231 |
End Sub |
|
232 | 203 |
|
233 | 204 |
|
234 |
Private Sub SetView(ByVal View As System.Windows.Forms.View) |
|
235 |
ListView_File.View = View.Details |
|
236 |
End Sub |
|
237 |
|
|
238 | 205 |
|
239 | 206 |
|
240 |
Private Sub InitXMLTree(ByVal sFolderPath As String) |
|
241 |
Tree_XMLFiles.Nodes.Clear() |
|
242 |
Dim oRootNode As TreeNode = Tree_XMLFiles.Nodes.Add("XML") |
|
243 |
'.XML 만 로드 |
|
244 |
Dim sfileEntries As String() = Directory.GetFiles(sFolderPath, "*.xml") |
|
245 |
' Process the list of files found in the directory. |
|
246 |
Dim sfileName As String |
|
247 |
For Each sfileName In sfileEntries |
|
248 |
oRootNode.Nodes.Add(sfileName) |
|
249 |
Next sfileName |
|
250 |
oRootNode.ExpandAll() |
|
251 |
End Sub |
|
252 |
|
|
253 | 207 |
|
254 | 208 |
|
255 | 209 |
|
... | ... | |
652 | 606 |
End Function |
653 | 607 |
|
654 | 608 |
|
655 |
Private Sub Tree_XMLFiles_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_XMLFiles.AfterCheck
|
|
609 |
Private Sub Tree_XMLFiles_AfterCheck(sender As Object, e As TreeViewEventArgs) |
|
656 | 610 |
If e.Node.Checked = True Then |
657 | 611 |
For Each oNode As TreeNode In e.Node.Nodes |
658 | 612 |
oNode.Checked = True |
... | ... | |
683 | 637 |
|
684 | 638 |
End Sub |
685 | 639 |
|
686 |
Dim first_start As Boolean = False |
|
687 |
Dim folders_path As String |
|
688 | 640 |
|
689 |
Private Sub Tree_XMLFiles_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles Tree_XMLFiles.AfterSelect |
|
690 |
If first_start = False Then Exit Sub |
|
691 |
Dim pa = e.Node.FullPath.ToString |
|
692 | 641 |
|
693 |
printfilesfolders_here(pa, e.Node) |
|
642 |
'Private Sub Tree_XMLFiles_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles Tree_XMLFiles.AfterSelect |
|
643 |
' If first_start = False Then Exit Sub |
|
644 |
' Dim pa = e.Node.FullPath.ToString |
|
694 | 645 |
|
695 |
displayfiles(pa)
|
|
646 |
' printfilesfolders_here(pa, e.Node)
|
|
696 | 647 |
|
697 |
''be careful ! displayfils comes BEFORE you change // to / in pa !!! |
|
698 |
Dim coco As String = "" |
|
699 |
coco = pa.ToString |
|
700 |
coco = coco.Replace("\\", "\") |
|
701 |
Me.Text = coco |
|
702 |
folders_path = coco |
|
703 |
End Sub |
|
648 |
' displayfiles(pa) |
|
649 |
|
|
650 |
' Dim coco As String = "" |
|
651 |
' coco = pa.ToString |
|
652 |
' coco = coco.Replace("\\", "\") |
|
653 |
' Me.Text = coco |
|
654 |
' folders_path = coco |
|
655 |
'End Sub |
|
704 | 656 |
|
705 | 657 |
Sub printfilesfolders_here(ByVal path As String, ByRef itree As TreeNode) |
706 | 658 |
|
... | ... | |
719 | 671 |
eee: |
720 | 672 |
End Sub |
721 | 673 |
|
722 |
Sub displayfiles(ByVal path As String) |
|
723 |
|
|
724 |
Dim lvItem As ListViewItem |
|
725 |
ListView_File.Items.Clear() |
|
726 | 674 |
|
727 |
' lvItem = ListView.Items.Add("ListViewItem1") |
|
728 |
' lvItem.SubItems.AddRange(New String() {"Size", "extention", "date modified"}) |
|
729 | 675 |
|
730 |
Dim filename As String |
|
731 |
On Error GoTo wwq |
|
732 |
' Directory.GetFiles(path).Length. |
|
733 |
'Me.ProgressBar_Status.Maximum = Directory.GetFiles(path).Length + 1 |
|
734 |
'Me.ProgressBar_Status.Value = 0 |
|
735 |
For Each filename In Directory.GetFiles(path) |
|
736 |
On Error GoTo wwq |
|
737 |
Dim jj_ = filename.LastIndexOf("\") |
|
738 |
Dim jj1_ = filename.Length - jj_ |
|
739 |
Dim fil = filename.Substring((jj_ + 1), (jj1_ - 1)) |
|
740 |
If fil.Contains(".xml") Then |
|
741 |
' Me.ProgressBar_Status.Value = Me.ProgressBar_Status.Value + 1 |
|
742 |
' ListView.Items.Add(fil, 13) ''old 13 28 |
|
743 |
lvItem = ListView_File.Items.Add(fil, 13) '2 5 7 work, 0 alos |
|
744 |
Dim infoReader As System.IO.FileInfo |
|
745 |
infoReader = My.Computer.FileSystem.GetFileInfo(filename) |
|
746 |
' lvItem.SubItems.AddRange(New String() {infoReader.Length.ToString + " Byte", infoReader.Extension.ToString, infoReader.LastWriteTime}) |
|
747 |
lvItem.SubItems.AddRange(New String() {infoReader.LastWriteTime}) |
|
748 |
ListView_File.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent) |
|
749 |
End If |
|
750 |
|
|
751 |
|
|
752 |
Next |
|
753 |
Exit Sub |
|
754 |
wwq: |
|
755 |
MsgBox(Err.Description) |
|
756 |
End Sub |
|
757 |
|
|
758 |
Private Sub Tree_XMLFiles_MouseMove(sender As Object, e As MouseEventArgs) Handles Tree_XMLFiles.MouseMove |
|
759 |
first_start = True |
|
760 |
End Sub |
|
761 |
|
|
762 |
Private Sub ListView_File_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView_File.SelectedIndexChanged |
|
763 |
Dim indexes As ListView.SelectedIndexCollection = |
|
764 |
Me.ListView_File.SelectedIndices |
|
765 |
Dim index As Integer |
|
766 |
|
|
767 |
For Each index In indexes |
|
768 |
'On Error Resume Next |
|
769 |
If folders_path.EndsWith("\") = True Then |
|
770 |
Me.Status_Main.Items(0).Text = folders_path + (Me.ListView_File.Items(index).Text) |
|
771 |
'On Error Resume Next |
|
772 |
Else |
|
773 |
Me.Status_Main.Items(0).Text = folders_path + "\" + (Me.ListView_File.Items(index).Text) |
|
774 |
End If |
|
775 |
|
|
776 |
Dim infoReader As System.IO.FileInfo |
|
777 |
infoReader = My.Computer.FileSystem.GetFileInfo(Me.Status_Main.Items(0).Text) |
|
778 |
Me.Status_Main.Items(1).Text = " Created : " + infoReader.CreationTime.ToString + " " + infoReader.Attributes.ToString |
|
779 |
Next |
|
780 |
End Sub |
|
781 |
|
|
782 |
Private Sub Procees() |
|
783 |
Dim indexes As ListView.SelectedIndexCollection = |
|
784 |
Me.ListView_File.SelectedIndices |
|
785 |
Dim index As Integer |
|
786 |
|
|
787 |
For Each index In indexes |
|
788 |
'On Error Resume Next |
|
789 |
If folders_path.EndsWith("\") = True Then |
|
790 |
On Error GoTo out |
|
791 |
Me.Status_Main.Items(0).Text = folders_path + (Me.ListView_File.Items(index).Text) |
|
792 |
On Error GoTo out |
|
793 |
'On Error Resume Next |
|
794 |
Else |
|
795 |
Me.Status_Main.Items(0).Text = folders_path + "\" + (Me.ListView_File.Items(index).Text) |
|
796 |
On Error GoTo out |
|
797 |
End If |
|
798 |
|
|
799 |
Dim infoReader As System.IO.FileInfo |
|
800 |
infoReader = My.Computer.FileSystem.GetFileInfo(Me.Status_Main.Items(0).Text) |
|
801 |
Me.Status_Main.Items(1).Text = " Created : " + infoReader.CreationTime.ToString + " " + infoReader.Attributes.ToString |
|
802 |
On Error GoTo out |
|
803 |
MsgBox(Me.Status_Main.Items(0).Text + " is processed") |
|
804 |
On Error GoTo out |
|
805 |
Next |
|
806 |
Exit Sub |
|
807 |
out: |
|
808 |
MsgBox(Err.Description) |
|
809 |
End Sub |
|
676 |
' Private Sub Tree_XMLFiles_MouseMove(sender As Object, e As MouseEventArgs) Handles Tree_XMLFiles.MouseMove |
|
677 |
' first_start = True |
|
678 |
' End Sub |
|
679 |
|
|
680 |
' Private Sub ListView_File_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView_File.SelectedIndexChanged |
|
681 |
' Dim indexes As ListView.SelectedIndexCollection = |
|
682 |
' Me.ListView_File.SelectedIndices |
|
683 |
' Dim index As Integer |
|
684 |
|
|
685 |
' For Each index In indexes |
|
686 |
' 'On Error Resume Next |
|
687 |
' If folders_path.EndsWith("\") = True Then |
|
688 |
' Me.Status_Main.Items(0).Text = folders_path + (Me.ListView_File.Items(index).Text) |
|
689 |
' 'On Error Resume Next |
|
690 |
' Else |
|
691 |
' Me.Status_Main.Items(0).Text = folders_path + "\" + (Me.ListView_File.Items(index).Text) |
|
692 |
' End If |
|
693 |
|
|
694 |
' Dim infoReader As System.IO.FileInfo |
|
695 |
' infoReader = My.Computer.FileSystem.GetFileInfo(Me.Status_Main.Items(0).Text) |
|
696 |
' Me.Status_Main.Items(1).Text = " Created : " + infoReader.CreationTime.ToString + " " + infoReader.Attributes.ToString |
|
697 |
' Next |
|
698 |
' End Sub |
|
699 |
|
|
700 |
' Private Sub Procees() |
|
701 |
' Dim indexes As ListView.SelectedIndexCollection = |
|
702 |
' Me.ListView_File.SelectedIndices |
|
703 |
' Dim index As Integer |
|
704 |
|
|
705 |
' For Each index In indexes |
|
706 |
' 'On Error Resume Next |
|
707 |
' If folders_path.EndsWith("\") = True Then |
|
708 |
' On Error GoTo out |
|
709 |
' Me.Status_Main.Items(0).Text = folders_path + (Me.ListView_File.Items(index).Text) |
|
710 |
' On Error GoTo out |
|
711 |
' 'On Error Resume Next |
|
712 |
' Else |
|
713 |
' Me.Status_Main.Items(0).Text = folders_path + "\" + (Me.ListView_File.Items(index).Text) |
|
714 |
' On Error GoTo out |
|
715 |
' End If |
|
716 |
|
|
717 |
' Dim infoReader As System.IO.FileInfo |
|
718 |
' infoReader = My.Computer.FileSystem.GetFileInfo(Me.Status_Main.Items(0).Text) |
|
719 |
' Me.Status_Main.Items(1).Text = " Created : " + infoReader.CreationTime.ToString + " " + infoReader.Attributes.ToString |
|
720 |
' On Error GoTo out |
|
721 |
' MsgBox(Me.Status_Main.Items(0).Text + " is processed") |
|
722 |
' On Error GoTo out |
|
723 |
' Next |
|
724 |
' Exit Sub |
|
725 |
'out: |
|
726 |
' MsgBox(Err.Description) |
|
727 |
'End Sub |
|
810 | 728 |
|
811 | 729 |
Private Function LoadAllDrawing() As DataTable |
812 | 730 |
|
... | ... | |
928 | 846 |
End Function |
929 | 847 |
|
930 | 848 |
|
931 |
|
|
849 |
Dim _XMLList As ListView = New ListView() |
|
932 | 850 |
|
933 | 851 |
Private Sub ThreadTask() |
934 |
If ListView_File.Items.Count > 0 Then |
|
852 |
|
|
853 |
|
|
854 |
If _XMLList.Items.Count > 0 Then |
|
935 | 855 |
|
936 | 856 |
Dim oDwg_Dt As DataTable = LoadAllDrawing() |
937 | 857 |
Dim iDwgCnt As Integer = 0 |
... | ... | |
939 | 859 |
objPIDAutoApp = CreateObject("PIDAutomation.Application") |
940 | 860 |
|
941 | 861 |
|
942 |
Dim myList = DirectCast(Invoke(New GetListViewDelegate(AddressOf GetListViewItems), ListView_File), List(Of String))
|
|
862 |
Dim myList = DirectCast(Invoke(New GetListViewDelegate(AddressOf GetListViewItems), _XMLList), List(Of String))
|
|
943 | 863 |
For i = 0 To myList.Count - 1 |
944 | 864 |
|
945 | 865 |
Dim sDwgName As String = Path.GetFileNameWithoutExtension(myList(i)) |
... | ... | |
1024 | 944 |
Me.ProgressBar_Status.Visible = True |
1025 | 945 |
ProgressBar_Status.Maximum = 100 |
1026 | 946 |
ProgressBar_Status.Value = 0 |
1027 |
_selectFolderPath = Tree_XMLFiles.SelectedNode.FullPath.Replace("\\", "\")
|
|
1028 |
_Main_trd = New Thread(AddressOf ThreadTask)
|
|
947 |
' _selectFolderPath = Tree_XMLFiles.SelectedNode.FullPath.Replace("\\", "\")
|
|
948 |
_Main_trd = New Thread(AddressOf ThreadTask) |
|
1029 | 949 |
_Main_trd.IsBackground = True |
1030 | 950 |
_Main_trd.Start() |
1031 | 951 |
|
... | ... | |
1168 | 1088 |
|
1169 | 1089 |
|
1170 | 1090 |
End Sub |
1091 |
|
|
1092 |
Private Sub ToolStripDropDownButton1_Click(sender As Object, e As EventArgs) Handles ToolStripDropDownButton1.Click |
|
1093 |
|
|
1094 |
End Sub |
|
1095 |
|
|
1096 |
Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
|
1097 |
Dim oOpen_Xml = New LoadXml() |
|
1098 |
oOpen_Xml = New LoadXml() |
|
1099 |
oOpen_Xml.ShowDialog() |
|
1100 |
_XMLList = oOpen_Xml.GetCheckList() |
|
1101 |
LoadXmlItem() |
|
1102 |
End Sub |
|
1103 |
|
|
1104 |
|
|
1105 |
Private Sub LoadXmlItem() |
|
1106 |
If Tree_Result.Nodes.Count > 0 Then |
|
1107 |
Tree_Result.Nodes(0).Nodes.Clear() |
|
1108 |
|
|
1109 |
For i = 0 To _XMLList.CheckedItems.Count - 1 |
|
1110 |
Dim sDwgName As String = Path.GetFileNameWithoutExtension(_XMLList.CheckedItems(i).Text) |
|
1111 |
Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgName, sDwgName, 15) |
|
1112 |
AddSymbolItem(oNode) |
|
1113 |
Next |
|
1114 |
Tree_Result.Nodes(0).Expand() |
|
1115 |
End If |
|
1116 |
|
|
1117 |
|
|
1118 |
|
|
1119 |
|
|
1120 |
|
|
1121 |
End Sub |
|
1122 |
|
|
1123 |
Private Sub AddSymbolItem(ByVal oNode As TreeNode) |
|
1124 |
|
|
1125 |
|
|
1126 |
|
|
1127 |
End Sub |
|
1128 |
|
|
1129 |
Private Sub Tree_Result_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterSelect |
|
1130 |
|
|
1131 |
End Sub |
|
1132 |
|
|
1133 |
Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
|
1134 |
If e.Node.Checked = True Then |
|
1135 |
For Each oNode As TreeNode In e.Node.Nodes |
|
1136 |
oNode.Checked = True |
|
1137 |
Next |
|
1138 |
Else |
|
1139 |
For Each oNode As TreeNode In e.Node.Nodes |
|
1140 |
oNode.Checked = False |
|
1141 |
Next |
|
1142 |
End If |
|
1143 |
End Sub |
|
1171 | 1144 |
End Class |
1172 | 1145 |
|
1173 | 1146 |
|
내보내기 Unified diff