Jump to content

Background Worker


Recommended Posts

Boas! Estou com algumas dificuldades a meter o meu background worker a sincronizar com a progressbar alguma ideia? o codigo que tenho e este

Este apenas para iniciar o background worker

 bgWorker.WorkerReportsProgress = True
                bgWorker.WorkerSupportsCancellation = False
                bgProgress.Visible = True

E estes são os outros codigos... do background worker

Private Sub bgWorker_ProgressChanged(ByVal sender As System.Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles bgWorker.ProgressChanged
        bgProgress.Value = e.ProgressPercentage
    End Sub

    Private Sub bgWorker_RunWorkerCompleted(ByVal sender As System.Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles bgWorker.RunWorkerCompleted
        bgProgress.Visible = False
            Process.Start(Application.StartupPath & "\TeknoGods_MW2SP.exe")
        Catch ex As Exception
            MessageBox.Show("ERROR: TeknoGods_MW2SP.exe not found! Make sure that the app is in the game dir!", "ERROR: TeknoGods_MW2SP.exe not found", MessageBoxButtons.OK, MessageBoxIcon.Stop)
        End Try
    End Sub

    Private Sub bgWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles bgWorker.DoWork
        Dim worker As BackgroundWorker = _
        CType(sender, BackgroundWorker)
        File.WriteAllBytes(Application.StartupPath & "\TeknoGods_MW2SP.exe", My.Resources.TeknoGods_MW2SP)
        File.WriteAllBytes(Application.StartupPath & "\TeknoMW2.dll", My.Resources.TeknoMW2)
    End Sub

Mas ele não sincroniza com a progress bar... alguma ideia?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.