L
Lelekács Zoltán
Hi,
I generated the deployment files into a local directory with specified
installation URL.
My prolbems:
- If there is an internet connection on the client machine, it skips the
files on the local hard drive, immediately start downloading from the web.
- if there is no internet connection, the setup.exe fails (which is the
startup program from a CD), but the application icon installs the software
well.
I implemented a custom async update. When I call the CheckUpdateAsync method
I have got an exception in the Application.ThreadException event, not in the
AsyncCompleted event as the MSDN says (in the e.Error)...
Why?
Thanks.
lelez
------------
Here it is the code:
try
{
ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted += checkHandler;
dep.CheckForUpdateAsync();
}
catch (System.Net.WebException)
{
// never runs!
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
}
catch (Exception ex)
{
xxxx.Common.Util.Logger.LogException(ex);
}
Here it is the handler:
private static void dep_CheckCompleted(object sender,
CheckForUpdateCompletedEventArgs e)
{
if (e.Error is System.Net.WebException)
{
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
return;
}
ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted -= checkHandler;
try
{
if (e.UpdateAvailable)
{
ContinueQuestionEventArgs ce = new
ContinueQuestionEventArgs(e.AvailableVersion.ToString());
// Ask the user about continue...
if (updateIsAvailable != null)
updateIsAvailable(null, ce);
if (ce.Continue)
{
dep.UpdateCompleted += updateHandler;
dep.UpdateAsync();
}
}
}
catch(InvalidOperationException ex)
{
xxxxx.Common.Util.Logger.LogException(ex);
}
} // dep_CheckCompleted...
I generated the deployment files into a local directory with specified
installation URL.
My prolbems:
- If there is an internet connection on the client machine, it skips the
files on the local hard drive, immediately start downloading from the web.
- if there is no internet connection, the setup.exe fails (which is the
startup program from a CD), but the application icon installs the software
well.
I implemented a custom async update. When I call the CheckUpdateAsync method
I have got an exception in the Application.ThreadException event, not in the
AsyncCompleted event as the MSDN says (in the e.Error)...
Why?
Thanks.
lelez
------------
Here it is the code:
try
{
ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted += checkHandler;
dep.CheckForUpdateAsync();
}
catch (System.Net.WebException)
{
// never runs!
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
}
catch (Exception ex)
{
xxxx.Common.Util.Logger.LogException(ex);
}
Here it is the handler:
private static void dep_CheckCompleted(object sender,
CheckForUpdateCompletedEventArgs e)
{
if (e.Error is System.Net.WebException)
{
System.Windows.Forms.MessageBox.Show("There is no internet
connection.");
return;
}
ApplicationDeployment dep =
ApplicationDeployment.CurrentDeployment;
dep.CheckForUpdateCompleted -= checkHandler;
try
{
if (e.UpdateAvailable)
{
ContinueQuestionEventArgs ce = new
ContinueQuestionEventArgs(e.AvailableVersion.ToString());
// Ask the user about continue...
if (updateIsAvailable != null)
updateIsAvailable(null, ce);
if (ce.Continue)
{
dep.UpdateCompleted += updateHandler;
dep.UpdateAsync();
}
}
}
catch(InvalidOperationException ex)
{
xxxxx.Common.Util.Logger.LogException(ex);
}
} // dep_CheckCompleted...