public static bool CheckForUpdates(out AppVersionList versionList) { try { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment; UpdateCheckInfo info = deployment.CheckForDetailedUpdate(); versionList = new AppVersionList(); if (info.UpdateAvailable) { versionList.Latest = new AppVersion(null, info.AvailableVersion, null, true); versionList.Versions = new AppVersion[] { versionList.Latest }; } return(info.UpdateAvailable); } else { versionList = DownloadVersions(); if (UpdateAvailable(versionList)) { return(true); } } } catch (DeploymentDownloadException dde) { SystemSounds.Beep.Play(); Console.WriteLine("The new version of the application cannot be downloaded at this time. \n\nPlease check your network connection, or try again later. Error: " + dde.Message); versionList = null; } catch (InvalidDeploymentException ide) { SystemSounds.Beep.Play(); Console.WriteLine("Cannot check for a new version of the application. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message); versionList = null; } catch (InvalidOperationException ioe) { SystemSounds.Beep.Play(); Console.WriteLine("This application cannot be updated. It is likely not a ClickOnce application. Error: " + ioe.Message); versionList = null; } catch (Exception e) { SystemSounds.Beep.Play(); Console.WriteLine("Unable to check for update: " + e.Message); versionList = null; } return(false); }
public static bool CheckForUpdates(out AppVersionList versionList) { try { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment; UpdateCheckInfo info = deployment.CheckForDetailedUpdate(); versionList = new AppVersionList(); if (info.UpdateAvailable) { versionList.Latest = new AppVersion(null, info.AvailableVersion, null, true); versionList.Versions = new AppVersion[] { versionList.Latest }; } return info.UpdateAvailable; } else { versionList = DownloadVersions(); if (UpdateAvailable(versionList)) { return true; } } } catch (DeploymentDownloadException dde) { SystemSounds.Beep.Play(); Console.WriteLine("The new version of the application cannot be downloaded at this time. \n\nPlease check your network connection, or try again later. Error: " + dde.Message); versionList = null; } catch (InvalidDeploymentException ide) { SystemSounds.Beep.Play(); Console.WriteLine("Cannot check for a new version of the application. The ClickOnce deployment is corrupt. Please redeploy the application and try again. Error: " + ide.Message); versionList = null; } catch (InvalidOperationException ioe) { SystemSounds.Beep.Play(); Console.WriteLine("This application cannot be updated. It is likely not a ClickOnce application. Error: " + ioe.Message); versionList = null; } catch (Exception e) { SystemSounds.Beep.Play(); Console.WriteLine("Unable to check for update: " + e.Message); versionList = null; } return false; }
public static bool PromptUpgrade(out AppVersionList versionList) { try { versionList = DownloadVersions(); return(true); } catch (Exception e) { SystemSounds.Beep.Play(); Console.WriteLine("Unable to check for update: " + e.Message); versionList = null; } return(false); }
private static bool UpdateAvailable(AppVersionList list) { AppVersion currentVersion = GetCurrentVersion(); if (list != null && list.Latest != null) { if (currentVersion.GetVersion() < list.Latest.GetVersion()) { return(true); } else { return(false); } } else { return(false); } }
private static bool UpdateAvailable(AppVersionList list) { AppVersion currentVersion = GetCurrentVersion(); if (list != null && list.Latest != null) { if (currentVersion.GetVersion() < list.Latest.GetVersion()) { return true; } else { return false; } } else { return false; } }
public static bool PromptUpgrade(out AppVersionList versionList) { try { versionList = DownloadVersions(); return true; } catch (Exception e) { SystemSounds.Beep.Play(); Console.WriteLine("Unable to check for update: " + e.Message); versionList = null; } return false; }