Exemple #1
0
 async Task Update()
 {
     if (!environmentInformation.GetIsDebugging() && environmentInformation.GetHasInternetAccess())
     {
         await updateService.UpdateAsync();
     }
 }
Exemple #2
0
        public async Task UpdateAsync()
        {
            if (!environmentInformation.GetHasInternetAccess())
            {
                return;
            }
            if (!environmentInformation.GetShouldUpdate())
            {
                return;
            }

            try
            {
                var pendingUpdateRelease = await GetAvailableUpdateAsync();

                if (pendingUpdateRelease == null)
                {
                    return;
                }

                await UpdateFromReleaseAsync(pendingUpdateRelease);
            }
            catch (RateLimitExceededException)
            {
                logger.Warning(
                    "Did not search for updates due to the GitHub rate limit being exceed.");
            }
            catch (HttpRequestException)
            {
                logger.Warning(
                    "Could not search for updates due to a connection issue.");
            }
        }
Exemple #3
0
        public async Task <bool> UpdateAsync()
        {
            if (!environmentInformation.GetHasInternetAccess())
            {
                return(false);
            }
            if (!environmentInformation.GetShouldUpdate())
            {
                return(false);
            }

            if (settingsManager.LoadSetting <bool>("NoUpdating"))
            {
                return(false);
            }

            try
            {
                var pendingUpdateRelease = await GetAvailableUpdateAsync();

                if (pendingUpdateRelease == null)
                {
                    return(false);
                }

                maintenanceWindow.Show("Updating to v" + GetReleaseVersion(pendingUpdateRelease) + "...");
                await UpdateFromReleaseAsync(pendingUpdateRelease);

                return(true);
            }
            catch (RateLimitExceededException)
            {
                logger.Information(
                    "Did not search for updates due to the GitHub rate limit being exceed.");
            }
            catch (HttpRequestException)
            {
                logger.Information(
                    "Could not search for updates due to a connection issue.");
            }

            return(false);
        }