View Full Version : ClickOnce on demand
Cienio
April 16th, 2007, 10:15 AM
Hi
I'm trying develop ma app by ClickOnce but only on user's demand
And there is a problem :
after using UpdateCheckInfo ucf = deployment.CheckForDetailedUpdate();
ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;
UpdateCheckInfo ucf = deployment.CheckForDetailedUpdate();
if (ucf.UpdateAvailable) // if (deployment.CheckForUpdate()) <- the same problem
{
if (MessageBox.Show("New version ?", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
deployment.Update();
}
else
{
}}
If I chose NO to avoid update, before the next program start I have to agree/or no to update. I mark in project property to do nto CHECK FOR UPDATES.
any ideas are welcome
cienio
kirupa
April 16th, 2007, 02:06 PM
Hi Cienio!
From what you are saying, you want to setup ClickOnce so that it doesn't check for updates on launch. But, when you manually check for updates, the next time you launch your program, you are prompted to check for updates automatically.
Did I summarize your problem? If you can provide more clarification, I can try to take a better look it.
Cheers!
Kirupa =)
Cienio
April 17th, 2007, 10:00 AM
Hi
You are right.
Some details :
the application has writen inside a date of rights to update (ex. licence allow for 12 month free update, after that you can prolonge are use last version as long you want).
The version of devolop is identity with current date
at the start application check the version of available deploy.
if is something new and the available version is up to date the rights app will do update (via API) otherwise after the check app must do nothing.
Problem :
After negative check (new available, but app not have rights (date expired)) application
at the next start offer to user do update. If user agree, application will stop because the licence version is lower then current deploy version. If user say NO this offer will not be shown again. It's not elegance this way.
Code :
// check right to run
publicstaticbool CheckRights(Version CurrentRights)
{
Version oVersion = deployment.CurrentVersion;
if (CurrentRights>=oVersion)
return true;
return false;}
// check right to update
publicstaticvoid CheckUpdate(Version CurrentRights)
{
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment;
UpdateCheckInfo ucf = deployment.CheckForDetailedUpdate();
if (ucf.UpdateAvailable)
{
Version nVersion = ucf.AvailableVersion;
if (nVersion<=CurrRights)
{
deployment.Update();
Application.Restart();}
}
}
in properties of project/publish/update I don't mark check box (The application should check...)
If something more I can write to you just say.
Thank for help
Cienio
ps.
probably you know those examples
http://download.microsoft.com/download/4/5/0/4502154c-e2ca-461e-9ab8-bf4e4cdc8cb5/ClickOnce.exe
in CustomUpdate there is that case :
try :
1. publish v.1.0.0.1
2. instal v.1.0.0.1
3. publish v.1.0.0.2
4. run v.1.0.0.1 check for available updates (don't do update)
5. close v.1.0.0.1
6. run v.1.0.0.1 - HERE YOU ARE - the app asking about update - for what !!!!
kirupa
April 24th, 2007, 02:18 PM
Cienio - I really don't know the answer for this. You may want to post here: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=6&SiteID=1, for that is where a lot of the people responsible for ClickOnce hang out.
:)
Cienio
April 26th, 2007, 08:01 AM
Thank You
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.