1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| Imports System.Threading
Imports System.Threading.Tasks
Public Class form2
Dim Thread As System.Threading.Thread
Dim Thread2 As System.Threading.Thread
Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Thread = New System.Threading.Thread(AddressOf Fichier_Exist)
Thread2 = New System.Threading.Thread(AddressOf CISCO)
Thread.Start()
Thread2.Start()
CheckForIllegalCrossThreadCalls = False
End Sub
Private Sub Fichier_Exist()
Try
Dim path As String = ("\\Monchemin.xlsm")
If IO.File.Exists(path) Then
PictureBox3.Image = My.Resources.Vert
Label5.Visible = True
Label6.Visible = False
Else
Label6.Visible = True
Label5.Visible = False
PictureBox3.Image = My.Resources.Rouge
End If
' Invoke(New MethodInvoker(Sub() IO.File.Exists(path)))
' Invoke(New MethodInvoker(Sub() Timer5.Start()))
Invoke(New MethodInvoker(Sub() PictureBox3.Show()))
Catch ex As Exception
End Try
End Sub
Private Sub CISCO()
Try
ListBox1.Items.Clear()
Dim nics = NetworkInterface.GetAllNetworkInterfaces().Where(Function(o) o.OperationalStatus = OperationalStatus.Up)
For Each item In nics
ListBox1.Items.Add(item.Description)
Next item
Dim x As Integer = -1
x = ListBox1.FindString(TextBox1.Text)
If x > -1 Then
Label20.Text = "Cisco ON"
Else
Button5.BackgroundImage = My.Resources.carre_gris_menu
Label20.Text = "Cisco OFF"
End If
'Invoke(New MethodInvoker(Sub() Timer6.Start()))
Invoke(New MethodInvoker(Sub() ListBox1.Show()))
Catch ex As Exception
End Try
End Sub
Private Sub Timer6_Tick(sender As Object, e As EventArgs) Handles Timer6.Tick
CISCO()
End Sub
Private Sub Timer5_Tick(sender As Object, e As EventArgs) Handles Timer5.Tick
Fichier_Exist()
End Sub |
Partager