0

我正在尝试从列表视图执行多个进程,尽管我需要它们之间的延迟。

我的vb.net知识有限,

 For Each ListView1 As ListViewItem In Me.ListView1.Items

                If ListView1.Checked = True Then
                    Dim targetName As String = ListView1.SubItems(5).Text.ToString
                    Dim fileExists As Boolean

                    fileExists = My.Computer.FileSystem.FileExists(targetName)
                    If fileExists = True Then
                        Dim p As System.Diagnostics.Process
                        p = New System.Diagnostics.Process()
                        p.StartInfo.WorkingDirectory = "c:\"
                        p.StartInfo.FileName = URLDecode(targetName)
                        p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
                        p.Start()
                        p.Close()
                    Else

这将在大多数情况下正常执行进程,这实际上是一个 mp3 文件,并将其添加到 winamps 播放列表中。有时它启动得太快,导致winamp在处理mp3时崩溃,我怎样才能在不锁定ui的情况下延迟执行每个进程?此外,任何关于我如何改进整体代码并使其更稳定的建议都将不胜感激。谢谢

4

1 回答 1

1
Imports System.Threading

Thread.Sleep(5000)

Thread.Sleep()需要等待数毫秒,因此上述将等待 5 秒。

于 2013-01-20T17:35:30.510 回答