first commit
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
Imports System.Net
|
||||
Imports System.IO
|
||||
Imports System.ComponentModel
|
||||
Imports System.Math
|
||||
|
||||
Public Class Drive4
|
||||
Dim fermer As Integer = 0
|
||||
Dim up As Integer = 0
|
||||
Dim poucent As Integer = 0
|
||||
Private Sub Drive4_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
|
||||
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)
|
||||
Else
|
||||
|
||||
End If
|
||||
|
||||
Me.Text = Drive.OpenFileDialog1.SafeFileName
|
||||
fermer = 1
|
||||
Try
|
||||
Form1.Timer6.Stop()
|
||||
téléchargerfr = New WebClient
|
||||
If Drive.TextBox1.Text = "" Then
|
||||
téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName())
|
||||
Else
|
||||
téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & Drive.TextBox1.Text & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName())
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Timer1.Start()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub téléchargerfr_UploadFileCompleted(sender As Object, e As UploadFileCompletedEventArgs) Handles téléchargerfr.UploadFileCompleted
|
||||
Form1.Timer6.Start()
|
||||
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)
|
||||
MsgBox("Le fichier: " & Drive.OpenFileDialog1.SafeFileName & " a bien été envoyer", MsgBoxStyle.Information)
|
||||
Drive.ListBox1.Items.Clear()
|
||||
Drive.ftp()
|
||||
Close()
|
||||
End Sub
|
||||
|
||||
Private Sub téléchargerfr_UploadProgressChanged(sender As Object, e As UploadProgressChangedEventArgs) Handles téléchargerfr.UploadProgressChanged
|
||||
Dim disctédossier = func_RoundTaille(e.BytesSent)
|
||||
Dim disctédossier2 = func_RoundTaille(e.TotalBytesToSend)
|
||||
Label9.Text = disctédossier & " / " & disctédossier2
|
||||
Dim bc = e.BytesSent / e.TotalBytesToSend * 100
|
||||
GunaProgressBar1.Value = bc
|
||||
poucent = GunaProgressBar1.Value
|
||||
Me.Text = Drive.OpenFileDialog1.SafeFileName & ": " & GunaProgressBar1.Value & "%" & " " & disctédossier & " / " & disctédossier2
|
||||
Label1.Text = GunaProgressBar1.Value & "%"
|
||||
If GunaProgressBar1.Value = 10 Then
|
||||
up10()
|
||||
ElseIf GunaProgressBar1.Value = 30 Then
|
||||
up30()
|
||||
ElseIf GunaProgressBar1.Value = 50 Then
|
||||
up50()
|
||||
ElseIf GunaProgressBar1.Value = 70 Then
|
||||
up70()
|
||||
ElseIf GunaProgressBar1.Value = 90 Then
|
||||
up90()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Drive4_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 = 2
|
||||
End If
|
||||
End Sub
|
||||
Sub up50()
|
||||
If up = 2 Then
|
||||
Form1.NotifyIcon1.BalloonTipTitle = "Importation"
|
||||
Form1.NotifyIcon1.BalloonTipText = "L’importation de " & Drive.OpenFileDialog1.SafeFileName & " " & poucent & "%"
|
||||
Form1.NotifyIcon1.ShowBalloonTip(0)
|
||||
up = 3
|
||||
End If
|
||||
End Sub
|
||||
Sub up70()
|
||||
If up = 3 Then
|
||||
Form1.NotifyIcon1.BalloonTipTitle = "Importation"
|
||||
Form1.NotifyIcon1.BalloonTipText = "L’importation de " & Drive.OpenFileDialog1.SafeFileName & " " & poucent & "%"
|
||||
Form1.NotifyIcon1.ShowBalloonTip(0)
|
||||
up = 4
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub up90()
|
||||
If up = 4 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()
|
||||
Try
|
||||
téléchargerfr = New WebClient
|
||||
If Drive.TextBox1.Text = "" Then
|
||||
Form1.Timer6.Stop()
|
||||
téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName())
|
||||
Else
|
||||
Form1.Timer6.Stop()
|
||||
téléchargerfr.UploadFileTaskAsync(ipserver & "/" & "Utilisateur" & "/" & Drive.tcon & "/" & "Dirve" & Drive.TextBox1.Text & "/" & Drive.OpenFileDialog1.SafeFileName, Drive.OpenFileDialog1.FileName())
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Timer1.Start()
|
||||
End Try
|
||||
End Sub
|
||||
Public Function func_RoundTaille(ByVal LaTaille As Long) As String
|
||||
Select Case LaTaille
|
||||
Case Is < 1024
|
||||
Return Round(LaTaille) & " Octets"
|
||||
Case Is < 1048576
|
||||
Return Round(LaTaille / 2 ^ 10, 3) & " Ko"
|
||||
Case Is < 1073741824
|
||||
Return Round(LaTaille / 2 ^ 20, 3) & " Mo"
|
||||
Case Else
|
||||
Return Round(LaTaille / 2 ^ 30, 3) & " Go"
|
||||
End Select
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user