以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  执行在线升级时,显示图片文件正在使用  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=169430)

--  作者:newsun2k
--  发布时间:2021/6/16 13:57:00
--  执行在线升级时,显示图片文件正在使用
如题,怎么处理?
--  作者:有点蓝
--  发布时间:2021/6/16 14:04:00
--  
升级代码放在什么事件的?

有没有在发布窗口附件添加Splash.jpg文件,如果有,去掉

--  作者:newsun2k
--  发布时间:2021/6/16 14:08:00
--  
弹出升级窗口,然后点按钮升级的。没有在附件中加SPLASH
--  作者:有点蓝
--  发布时间:2021/6/16 14:13:00
--  
升级窗口有没有使用到图片?打开升级窗口前有没有打开其它使用了图片的窗口?
--  作者:newsun2k
--  发布时间:2021/6/16 14:25:00
--  
升级窗口没有使用到图片。跟这个有关,升级前如果保存数据,我会弹出下面这个窗口显示动画,然后关闭。
再点升级,就会说那个动画的图片正在使用。

--  作者:有点蓝
--  发布时间:2021/6/16 14:36:00
--  
这玩意是异步线程,试试下面代码

    Private Sub timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
        If asyncResult.IsCompleted Then
Me.pictureBox1.Image = nothing
Me.pictureBox1.Dispose
Me.pictureBox1 = nothing
            Me.Close()
        End If
    End Sub

如果不行,建议到afteropenproject事件做升级吧

--  作者:newsun2k
--  发布时间:2021/6/16 15:00:00
--  
强烈建议把上面那个功能集成进去
--  作者:newsun2k
--  发布时间:2021/6/16 15:43:00
--  
Dim waitingBox As New FrmWaitingBox(Sub(obj, args)
    \'耗时操作开始
    For i As Integer = 0 To 5
        System.Threading.Thread.Sleep(1000)
        Output.Show(i)
    Next
    \'耗时操作结束
    End Sub,"正在处理数据,请等待...")
waitingBox.ShowDialog()

刚才研究了一下才发现,他整个都改了。
现在调用要用上面的方式。
有点不太好改。
之前用的是以下调用方式:     
打开等待窗口
执行长时间操作      ‘此处代码比较多,而且中间还有提示框,返回值
关闭等待窗口。
求个思路,能改成这样调用不?






--  作者:有点蓝
--  发布时间:2021/6/16 15:52:00
--  
没看懂,什么东西整个都改了?这样调用是哪样?
--  作者:newsun2k
--  发布时间:2021/6/16 15:56:00
--  
之前他是这么来实现的。
我可以调用WaitShow,打开动画窗口,调用WaitClose来关闭动画窗口
这中间,就可以加自己的代码了

Public Sub WaitShow()
Try
    processForm = New System.Windows.Forms.Form
    Dim wfpic As New System.Windows.Forms.PictureBox()
    Dim strImageFile As String

    wfpic.Image = System.Drawing.Image.FromFile(strImageFile)
    wfpic.Dock = System.Windows.Forms.DockStyle.Fill
    wfpic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
    processForm.Controls.Add(wfpic)
    processForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
    processForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
    processForm.TransparencyKey = Color.white
    processForm.backcolor = Color.white
    processForm.OPacity = 1
    processForm.ShowInTaskBar = False
    If Vars("gdSaveFormRate") = 0 Then Vars("gdSaveFormRate") = 4
    wfpic.Width = 1280/Vars("gdSaveFormRate")  \'固定大小
    wfpic.Height = 720/Vars("gdSaveFormRate")
    
    processForm.TopMost = True
    Dim upgradeThread As System.Threading.Thread = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf ShowWaitMess))
    upgradeThread.Start()
Catch ex As Exception
End Try
End Sub

Public Sub WaitClose()
If processForm.InvokeRequired Then
    processForm.Invoke(New Action(AddressOf DoCloseJob))
Else
    DoCloseJob()
End If
End Sub