Пример #1
0
 public override void Handle(CardListResponse obj)
 {
     if (obj.UpToDate)
     {
         OnUpToDate?.Invoke();
     }
     else
     {
         OnNotUpToDate?.Invoke(obj.CardList);
     }
 }
Пример #2
0
        /// <summary>
        /// Checks for a new version of the application and prompts the user to update if a new version is available
        /// </summary>
        /// <returns></returns>
        public async Task CheckForUpdatesAsync()
        {
            _log.Debug("Checking for updates");

            OnCheckingForUpdates?.Invoke(this, new());

            string json = await _http.GetStringAsync(URL);

            _latestRelease = JsonSerializer.Deserialize <LatestRelease>(json);
            var latestVersion = new Version(_latestRelease.tag_name.Replace("v", ""));
            var compare       = Common.Constants.Version.AsDotNetVersion().CompareTo(latestVersion);

            if (compare < 0)
            {
                OnUpdateAvailable?.Invoke(this, new(latestVersion));
            }
            else
            {
                OnUpToDate?.Invoke(this, new());
            }
        }