fix 2nd item

fix for add the second item as double entry if the first one was canceled
This commit is contained in:
hama3254 2019-11-22 18:36:51 +01:00
parent 76361b266b
commit 38e0180dc3
10 changed files with 63 additions and 44 deletions

Binary file not shown.

View File

@ -205,49 +205,62 @@ Public Class Main
End Sub End Sub
Public Sub ListAdd(ByVal NameKomplett As String, ByVal NameP1 As String, ByVal NameP2 As String, ByVal Reso As String, ByVal HardSub As String, ByVal SoftSubs As String, ByVal ThumbnialURL As String, ByVal VideoURL As String) Public Sub ListAdd(ByVal NameKomplett As String, ByVal NameP1 As String, ByVal NameP2 As String, ByVal Reso As String, ByVal HardSub As String, ByVal SoftSubs As String, ByVal ThumbnialURL As String, ByVal VideoURL As String)
Dim b As New Bitmap(838, 142, System.Drawing.Imaging.PixelFormat.Format24bppRgb) Dim ReDl As Boolean = False
Dim g As Graphics = Graphics.FromImage(b) Dim index As Integer = 0
Dim ZeroPoint As Point = New Point(0, 0) For i As Integer = 0 To PB_list.Count - 1
Dim TextPoint As Point = New Point(195, 15) If PB_list.Item(i).Name = NameKomplett Then
Dim TextPointL2 As Point = New Point(195, 42) ReDl = True
Dim TextPointL3 As Point = New Point(773, 95) index = i
Dim TextPointL4 As Point = New Point(195, 101) End If
Dim TextPointL4A2 As Point = New Point(300, 101) Next
Dim ThumbnialPoint As Point = New Point(11, 20) If ReDl = True Then
Dim ProgressbarPoint As Point = New Point(195, 70) Dim PB As PictureBox = bt_dl.Item(index)
Dim newImage As Image = My.Resources.backgroud PB.Enabled = True
Dim img As Image = My.Resources.main_del Else
Try Dim b As New Bitmap(838, 142, System.Drawing.Imaging.PixelFormat.Format24bppRgb)
Dim wc As New WebClient() Dim g As Graphics = Graphics.FromImage(b)
Dim bytes As Byte() = wc.DownloadData(ThumbnialURL) Dim ZeroPoint As Point = New Point(0, 0)
Dim ms As New MemoryStream(bytes) Dim TextPoint As Point = New Point(195, 15)
img = System.Drawing.Image.FromStream(ms) Dim TextPointL2 As Point = New Point(195, 42)
Catch ex As Exception Dim TextPointL3 As Point = New Point(773, 95)
MsgBox(ex.ToString) Dim TextPointL4 As Point = New Point(195, 101)
MsgBox(ThumbnialURL) Dim TextPointL4A2 As Point = New Point(300, 101)
End Try Dim ThumbnialPoint As Point = New Point(11, 20)
g.DrawImage(newImage, ZeroPoint) Dim ProgressbarPoint As Point = New Point(195, 70)
Dim Thumnail As New Bitmap(168, 95, System.Drawing.Imaging.PixelFormat.Format24bppRgb) Dim newImage As Image = My.Resources.backgroud
Dim gr_dest As Graphics = Graphics.FromImage(Thumnail) Dim img As Image = My.Resources.main_del
gr_dest.DrawImage(img, 0, 0, Try
Thumnail.Width + 1, Dim wc As New WebClient()
Thumnail.Height + 1) Dim bytes As Byte() = wc.DownloadData(ThumbnialURL)
g.DrawImage(Thumnail, ThumbnialPoint) Dim ms As New MemoryStream(bytes)
g.DrawString(NameP1, FontLabel.Font, Brushes.Black, TextPoint) img = System.Drawing.Image.FromStream(ms)
g.DrawString(NameP2, FontLabel.Font, Brushes.Black, TextPointL2) Catch ex As Exception
g.DrawRectangle(Pens.Black, ProgressbarPoint.X, ProgressbarPoint.Y, 601, 20) MsgBox(ex.ToString)
Dim brGradient As Brush = New SolidBrush(Color.FromArgb(247, 140, 37)) MsgBox(ThumbnialURL)
g.FillRectangle(brGradient, ProgressbarPoint.X + 1, ProgressbarPoint.Y + 1, 0, 19) End Try
g.DrawString("0%", FontLabel2.Font, Brushes.Black, TextPointL3) g.DrawImage(newImage, ZeroPoint)
g.DrawString(Reso, FontLabel.Font, Brushes.Black, TextPointL4) Dim Thumnail As New Bitmap(168, 95, System.Drawing.Imaging.PixelFormat.Format24bppRgb)
g.DrawString(HardSub, FontLabel.Font, Brushes.Black, TextPointL4A2) Dim gr_dest As Graphics = Graphics.FromImage(Thumnail)
g.Dispose() gr_dest.DrawImage(img, 0, 0,
gIndexH = gIndexH + 1 Thumnail.Width + 1,
Thumnail.Height + 1)
g.DrawImage(Thumnail, ThumbnialPoint)
g.DrawString(NameP1, FontLabel.Font, Brushes.Black, TextPoint)
g.DrawString(NameP2, FontLabel.Font, Brushes.Black, TextPointL2)
g.DrawRectangle(Pens.Black, ProgressbarPoint.X, ProgressbarPoint.Y, 601, 20)
Dim brGradient As Brush = New SolidBrush(Color.FromArgb(247, 140, 37))
g.FillRectangle(brGradient, ProgressbarPoint.X + 1, ProgressbarPoint.Y + 1, 0, 19)
g.DrawString("0%", FontLabel2.Font, Brushes.Black, TextPointL3)
g.DrawString(Reso, FontLabel.Font, Brushes.Black, TextPointL4)
g.DrawString(HardSub, FontLabel.Font, Brushes.Black, TextPointL4A2)
g.Dispose()
gIndexH = gIndexH + 1
With ListView1.Items.Add(0) With ListView1.Items.Add(0)
LVPictureBox(ListView1, gIndexH, b, "Softsubs: " + SoftSubs, NameKomplett) LVPictureBox(ListView1, gIndexH, b, "Softsubs: " + SoftSubs, NameKomplett)
bt_del(ListView1, gIndexH, NameKomplett) bt_del(ListView1, gIndexH, NameKomplett)
End With End With
End If
End Sub End Sub
Public Function bt_del(ByVal pListView As ListView, ByVal ItemIndex As Integer, ByVal NameKomplett As String) As PictureBox Public Function bt_del(ByVal pListView As ListView, ByVal ItemIndex As Integer, ByVal NameKomplett As String) As PictureBox
@ -673,7 +686,7 @@ Public Class Main
CR_Anime_Folge = CR_Name_Staffel0_Folge1(1).Trim() CR_Anime_Folge = CR_Name_Staffel0_Folge1(1).Trim()
CR_Anime_Folge = System.Text.RegularExpressions.Regex.Replace(CR_Anime_Folge, "[^\w\\-]", " ") CR_Anime_Folge = System.Text.RegularExpressions.Regex.Replace(CR_Anime_Folge, "[^\w\\-]", " ")
Else Else
CR_Anime_Staffel = "" CR_Anime_Staffel = Nothing
CR_Anime_Folge = CR_Name_2(0).Trim() CR_Anime_Folge = CR_Name_2(0).Trim()
CR_Anime_Folge = System.Text.RegularExpressions.Regex.Replace(CR_Anime_Folge, "[^\w\\-]", " ") CR_Anime_Folge = System.Text.RegularExpressions.Regex.Replace(CR_Anime_Folge, "[^\w\\-]", " ")
End If End If
@ -941,8 +954,13 @@ Public Class Main
ResoHTMLDisplay = ResoHTML(0) + "p" ResoHTMLDisplay = ResoHTML(0) + "p"
End If End If
End If End If
Dim L2Name As String = CR_Anime_Staffel + " " + CR_Anime_Folge
If CR_Anime_Staffel = Nothing Then
L2Name = CR_Anime_Folge
End If
Me.Invoke(New Action(Function() Me.Invoke(New Action(Function()
ListAdd(CR_FilenName, CR_Anime_Titel, CR_Anime_Staffel + " " + CR_Anime_Folge, ResoHTMLDisplay, Subsprache3, SubValuesToDisplay(), thumbnail3, URL_DL) ListAdd(CR_FilenName, CR_Anime_Titel, L2Name, ResoHTMLDisplay, Subsprache3, SubValuesToDisplay(), thumbnail3, URL_DL)
Return Nothing Return Nothing
End Function)) End Function))
' liList.Add(My.Resources.htmlvorThumbnail + thumbnail3 + My.Resources.htmlnachTumbnail + CR_Anime_Titel + " <br> " + CR_Anime_Staffel + " " + CR_Anime_Folge + My.Resources.htmlvorAufloesung + ResoHTMLDisplay + My.Resources.htmlvorSoftSubs + vbNewLine + SubValuesToDisplay() + My.Resources.htmlvorHardSubs + Subsprache3 + My.Resources.htmlnachHardSubs + "<!-- " + CR_FilenName + "-->") ' liList.Add(My.Resources.htmlvorThumbnail + thumbnail3 + My.Resources.htmlnachTumbnail + CR_Anime_Titel + " <br> " + CR_Anime_Staffel + " " + CR_Anime_Folge + My.Resources.htmlvorAufloesung + ResoHTMLDisplay + My.Resources.htmlvorSoftSubs + vbNewLine + SubValuesToDisplay() + My.Resources.htmlvorHardSubs + Subsprache3 + My.Resources.htmlnachHardSubs + "<!-- " + CR_FilenName + "-->")
@ -1126,6 +1144,7 @@ Public Class Main
Dim brGradient As Brush = New SolidBrush(Color.FromArgb(125, 0, 0)) Dim brGradient As Brush = New SolidBrush(Color.FromArgb(125, 0, 0))
g.FillRectangle(brGradient, ProgressbarPoint.X + 1, ProgressbarPoint.Y + 1, 600, 19) g.FillRectangle(brGradient, ProgressbarPoint.X + 1, ProgressbarPoint.Y + 1, 600, 19)
g.Dispose() g.Dispose()
AbourtList.Remove(sender)
Else Else
Dim p As PictureBox = PB_list(i) Dim p As PictureBox = PB_list(i)
Dim c As Integer = CInt(ListView1.Items.Item(i).Text) Dim c As Integer = CInt(ListView1.Items.Item(i).Text)