Beispiel #1
0
        /// <summary>
        /// check for updates as an asynchronous operation.
        /// </summary>
        /// <param name="autoUpdateCheck">if set to <c>true</c> [automatic update check].</param>
        protected virtual async Task CheckForUpdatesAsync(bool autoUpdateCheck = false)
        {
            CheckingForUpdates = true;
            UpdateInfoVisible  = false;
            var updatesAvailable = await updater.CheckForUpdatesAsync();

            if (updatesAvailable)
            {
                Changelog         = updater.GetChangeLog();
                VersionContent    = updater.GetVersion();
                UpdateInfoVisible = true;
                var openState = IsOpen;
                IsOpen = false;
                IsOpen = openState;
                if (autoUpdateCheck)
                {
                    var title   = localizationManager.GetResource(LocalizationResources.Options.Updates.UpdateNotification.Title);
                    var message = localizationManager.GetResource(LocalizationResources.Options.Updates.UpdateNotification.Message);
                    notificationAction.ShowNotification(title, message, NotificationType.Info, 30, onClick: () => { IsOpen = true; });
                }
            }
            else
            {
                if (!autoUpdateCheck)
                {
                    var title   = localizationManager.GetResource(LocalizationResources.Notifications.NoUpdatesAvailable.Title);
                    var message = localizationManager.GetResource(LocalizationResources.Notifications.NoUpdatesAvailable.Message);
                    notificationAction.ShowNotification(title, message, NotificationType.Info);
                }
            }
            CheckingForUpdates = false;
        }