Exemplo n.º 1
0
        private async void GetFriendship(AccountRelationData rds)
        {
            try
            {
                // ReSharper disable InvertIf
                var fs = await _source.ShowFriendshipAsync(_source.Id, _target.Id);

                if (this.IsFollowing != fs.IsSourceFollowingTarget)
                {
                    this.IsFollowing = fs.IsSourceFollowingTarget;
                    await rds.SetFollowingAsync(this._target.Id, fs.IsSourceFollowingTarget);
                }
                if (this.IsFollowedBack != fs.IsTargetFollowingSource)
                {
                    this.IsFollowedBack = fs.IsTargetFollowingSource;
                    await rds.SetFollowerAsync(_target.Id, fs.IsTargetFollowingSource);
                }
                if (this.IsBlocking != fs.IsBlocking)
                {
                    this.IsBlocking = fs.IsBlocking;
                    await rds.SetBlockingAsync(_target.Id, fs.IsBlocking);
                }
                var nort = !fs.IsWantRetweets.GetValueOrDefault(true);
                if (this.IsNoRetweets != nort)
                {
                    this.IsNoRetweets = nort;
                    await rds.SetNoRetweetsAsync(_target.Id, nort);
                }
                // ReSharper restore InvertIf
            }
            catch (Exception)
            {
                this.Enabled = false;
            }
        }