• vb 纵一苇之所如


      Public Sub DeownloadFile(ByVal networkfile As String, ByVal locationFileName As String, ByVal PaperDownloadLog As String, ByVal strReferer As String)
            For index = 1 To 3 '如获取不了重试3次
                Dim task As NewTaskDelegate = AddressOf TrytoDownloadFile
                Dim asyncResult As IAsyncResult = task.BeginInvoke(networkfile, locationFileName, PaperDownloadLog, strReferer, Nothing, Nothing)
                Dim marktime As Integer = 0
                While Not asyncResult.IsCompleted And marktime < 30 '五分钟内未完成就跳过
                    marktime += 1
                    'MessageBox.Show("还没完成?那我先sleep" & marktime)
                    Threading.Thread.Sleep(1000)
                End While
                Dim result As Integer = task.EndInvoke(asyncResult)
                If result > 0 Then Exit For


            Next

            'Dim result As Integer = task.EndInvoke(asyncResult)
            'MessageBox.Show(result.ToString())
        End Sub


        Private Delegate Function NewTaskDelegate(ByVal networkfile, ByVal locationFileName, ByVal PaperDownloadLog, ByVal strReferer) As Integer
        Public Function TrytoDownloadFile(ByVal networkfile As String, ByVal locationFileName As String, ByVal PaperDownloadLog As String, ByVal strReferer As String)
          

      Public Sub DeownloadFile(ByVal networkfile As String, ByVal locationFileName As String, ByVal PaperDownloadLog As String, ByVal strReferer As String)
            For index = 1 To 3 '如获取不了重试3次
                Dim task As NewTaskDelegate = AddressOf TrytoDownloadFile
                Dim asyncResult As IAsyncResult = task.BeginInvoke(networkfile, locationFileName, PaperDownloadLog, strReferer, Nothing, Nothing)
                Dim marktime As Integer = 0
                While Not asyncResult.IsCompleted And marktime < 30 '五分钟内未完成就跳过
                    marktime += 1
                    'MessageBox.Show("还没完成?那我先sleep" & marktime)
                    Threading.Thread.Sleep(1000)
                End While
                Dim result As Integer = task.EndInvoke(asyncResult)
                If result > 0 Then Exit For
    
    
            Next
    
            'Dim result As Integer = task.EndInvoke(asyncResult)
            'MessageBox.Show(result.ToString())
        End Sub
    
    
        Private Delegate Function NewTaskDelegate(ByVal networkfile, ByVal locationFileName, ByVal PaperDownloadLog, ByVal strReferer) As Integer
        Public Function TrytoDownloadFile(ByVal networkfile As String, ByVal locationFileName As String, ByVal PaperDownloadLog As String, ByVal strReferer As String)
           
    
  • 相关阅读:
    zoj 1002 Fire Net 碉堡的最大数量【DFS】
    hdu 2553 n皇后问题【DFS递归解法】
    UVa11988 Broken Keyboard 损坏的键盘【list】
    hdu 1263 水果 【二维map】
    UVa-156 Ananagrams 反片语【map】【vector】
    hdu 2364 Escape【模拟优先队列】【bfs】
    UVA136 Ugly Numbers【set】【优先队列】
    hdu1429 胜利大逃亡(续) 【BFS】+【状态压缩】
    广搜bfs
    DP:Corn Fields(POJ 3254)
  • 原文地址:https://www.cnblogs.com/panjinzhao/p/3127095.html
Copyright © 2020-2023  润新知