Skip to content
This repository was archived by the owner on Dec 31, 2022. It is now read-only.

example for push/pull progression #171

Open
dafaithz81 opened this issue May 26, 2020 · 1 comment
Open

example for push/pull progression #171

dafaithz81 opened this issue May 26, 2020 · 1 comment

Comments

@dafaithz81
Copy link

hi,
could anyone help me to understand how the progress works ?
the pull/push methods can receive a IProgress object.
this object has a report function, but it wants an integer parameter.
i want something like this:
`Dim tProgress As IProgress(Of Integer) = Nothing
Dim tActProgress As Integer = 0

                Using tService As SyncService = New SyncService(New AdbSocket(New IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort)), tWorkerArgs.QuestDevice)
                    Using tStream As Stream = File.OpenWrite(tAPKDestFullPath)
                        tService.Pull(tAPKSourceFullPath, tStream, tProgress, CancellationToken.None)
                        While tActProgress < 100
                            tProgress.Report(tActProgress)

                            SimpleWait(1)
                        End While
                    End Using
                End Using`

would be nice if anyone could help me

@adryzz
Copy link

adryzz commented Nov 21, 2020

I don't know much the VB.NET syntax so you gotta convert a bit from C# here but basically you create and initialize an IProgress<T> object, with T as the type of progress (in this case, int - Integer in VB.NET-) and assign a method to the EventHandler.
Then, when you call a method and you give it the IProgress<int>, every time the progress changes, the method you assigned will be called with the progress as a parameter.
Hope this helps!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants