用vb.net开发api viewer(2)

发表于:2007-06-30来源:作者:点击数: 标签:
Viewer. vb 剩余代码 Private Sub lstItem_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstItem.SelectedIndexChanged If lstItem.Items.Count 0 Then Select Case cmbOption.Text Case API.CMB_TYPES If Not
Viewer.vb剩余代码
  Private Sub lstItem_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstItem.SelectedIndexChanged
        If lstItem.Items.Count > 0 Then
            Select Case cmbOption.Text
                Case API.CMB_TYPES
                    If Not lstItem.SelectedItem Is Nothing Then
                        If optCSharp.Checked Then
                            txtOutPut.Text = Replace(API.Types.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                        Else
                            txtOutPut.Text = Replace(API.Types.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                        End If
                    End If
                Case API.CMB_CONSTANTS
                    If Not lstItem.SelectedItem Is Nothing Then
                        If optCSharp.Checked Then
                            txtOutPut.Text = Replace(API.Constants.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                        Else
                            txtOutPut.Text = Replace(API.Constants.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                        End If
                    End If
                Case API.CMB_DECLARES
                    If Not lstItem.SelectedItem Is Nothing Then
                        If optCSharp.Checked Then
                            txtOutPut.Text = Replace(API.Declares.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                        Else
                            txtOutPut.Text = Replace(API.Declares.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                        End If
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub lstItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstItem.Click
        If lstItem.Items.Count > 0 Then
            Select Case cmbOption.Text
                Case API.CMB_TYPES
                    If Not lstItem.SelectedItem Is Nothing Then
                        If optCSharp.Checked Then
                            txtOutPut.Text = Replace(API.Types.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                        Else
                            txtOutPut.Text = Replace(API.Types.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                        End If
                    End If
                Case API.CMB_CONSTANTS
                    If Not lstItem.SelectedItem Is Nothing Then
                        If optCSharp.Checked Then
                            txtOutPut.Text = Replace(API.Constants.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                        Else
                            txtOutPut.Text = Replace(API.Constants.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                        End If
                    End If
                Case API.CMB_DECLARES
                    If Not lstItem.SelectedItem Is Nothing Then
                        If optCSharp.Checked Then
                            txtOutPut.Text = Replace(API.Declares.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                        Else
                            txtOutPut.Text = Replace(API.Declares.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                        End If
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub cmbOption_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbOption.SelectedIndexChanged
        Dim T As Threading.Thread
        Dim bStart As Boolean = False
        txtOutPut.Text = ""
        Select Case cmbOption.Text
            Case API.CMB_CONSTANTS
                If Not API.Constants Is Nothing Then
                    T = New Threading.Thread(AddressOf API.FillConstants)
                    bStart = True
                End If
            Case API.CMB_DECLARES
                If Not API.Declares Is Nothing Then
                    T = New Threading.Thread(AddressOf API.FillDeclares)
                    bStart = True
                End If
            Case API.CMB_TYPES
                If Not API.Types Is Nothing Then
                    T = New Threading.Thread(AddressOf API.FillTypes)
                    bStart = True
                End If
            Case Else
        End Select
        If bStart Then T.Start()
    End Sub

    Private Sub txtSearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged
        If lstItem.Items.Count > 0 Then
            lstItem.SelectedIndex = lstItem.FindString(txtSearch.Text)
        End If
    End Sub

    Private Sub btAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btAdd.Click
        If txtAdd.Find(txtOutPut.Text) > 0 Then
            MsgBox("Data already present!", MsgBoxStyle.Information, "Add Information")
            Return
        End If
        txtAdd.Text += txtOutPut.Text & vbCrLf & vbCrLf
    End Sub

    Private Sub btClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btClear.Click
        txtAdd.Text = ""
    End Sub

    Private Sub btCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCopy.Click
        Clipboard.SetDataObject(txtAdd.Text)
    End Sub

    Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem4.Click
        Application.Exit()
    End Sub

    Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
        OpenFileDialog1.CheckFileExists = True
        OpenFileDialog1.CheckPathExists = True
        OpenFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
        OpenFileDialog1.FilterIndex = 2
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            Dim m As API.ParseAPI = New API.ParseAPI(OpenFileDialog1.FileName)
            Dim i As Integer
            Dim ThreadConst, ThreadDeclare, ThreadType As Threading.Thread
            API.Types = New API.CTypes()
            API.Constants = New API.CConst()
            API.Declares = New API.CDeclare()
            ThreadConst = New Threading.Thread(AddressOf m.GetConstInfo)
            ThreadConst.Start()
            ThreadDeclare = New Threading.Thread(AddressOf m.GetDeclareInfo)
            ThreadDeclare.Start()
            ThreadType = New Threading.Thread(AddressOf m.GetTypeInfo)
            ThreadType.Start()
            Dim c As Control
            For Each c In Me.Controls
                If Not TypeOf c Is Menu Then
                    If c.Name <> "Label5" Then
                        c.Enabled = True
                    End If
                End If
            Next
            Try
                ThreadConst.Join()
                ThreadDeclare.Join()
                ThreadType.Join()
            Catch eError As Exception
                Debug.Write(eError.StackTrace())
            End Try
        End If
    End Sub

    Private Sub optPrivate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optPrivate.CheckedChanged
        If txtOutPut.Text <> "" Then
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPUBLICCSHARP, API.APIPUBLIC), IIf(optCSharp.Checked, API.APIPRIVATECSHARP, API.APIPRIVATE))
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPUBLIC, API.APIPUBLICCSHARP), IIf(optCSharp.Checked, API.APIPRIVATECSHARP, API.APIPRIVATE))
        End If
    End Sub

    Private Sub optPrivate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optPrivate.Click
        If txtOutPut.Text <> "" Then
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPUBLICCSHARP, API.APIPUBLIC), IIf(optCSharp.Checked, API.APIPRIVATECSHARP, API.APIPRIVATE))
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPUBLIC, API.APIPUBLICCSHARP), IIf(optCSharp.Checked, API.APIPRIVATECSHARP, API.APIPRIVATE))
        End If
    End Sub

    Private Sub optPublic_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optPublic.CheckedChanged
        If txtOutPut.Text <> "" Then
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPRIVATECSHARP, API.APIPRIVATE), IIf(optCSharp.Checked, API.APIPUBLICCSHARP, API.APIPUBLIC))
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPRIVATE, API.APIPRIVATECSHARP), IIf(optCSharp.Checked, API.APIPUBLICCSHARP, API.APIPUBLIC))
        End If
    End Sub

    Private Sub optPublic_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optPublic.Click
        If txtOutPut.Text <> "" Then
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPRIVATECSHARP, API.APIPRIVATE), IIf(optCSharp.Checked, API.APIPUBLICCSHARP, API.APIPUBLIC))
            txtOutPut.Text = txtOutPut.Text.ToString.Replace(IIf(optCSharp.Checked, API.APIPRIVATE, API.APIPRIVATECSHARP), IIf(optCSharp.Checked, API.APIPUBLICCSHARP, API.APIPUBLIC))
        End If
    End Sub

    Private Sub frmViewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim c As Control
        For Each c In Me.Controls
            If Not TypeOf c Is Menu Then
                c.Enabled = False
            End If
        Next
    End Sub

    Private Sub optCSharp_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optCSharp.CheckedChanged
        If lstItem.Items.Count > 0 Then
            Select Case cmbOption.Text
                Case API.CMB_TYPES
                    If Not lstItem.SelectedItem Is Nothing Then
                        txtOutPut.Text = Replace(API.Types.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                    End If
                Case API.CMB_CONSTANTS
                    If Not lstItem.SelectedItem Is Nothing Then
                        txtOutPut.Text = Replace(API.Constants.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                    End If
                Case API.CMB_DECLARES
                    If Not lstItem.SelectedItem Is Nothing Then
                        txtOutPut.Text = Replace(API.Declares.GetDataCSharp(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLICCSHARP, API.APIPRIVATECSHARP))
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub optVB_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optVB.CheckedChanged
        If lstItem.Items.Count > 0 Then
            Select Case cmbOption.Text
                Case API.CMB_TYPES
                    If Not lstItem.SelectedItem Is Nothing Then
                        txtOutPut.Text = Replace(API.Types.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                    End If
                Case API.CMB_CONSTANTS
                    If Not lstItem.SelectedItem Is Nothing Then
                        txtOutPut.Text = Replace(API.Constants.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                    End If
                Case API.CMB_DECLARES
                    If Not lstItem.SelectedItem Is Nothing Then
                        txtOutPut.Text = Replace(API.Declares.GetData(lstItem.SelectedItem()), API.APISCOPE, IIf(optPublic.Checked, API.APIPUBLIC, API.APIPRIVATE))
                    End If
                Case Else
            End Select
        End If
    End Sub

    Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
        MsgBox("chenyangasp事例文件")
    End Sub
End Class

原文转自:http://www.ltesting.net