-
Jun 25th, 2012, 05:52 AM
#1
Thread Starter
Member
Progress Bar and Background Worker Question
My program is finished already, and i am using it perfectly. I just want to add
progressbar so that i can see the progress running to make it more beautiful
i create an apps which is capable of installing apk file on android phones.
This is base on ADB command "adb install applcationname.apk"
we can install apk on command prompt using adb install command
The scenario of my program is like this:
all the command on cmd will appear on my form (This is all OKey)
the apk's name is on my listbox1, if I select the items on listbox1, the name of this item will be written on my txtCommandInput (my textbox)
this is my sample codes
Code:
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim _items As String = ListBox1.Text
Dim _adb As String = "Adb install"
Dim myspace As Object = Space(1)
If ListBox1.Text = ListBox1.Text Then
txtCommandInput.Text = _adb & myspace + _items
End If
End Sub
Code:
Private Sub InstallButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InstallButton.Click
StreamInput(Me.txtCommandInput.Text)
Me.txtCommandInput.Clear()
End Sub
if you press the button it will throw the command from txtCommandInput.Text and the result will displayed on cmd, so the "adb install command" will run.
all of this thing is working fine, except the progressbar
Now im reading this book about progressbar and backgroundworker sad to say i really cannot make it work, that while the installation of this apk the progressbar value is exactly 100% after the installtion finished
can anyone please enlighten me about this thing?
Just give me a hint how the progress on progressbar will be the exact value and result of this apk installation
thanks in advance
Last edited by eyestrain; Jun 25th, 2012 at 06:22 AM.
-
Jun 25th, 2012, 06:58 AM
#2
Re: Progress Bar and Background Worker Question
Are you able to measure the progress? It doesn't look like it from that code. You can't report progress that you can't measure. There's no magic in a ProgressBar. It's really just a pretty way to display a fraction. If you can't calculate the fraction though, the ProgressBar can't help you.
That said, in situations where you want to indicate to the user that something is happening without being able to tell then where it's up to, you can set the Style property to Marquee.
-
Jun 25th, 2012, 07:06 AM
#3
Thread Starter
Member
Re: Progress Bar and Background Worker Question
thats a problem, the measurement of progress...
because apk files size is different, if i will install apk with 5mb file size it will took 3-6 seconds then the "success" will appear on my cmd window on my form, if will install apk with 50mb size maybe it will took a a minute or two,
thats what i want to know,
so you think sir the other apk installer with progressbar, where they get the exact value of progress?
-
Jun 25th, 2012, 07:27 AM
#4
Re: Progress Bar and Background Worker Question
Other installers is probably doing the installation while your program, if I have understood you correctly, is nothing more than a graphical shell for a command line program. You can still do what jmcilhinney suggested and set the progressbar style property to marquee and get a nice animation while the program is working.
-
Jun 25th, 2012, 07:45 AM
#5
Thread Starter
Member
Re: Progress Bar and Background Worker Question
ok sir,
i am sure this marquee style on progressbar property can help since you both emphasize to put it that way, but the thing is, i am still zero idea where im going to link this progressbar or whats the script behind it to make it work...
im new on this thing since im not a pro coder,
im trying-hard to understand dotnet scr!pt even though this is not my line of profession...
im sorry about that sir...
I use progress bar on my splash screen and with the help of timer
Code:
if progressbar1.value = 100 then
mymainform.show
me.hide
end if
but on this part im confuse, can you give me more idea sir?
how this marquee thing will help?
Last edited by eyestrain; Jun 25th, 2012 at 07:52 AM.
-
Jun 25th, 2012, 07:55 AM
#6
Re: Progress Bar and Background Worker Question
You set the Style to Marquee when you want to display the animation and you set it back when you want to stop it. That's all there is to it.
-
Jun 25th, 2012, 07:57 AM
#7
Thread Starter
Member
Re: Progress Bar and Background Worker Question
Wow,
Okey thanks for that, i will try it tommorow,
I think thats enough for me.
thank you so much sir for the replies
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|