public UserSpecified(long id) { _userId = id; var account = Setting.Accounts.Get(_userId); _adata = account != null ? account.RelationData : null; }
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; } }
public UserSpecified(string screenName) { _originalScreenName = screenName; _userId = Setting.Accounts .Collection .Where(u => u.UnreliableScreenName.Equals( screenName, StringComparison.CurrentCultureIgnoreCase)) .Select(u => u.Id) .FirstOrDefault(); if (_userId == 0) { _userId = UserProxy.GetId(screenName); } else { var account = Setting.Accounts.Get(_userId); _adata = account != null ? account.RelationData : null; } }