Exemplo n.º 1
0
        internal async Task CheckForUpdatesAsync(CancellationToken cancellationToken)
        {
            try
            {
                var result = await appUpdater.GetLatestVersionAsync(cancellationToken);

                if (result.HasValue && result.Value.CurrentVersion != result.Value.FutureVersion)
                {
                    logger.LogInformation($"Updater will fetch version {result.Value.FutureVersion}");
                    await appUpdater.UpdateAsync(CancellationToken.None);

                    NewVersionAvailable = true;

                    MessageBox.Show("There is a new version available. Please restart the application to update.", "Information", MessageBoxButton.OK);

                    logger.LogInformation("Update finished, restart required");
                }
                else
                {
                    logger.LogInformation("Got no response from updater or version is current");
                }
            }
            catch (Exception ex)
            {
                logger.LogWarning(ex, "Failed checking for updates");
            }
        }
Exemplo n.º 2
0
        internal async Task CheckForUpdatesAsync()
        {
            try
            {
                var result = await appUpdater.GetLatestVersionAsync(CancellationToken.None);

                if (result.HasValue && result.Value.CurrentVersion != result.Value.FutureVersion)
                {
                    logger.Info($"Updater will fetch version {result.Value.FutureVersion}");
                    await appUpdater.UpdateAsync(CancellationToken.None);

                    NewVersionAvailable = true;
                    logger.Info("Update finished, restart required");
                }
                else
                {
                    logger.Info("Got no response from updater or version is current");
                }
            }
            catch (Exception ex)
            {
                logger.Warn(ex, "Failed checking for updates");
            }
        }