-
Dec 12th, 2014, 07:14 PM
#1
Thread Starter
New Member
Questions on when program launches, update available & downloading
1.) When the program has an update, I would like it to do something along the lines of popping up a msgbox and it saying "A new Update is available, please click OK to download"
2.) When that msgbox or whatever pops up, I would like a custom downloader to pop up and direct it to a folder (C:\Program Files\Folder_Name) that does delete the old version before installing the new one.
Would anyone have the ideas on how this works? I have been looking up youtube videos for hours, not a single one of them worked properly without errors. I also did make sure I had all of their progress bars, textboxes, buttons ect. labeled correctly.
If you know of a good way and would like to list it down below (Code inserted preferred) I would be highly greatful of your help.
Thank you for the ones who reply, I hope you all have a great day.
-Pandaz
-
Dec 13th, 2014, 12:32 PM
#2
Re: Questions on when program launches, update available & downloading
Hello and welcome to the forum. I am sure you would prefer code but this is not how this site works. You show us what you have tried and we build on that. We do not write your applications. Lets see what you have tried.
Break your project into steps. Step One how are you going to check a update is ready?
-
Dec 13th, 2014, 01:03 PM
#3
Re: Questions on when program launches, update available & downloading
I agree with Ident. But OP I doubt you googled this cause I just did and found tons of result. It's pretty straight forward. It's better if you learn yourself than have us spoon feed you. But I'll point you into the right direct.
When you load your application, you would want to check the ProductVersion of your application to one which is hosted on a webserver.
E.g. you program's ProductVersion is 1.0.0.0 and the one hosted on the webserver is 1.0.0.1
You compare the two, if they're different then you assume there is an update available. Then using the webclient class, you should then download the file. Use an SaveFileDialog too.
-
Dec 14th, 2014, 12:18 AM
#4
Re: Questions on when program launches, update available & downloading
You can also look into ClickOnce ... All you'd have to do is set it up, no coding needed.
-tg
-
Dec 14th, 2014, 01:48 AM
#5
Thread Starter
New Member
Re: Questions on when program launches, update available & downloading
Well, you wouldn't be 'spoonfeeding' me. But I do have a question, I would like a 'startup' function, that it does the function on startup. Because I do have it where you can go to 'File>Check For updates' and it will say if you are up to date or not.
My main question was, when the program starts, when a new update is available, for it to tell you and give you the option to update.
I appreciate your replies, but finding that certain function was something I was not able to find. If you have found that in some sort of video, I would be greatful if you may share it.
-
Dec 14th, 2014, 02:22 AM
#6
Re: Questions on when program launches, update available & downloading
A simple version of this shouldn't be too hard to implement. I would try creating a Class for your project containing a Sub Main(). In this sub, you should run any pre-launch code that you need to check versions. You could even show a splash while its doing its work. At this point your application is almost like a classic console app going line by line, just... no console.
Next you can use the information gathered in that code to either launch a form specific to updating, or launch the main program. Form.Show() should work.
There is still a lot of leg-work to get this going, so I wouldn't consider this being spoon fed. This just gives you an idea of the logic behind the flow of events. Most programs don't just launch a window when you start them anymore. Using a Main sub as the startup object gives you more control over how and what your program does right at the beginning.
Disclaimer: I haven't done this in any of my projects, I generally just launch a specific form, and I may be wrong on how the Sub Main implementation works. I've seen a few code snippets that use it, and I assume it would work well in your situation. I trust that some more seasoned developers will correct me if I'm wrong.
-
Dec 14th, 2014, 09:46 AM
#7
Re: Questions on when program launches, update available & downloading
You'll need a bootstrapper program. Its job will be to check "something" (web site, web service ,what ever) and compare the version to somehting on the client side... if they match it then launches the application proper. If it doesn't, then it asks the user to upgrade. If they don't want to, it simply starts the app. If the user does want the upgrade, then it downloads the files, copies them, and when it's done, starts the app.
-tg
-
Dec 14th, 2014, 10:53 AM
#8
Re: Questions on when program launches, update available & downloading
OP here's what I've just coded for you. It works great infact. Only way for improvement in my opinion is to use the async methods so your UI form doesn't become unresponse whilst downloading the string and data. Apart from that this would work a treat. Just make sure on each release of your program to change the Application.ProductVersion. Increment it by one.
http://pastebin.com/zakLv4Ze
-
Dec 14th, 2014, 11:44 AM
#9
Thread Starter
New Member
Re: Questions on when program launches, update available & downloading
Thank you three for the replies! I appreciate them all.
Troh's code worked flawlessly, I'm going to save it down and try to break it down to learn it myself! Thank you very much for taking your time to write that. Worked how I wanted it to.
I appreciate everyone's reply, on this forum. +1 to you all.
| Thread Resolved |
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
|