'Dobrý den, aplikácia ktorú sa snažim vytvoriť ma za úlohu zistiť či je PC pripojené k sieti a parametre siete,aký User je prihlásený,v určitý deň upozorníť usera o tom že sa vykonávajú zálohy (NotifyIcon1.ShowBalloonTip).To všetko mi už funguje,ale neviem si rady ako urobiť aby tá aplikácia kontrolovala určenú zložku,či už v nej existuje súbor zo zálohou a ak áno aby ten súbor presunula do zdieľanej zložky na server. Tu je zdroják:'
Imports System.IO
Public Class Form1
Dim strHostName As String = System.Net.Dns.GetHostName()
Dim strHostName1 As String = System.Net.Dns.GetHostName()
Dim strIPAddress As String = System.Net.Dns.GetHostByName(strHostName).AddressList(0).ToString()
Dim strIPAddress1 As String = System.Net.Dns.GetHostByName(strHostName1).HostName.ToString()
Dim abc As String = "192.168.0.151"
Dim strMessage As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'vypis IP a domeny do textboxu
Label1.Text = strIPAddress
Label2.Text = strIPAddress1
'vypis domeny a prihlaseneho uzivatela
Label3.Text = My.User.Name
'Label4.Text = (strMessage)
Label4.Text = Date.Today.Year
'vypis dna v tyzdni
Select Case Now.DayOfWeek
Case DayOfWeek.Monday
strMessage = "Pondělí"
Case DayOfWeek.Tuesday
strMessage = "Úterý"
Case DayOfWeek.Wednesday
strMessage = "Středa"
Case DayOfWeek.Thursday
strMessage = "Čtvrtek"
Case DayOfWeek.Friday
strMessage = "Pátek"
Case DayOfWeek.Saturday
strMessage = "Sobota"
Case DayOfWeek.Sunday
strMessage = "Neděle"
Case Else
strMessage = "Neznámy den"
End Select
Label4.Text = strMessage
If strMessage = ("Úterý") Then Timer1.Enabled = True
End Sub
'minimalizovanie do tray
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.Hide()
End If
End Sub
'obnovenie okna z tray
Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
If Me.WindowState = FormWindowState.Minimized Then
Me.Show()
Me.WindowState = FormWindowState.Normal
End If
End Sub
'vypis bubliny o zalohovani
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
NotifyIcon1.ShowBalloonTip(5)
End Sub
End Class
'Stav pripojenia k sieti riešim ApplicationEvents'
Namespace My
Class MyApplication
Private Sub MyApplication_NetworkAvailabilityChanged(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.Devices.NetworkAvailableEventArgs) Handles Me.NetworkAvailabilityChanged
SetConnectionStatus(e.IsNetworkAvailable)
End Sub
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
SetConnectionStatus(My.Computer.Network.IsAvailable)
End Sub
Public Sub SetConnectionStatus(ByVal connected As Boolean)
With My.Forms.Form1.ConnectionStatus
If (connected) Then
.Image = My.Resources.connected.ToBitmap
.Text = "Připojený"
Else
.Image = My.Resources.disconnected.ToBitmap
.Text = "Odpojený"
End If
End With
End Sub
End Class
End Namespace
'Za každú radu budem veľmi vďačný. Ďakujem'
|