Microsoft.HockeyApp.UpdateManager.UpdateVersionIfAvailable C# (CSharp) Method

UpdateVersionIfAvailable() private method

private UpdateVersionIfAvailable ( UpdateCheckSettings updateCheckSettings ) : System.Threading.Tasks.Task
updateCheckSettings UpdateCheckSettings
return System.Threading.Tasks.Task
        internal async Task UpdateVersionIfAvailable(UpdateCheckSettings updateCheckSettings)
        {
            if (CheckWithUpdateFrequency(updateCheckSettings.UpdateCheckFrequency) && NetworkInterface.GetIsNetworkAvailable())
            {
                Exception thrownException = null;
                try
                {
                    var currentVersion = new Version(HockeyClient.Current.AsInternal().VersionInfo);
                    var appVersions = await HockeyClient.Current.AsInternal().GetAppVersionsAsync();
                    var newestAvailableAppVersion = appVersions.FirstOrDefault();
                    
                    if (appVersions.Any()
                        && new Version(newestAvailableAppVersion.Version) > currentVersion
                        && (updateCheckSettings.CustomDoShowUpdateFunc == null || updateCheckSettings.CustomDoShowUpdateFunc(newestAvailableAppVersion)))
                    {
                        if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp) || (updateCheckSettings.EnforceUpdateIfMandatory && newestAvailableAppVersion.Mandatory))
                        {
                            NavigateToUpdatePage(currentVersion, appVersions, updateCheckSettings);
                        }
                        else
                        {
                            ShowUpdateNotification(currentVersion, appVersions, updateCheckSettings);
                        }
                    }
                    else
                    {
                        if (updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
                        {
                            await (new MessageDialog(LocalizedStrings.LocalizedResources.NoUpdateAvailable).ShowAsync());
                        }
                    }
                }
                catch (Exception e)
                {
                    thrownException = e;
                    HockeyClient.Current.AsInternal().HandleInternalUnhandledException(e);
                }
                //Don't show errors durgin update-check on startup
                if (thrownException != null && updateCheckSettings.UpdateMode.Equals(UpdateMode.InApp))
                {
                    await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Low, async () =>
                    {
                        await new MessageDialog(LocalizedStrings.LocalizedResources.UpdateUnknownError).ShowAsync();
                    });
                }
            }
        }

Same methods

UpdateManager::UpdateVersionIfAvailable ( UpdateCheckSettings updateCheckSettings ) : void