#include <Array.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>
Local $path, $aFileList, $aNewList[1][2]
$path = @ScriptDir
$aFileList = _FileListToArray($path, "*.txt")
Local $iI, $iTimer, $idListview
GUICreate("Test Management v1.0", 800, 300)
$idListview = GUICtrlCreateListView("", 15, 15, 550, 268)
$idComboBox = GUICtrlCreateCombo("", 600, 246, 90, 30)
GUISetState(@SW_SHOW)
_GUICtrlListView_AddColumn($idListview, "Tester", 100)
_GUICtrlListView_AddColumn($idListview, "Test Item", 100)
_GUICtrlListView_AddColumn($idListview, "BMC IP", 100)
_GUICtrlListView_AddColumn($idListview, "Count", 60)
_GUICtrlListView_AddColumn($idListview, "Last Record Time", 150)
If IsArray($aFileList) Then
ReDim $aNewList[UBound($aFileList)][5]
Local $sComboTxt = "所有"
For $i = 1 To UBound($aFileList) - 1 Step 1
$aNewList[$i-1][0] = $aFileList[$i]
$aNewList[$i-1][1] = FileReadLine($aFileList[$i], 1)
$aNewList[$i-1][2] = FileReadLine($aFileList[$i], 2)
$aNewList[$i-1][3] = FileReadLine($aFileList[$i], 3)
$aNewList[$i-1][4] = FileReadLine($aFileList[$i], 4)
If Not StringInStr($sComboTxt, $aNewList[$i-1][1]) Then $sComboTxt &= "|" & $aNewList[$i-1][1]
Next
GUICtrlSetData($idComboBox, $sComboTxt, "所有")
_GUICtrlListView_AddArray($idListview, $aNewList)
EndIf
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $GUI_EVENT_CLOSE
Exit
Case $idComboBox
$sComboRead = GUICtrlRead($idComboBox)
If $sComboRead == "所有" Then
_GUICtrlListView_DeleteAllItems($idListview)
_GUICtrlListView_AddArray($idListview, $aNewList)
Else
_GUICtrlListView_DeleteAllItems($idListview)
For $i = 0 To UBound($aNewList) - 1
If $aNewList[$i][1] == $sComboRead Then
GUICtrlCreateListViewItem($aNewList[$i][0] & "|" & $aNewList[$i][1] & "|" & $aNewList[$i][2] & "|" & $aNewList[$i][3] & "|" & $aNewList[$i][4], $idListview)
EndIf
Next
EndIf
EndSwitch
WEnd
|