Imports System.Net Imports System.IO Imports System.ComponentModel Public Class drive6 Dim fermer As Integer = 0 Dim up As Integer = 0 Dim poucent As Integer = 0 Private Sub drive6_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim lines1a() As String = File.ReadAllLines(théme) If lines1a(0) = 2 Then Me.BackColor = Color.FromArgb(64, 64, 64) Label1.ForeColor = Color.White Label9.ForeColor = Color.White Label9.BackColor = Color.FromArgb(64, 64, 64) ElseIf lines1a(0) = 3 Then Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB) Label1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) Label9.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB) End If Me.Text = Drive.OpenFileDialog1.SafeFileName fermer = 1 If Drive.TextBox1.Text = "" Then Try Form1.Timer6.Stop() téléchargerfr = New WebClient téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName()) Catch ex As Exception Timer1.Start() End Try Else Try Form1.Timer6.Stop() téléchargerfr = New WebClient téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & Drive.TextBox1.Text & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName()) Catch ex As Exception Timer1.Start() End Try End If End Sub Private Sub téléchargerfr_UploadFileCompleted(sender As Object, e As UploadFileCompletedEventArgs) Handles téléchargerfr.UploadFileCompleted fermer = 0 GunaProgressBar1.Value = 0 Label1.Text = "0" Form1.NotifyIcon1.BalloonTipTitle = "Importation terminer" Form1.NotifyIcon1.BalloonTipText = "L’importation de " & Drive.OpenFileDialog1.SafeFileName & " est terminer" Form1.NotifyIcon1.ShowBalloonTip(0) Form1.Timer6.Start() MsgBox("Le fichier: " & Drive.OpenFileDialog1.SafeFileName & " a bien été envoyer", MsgBoxStyle.Information) Drive.ListBox1.Items.Clear() Drive.ftp() Drive.OpenFileDialog1.FileName = "" Close() End Sub Private Sub téléchargerfr_UploadProgressChanged(sender As Object, e As UploadProgressChangedEventArgs) Handles téléchargerfr.UploadProgressChanged Label9.Text = String.Format("{0} MB / {1} MB", (e.BytesSent / 1024D / 1024D).ToString("0.00"), (e.TotalBytesToSend / 1024D / 1024D).ToString("0.00")) GunaProgressBar1.Value = e.ProgressPercentage poucent = e.ProgressPercentage Me.Text = Drive.OpenFileDialog1.SafeFileName & ": " & e.ProgressPercentage & "%" & " " & String.Format("{0} MB / {1} MB", (e.BytesSent / 1024D / 1024D).ToString("0.00"), (e.TotalBytesToSend / 1024D / 1024D).ToString("0.00")) Label1.Text = e.ProgressPercentage & "%" If e.ProgressPercentage = 10 Then up10() ElseIf e.ProgressPercentage = 30 Then up30() End If End Sub Private Sub drive6_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing If fermer = 1 Then MsgBox("L’importation de " & Drive.OpenFileDialog1.SafeFileName & " est en cours merci de patienter", MsgBoxStyle.Information) e.Cancel = True End If End Sub Dim WithEvents téléchargerfr As WebClient Sub up10() If up = 0 Then Form1.NotifyIcon1.BalloonTipTitle = "Importation" Form1.NotifyIcon1.BalloonTipText = "L’importation de " & Drive.OpenFileDialog1.SafeFileName & " " & poucent & "%" Form1.NotifyIcon1.ShowBalloonTip(0) up = 1 End If End Sub Sub up30() If up = 1 Then Form1.NotifyIcon1.BalloonTipTitle = "Importation" Form1.NotifyIcon1.BalloonTipText = "L’importation de " & Drive.OpenFileDialog1.SafeFileName & " " & poucent & "%" Form1.NotifyIcon1.ShowBalloonTip(0) up = 0 End If End Sub Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Timer1.Stop() If Drive.TextBox1.Text = "" Then Try Form1.Timer6.Stop() téléchargerfr = New WebClient téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName()) Catch ex As Exception Timer1.Start() End Try Else Try Form1.Timer6.Stop() téléchargerfr = New WebClient téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & Drive.TextBox1.Text & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName()) Catch ex As Exception Timer1.Start() End Try End If End Sub End Class