public UserFavoritesViewModel(UserInfoViewModel parent)
 {
     this._parent = parent;
     this._timelineModel = new TimelineModel(
         s => s.User.Id == parent.User.User.Id,
         (id, c, _) =>
         {
             var info = AccountsStore.Accounts
                                     .Shuffle()
                                     .Select(s => s.AuthenticateInfo)
                                     .FirstOrDefault();
             if (info == null)
             {
                 return Observable.Empty<TwitterStatus>();
             }
             return info.GetFavorites(this._parent.User.User.Id, max_id: id, count: c)
                        .OrderByDescending(s => s.CreatedAt)
                        .Catch((Exception ex) =>
                        {
                            BackstageModel.RegisterEvent(new OperationFailedEvent(ex.Message));
                            return Observable.Empty<TwitterStatus>();
                        });
         });
     IsLoading = true;
     _timelineModel.ReadMore(null)
                   .Finally(() => IsLoading = false)
                   .Subscribe();
 }
 public RelationControlViewModel(UserInfoViewModel parent, AuthenticateInfo source, TwitterUser target)
 {
     this._parent = parent;
     this._source = source;
     this._target = target;
     var rds = source.GetRelationData();
     this.IsFollowing = rds.IsFollowing(target.Id);
     this.IsFollowedBack = rds.IsFollowedBy(target.Id);
     this.IsBlocking = rds.IsBlocking(target.Id);
     source.GetFriendship(source.Id, target_id: target.Id)
           .Subscribe(
               r =>
               {
                   // ReSharper disable InvertIf
                   if (this.IsFollowing != r.relationship.source.following)
                   {
                       this.IsFollowing = r.relationship.source.following;
                       if (r.relationship.source.following)
                       {
                           rds.AddFollowing(target.Id);
                       }
                       else
                       {
                           rds.RemoveFollowing(target.Id);
                       }
                   }
                   if (this.IsFollowedBack != r.relationship.source.followed_by)
                   {
                       this.IsFollowedBack = r.relationship.source.followed_by;
                       if (r.relationship.source.followed_by)
                       {
                           rds.AddFollower(target.Id);
                       }
                       else
                       {
                           rds.RemoveFollower(target.Id);
                       }
                   }
                   if (this.IsBlocking != r.relationship.source.blocking)
                   {
                       this.IsBlocking = r.relationship.source.blocking;
                       if (r.relationship.source.blocking)
                       {
                           rds.AddBlocking(target.Id);
                       }
                       else
                       {
                           rds.RemoveBlocking(target.Id);
                       }
                   }
                   // ReSharper restore InvertIf
               },
               ex =>
               {
                   this.Enabled = false;
               });
 }
 public UserTimelineViewModel(UserInfoViewModel parent, UserTimelineModel model)
     : base(model)
 {
     _parent = parent;
     _model = model;
     this.CompositeDisposable.Add(
         new EventListener<Action>(
             h => _model.FocusRequired += h,
             h => _model.FocusRequired -= h,
             this.SetFocus));
 }
 public RelationControlViewModel(UserInfoViewModel parent, TwitterAccount source, TwitterUser target)
 {
     this._parent = parent;
     this._source = source;
     this._target = target;
     var rds = source.RelationData;
     this.IsFollowing = rds.IsFollowing(target.Id);
     this.IsFollowedBack = rds.IsFollowedBy(target.Id);
     this.IsBlocking = rds.IsBlocking(target.Id);
     Task.Run(() => this.GetFriendship(rds));
 }
Example #5
0
        public RelationControlViewModel(UserInfoViewModel parent, TwitterAccount source, TwitterUser target)
        {
            this._parent = parent;
            this._source = source;
            this._target = target;
            var rds = source.RelationData;

            this.IsFollowing    = rds.IsFollowing(target.Id);
            this.IsFollowedBack = rds.IsFollowedBy(target.Id);
            this.IsBlocking     = rds.IsBlocking(target.Id);
            this.IsNoRetweets   = rds.IsNoRetweets(target.Id);
            Task.Run(() => this.GetFriendship(rds));
        }
 public UserListViewModelBase(UserInfoViewModel parent)
 {
     _parent = parent;
     ReadMore();
 }
 public UserFollowingViewModel(UserInfoViewModel parent)
     : base(parent)
 {
 }
 public UserFollowingViewModel(UserInfoViewModel parent)
 {
     _parent = parent;
     this.InitCollection();
 }
Example #9
0
 public UserListViewModelBase(UserInfoViewModel parent)
 {
     this._parent = parent;
     this.ReadMore();
 }
 public UserFollowingViewModel(UserInfoViewModel parent)
     : base(parent)
 {
 }
 public UserListViewModelBase(UserInfoViewModel parent)
 {
     this._parent = parent;
     this.ReadMore();
 }
 public UserTimelineViewModel(UserInfoViewModel parent, UserTimelineModel model)
     : base(model)
 {
     _parent = parent;
 }