تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
بوتن ايقاف BackgroundWorker
#5
هذا الكود احب ان اعمل بوتن ثاني لايقاف عمله
Private Sub backwork_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles backwork.DoWork
Try
Dim sourceLines() As String = IO.File.ReadAllLines(ALLWGS)

' header ------------------------------
Me.StatusLabel.Text = "header Traitement..."
Dim header(21 - 1) As String
Array.Copy(sourceLines, 0, header, 0, 21)
Me.StatusLabel.Text = "header completed"

' details -----------------------------
Me.StatusLabel.Text = "details Traitement..."
Dim details(sourceLines.Count - 21 - 1) As String
Array.Copy(sourceLines, 21, details, 0, sourceLines.Count - 21)

For i = 0 To details.Length - 1
details(i) = details(i).Substring(21, 4) & " - " & details(i)
Next
Array.Sort(details)
For i = 0 To details.Length - 1
details(i) = details(i).Substring(7)
Next
Me.StatusLabel.Text = "header completed"


'splitfiles ---------------------------------------------
swat_star_to_end()
Dim bloc_of_swat As New List(Of String)()
Dim files() As String = IO.File.ReadAllLines(STATISTIQUE)
For i As Integer = indax_sw_star.Text To indax_sw_end.Text
bloc_of_swat.Add(files(i))
Next
For Each f As String In bloc_of_swat
If f.Trim <> "" Then
Dim filename As String = f.Substring(0, 5)
Me.StatusLabel.Text = filename & " Traitement..."
Dim flagStart As Integer = Val(f.Substring(6, 4))
Dim flagEnd As Integer = Val(f.Substring(11, 4))
Dim flagCount As Integer = Val(f.Substring(16))
Dim range = Enumerable.Range(flagStart, flagEnd - flagStart + 1)
Dim RegexPattern As String = "^\w(\d{3})\s\s\s\s\s\s\s\s\s\s\s\s\s(\d{4})(" & String.Join("|", range) & ")\s.+"

Dim ms As MatchCollection = Regex.Matches(String.Join(vbNewLine, details), RegexPattern, RegexOptions.Multiline)
Dim resultLines = (From x As Match In ms Select x.Value).ToArray

If flagCount <> ms.Count Then
ListBox1.Items.Add(filename)
End If
Dim lines() As String = IO.File.ReadAllLines("header.HDR")
Dim resultFile As String = String.Empty
If lines.Length < 20 Then
MsgBox("header lines infirieur a 20 vrifier votre heder")
Me.StatusLabel.Text = "Erreur au niveau de header taille."
Else
For i = 0 To 19
resultFile &= lines(i) & vbNewLine
Next
resultFile &= "" & vbNewLine
resultFile &= String.Join(vbNewLine, resultLines) & vbNewLine
IO.File.WriteAllText(filename & ".wgs", resultFile)
Me.StatusLabel.Text = filename & " completed"
Me.StatusLabel.Text = "Tout les Swat calculent avec succès."
If Me.StatusLabel.Text = "Tout les Swat calculent avec succès." Then
sw_star.Visible = False
sw_end.Visible = False
End If
End If
End If
Next



Catch ex As Exception
Me.StatusLabel.Text = "Errer."
MsgBox(ex.Message)
End Try
StatusProgressBar.Visible = False

Me.Button1.Enabled = True
Me.Button2.Enabled = True
Me.TextBox1.Enabled = True
Me.TextBox2.Enabled = True
Me.TextBox3.Enabled = True
Me.TextBox4.Enabled = True
End Sub
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 21-06-17, 12:15 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة silverlight - 22-06-17, 03:51 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 22-06-17, 04:32 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة سعود - 22-06-17, 04:55 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 22-06-17, 05:39 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة سعود - 22-06-17, 05:52 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 22-06-17, 06:40 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة سعود - 22-06-17, 06:44 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة silverlight - 22-06-17, 06:59 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 22-06-17, 12:00 PM
RE: بوتن ايقاف BackgroundWorker - بواسطة silverlight - 23-06-17, 02:51 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 23-06-17, 04:04 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة silverlight - 23-06-17, 06:00 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 23-06-17, 06:23 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة silverlight - 23-06-17, 07:14 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 23-06-17, 09:17 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة WL_2000 - 23-06-17, 09:41 AM
RE: بوتن ايقاف BackgroundWorker - بواسطة rabeh.ram - 23-06-17, 11:39 AM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم