Files

71 lines
2.4 KiB
VB.net
Raw Permalink Normal View History

2026-08-27 11:22:34 -06:00
Imports System.Threading
Public Class TcpConnectionForm
Public C As Client
Private Sub TcpConnectionForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Refresh()
End Sub
Public Sub Refresh()
ListView1.Items.Clear()
ToolStripStatusLabel2.Text = "Wait.."
Dim B As Byte() = SB("GetTCPConnection")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
If Not C.IsConnected Then
Close()
End If
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
Private Sub TcpConnectionForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim B As Byte() = SB("CloseTCPConnections")
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
Try
ToolStripStatusLabel1.Text = "Selected [" & ListView1.SelectedItems.Count.ToString & "]"
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
Private Sub ListView1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListView1.KeyDown
Try
If e.Modifiers = Keys.Control AndAlso e.KeyCode = Keys.A Then
If ListView1.Items.Count > 0 Then
For Each x As ListViewItem In ListView1.Items
x.Selected = True
Next
End If
End If
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End Sub
Private Sub ToolStripMenuItem4_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem4.Click
Refresh()
End Sub
Private Sub ToolStripMenuItem6_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem6.Click
Dim ID As String
ID = Nothing
For Each LV As ListViewItem In ListView1.SelectedItems
ID &= "-=>" & LV.SubItems(0).Text
Next
Dim B As Byte() = SB("KillTCPConnection" & SettingsHelper.SPL & ID)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
End Sub
End Class