Пример #1
0
        private async Task UnsafeCheckForUpdate(CancellationToken cancellationToken)
        {
            _earlyAccess = _requestedEarlyAccess;
            _status      = AppUpdateStatus.Checking;

            HandleSuccess(_update.CachedLatest(_earlyAccess), cancellationToken);
            HandleSuccess(await _update.Latest(_earlyAccess), cancellationToken);

            if (_update.Available)
            {
                HandleSuccess(await _update.Validated(), cancellationToken);

                if (!_update.Ready)
                {
                    _status = AppUpdateStatus.Downloading;
                    OnStateChanged();

                    HandleSuccess(await _update.Downloaded(), cancellationToken);
                    HandleSuccess(await _update.Validated(), cancellationToken);

                    if (!_update.Ready)
                    {
                        _status = AppUpdateStatus.DownloadFailed;
                        OnStateChanged();

                        return;
                    }
                }
            }

            _status = _update.Ready ? AppUpdateStatus.Ready : AppUpdateStatus.None;
            OnStateChanged();
        }