private static void RemoveAccount(AuthenticateInfo info)
 {
     lock (_dictLock)
     {
         _dictionary.Remove(info.Id);
     }
 }
Ejemplo n.º 2
0
 public SearchCandidateItemViewModel(SearchCandidateViewModel parent,
     AuthenticateInfo authenticateInfo, long id, string query)
 {
     _parent = parent;
     _authenticateInfo = authenticateInfo;
     _id = id;
     _query = query;
 }
Ejemplo n.º 3
0
 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;
               });
 }
Ejemplo n.º 4
0
 public override IObservable<TwitterStatus> Upload(AuthenticateInfo authInfo, string status,
     byte[] attachedImageBin, long? in_reply_to_status_id = null,
     double? geo_lat = null, double? geo_long = null)
 {
     return authInfo.UpdateWithMedia(
         status,
         attachedImageBin,
         "twitter_picture",
         false,
         in_reply_to_status_id,
         geo_lat, geo_long);
 }
Ejemplo n.º 5
0
 protected PollingConnectionBase(AuthenticateInfo ai)
     : base(ai)
 {
     _disposablesHolder.Add(Observable.FromEvent(
         h => App.OnApplicationFinalize += h,
         h => App.OnApplicationFinalize -= h)
         .Subscribe(_ => this.Dispose()));
     _disposablesHolder.Add(Observable.Interval(TimeSpan.FromSeconds(1))
         .Subscribe(_ => OnTick()));
     // ReSharper disable DoNotCallOverridableMethodsInConstructor
     _currentTick = IntervalSec; // first receive occurs immediately.
     // ReSharper restore DoNotCallOverridableMethodsInConstructor
 }
Ejemplo n.º 6
0
 public BackstageAccountModel(AuthenticateInfo info)
 {
     this._info = info;
     this.UpdateConnectionState();
     StoreHelper.GetUser(_info.Id)
                .Subscribe(
                    u =>
                    {
                        _user = u;
                        this.OnTwitterUserChanged();
                    },
                    ex => BackstageModel.RegisterEvent(
                        new OperationFailedEvent("Could not receive user info: " +
                                                 this._info.UnreliableScreenName +
                                                 " - " + ex.Message)));
 }
Ejemplo n.º 7
0
 public void StartReceive(AuthenticateInfo auth, ListInfo info)
 {
     lock (_listReceiverLocker)
     {
         if (_listReceiverReferenceCount.ContainsKey(info))
         {
             _listReceiverReferenceCount[info]++;
         }
         else
         {
             var lr = new ListReceiver(auth, info);
             _listReceiverReferenceCount.Add(info, 1);
             _listReceiverResolver.Add(info, lr);
         }
     }
 }
Ejemplo n.º 8
0
 private static void SetupAccount(AuthenticateInfo info)
 {
     lock (_dictLock)
     {
         if (_dictionary.ContainsKey(info.Id)) return;
         _dictionary.Add(info.Id, new LinkedList<TwitterStatus>());
         StatusStore.FindBatch(s => s.User.Id == info.Id, Setting.PostLimitPerWindow.Value)
                    .Subscribe(PostDetected);
     }
 }
Ejemplo n.º 9
0
 public TrackLimitEvent(AuthenticateInfo relatedInfo, int drop)
 {
     this._info = relatedInfo;
     this._drop = drop;
 }
Ejemplo n.º 10
0
 public static void RegisterList(AuthenticateInfo authInfo, ListInfo info)
 {
     _listReceiveManager.StartReceive(authInfo, info);
 }
Ejemplo n.º 11
0
 public UserReceiveBundle(AuthenticateInfo authInfo)
 {
     _authInfo = authInfo;
     // ReSharper disable UseObjectOrCollectionInitializer
     _disposable = new CompositeDisposable();
     _disposable.Add(_userStreamsReceiver = new UserStreamsReceiver(authInfo));
     _disposable.Add(_homeTimelineReceiver = new HomeTimelineReceiver(authInfo));
     _disposable.Add(_mentionTimelineReceiver = new MentionTimelineReceiver(authInfo));
     _disposable.Add(_directMessagesReceiver = new DirectMessagesReceiver(authInfo));
     _disposable.Add(_userInfoReceiver = new UserInfoReceiver(authInfo));
     _disposable.Add(_userRelationReceiver = new UserRelationReceiver(authInfo));
     // ReSharper restore UseObjectOrCollectionInitializer
     _userStreamsReceiver.StateChanged += () => this.OnStateChanged(this.UserId);
 }
Ejemplo n.º 12
0
 public static void ReceiveMentionTimeline(AuthenticateInfo info, long? maxId = null)
 {
     info.GetMentions(count: 100, include_rts: false, max_id: maxId)
         .RegisterToStore();
 }
Ejemplo n.º 13
0
 /// <summary>
 /// returns updated status.
 /// </summary>
 public abstract IObservable<TwitterStatus> Upload(AuthenticateInfo authInfo,
     string status, byte[] attachedImageBin, long? in_reply_to_status_id = null,
     double? geo_lat = null, double? geo_long = null);
Ejemplo n.º 14
0
 public ListReceiver(AuthenticateInfo auth, ListInfo listInfo)
 {
     _auth = auth;
     _listInfo = listInfo;
 }
Ejemplo n.º 15
0
 public FallbackedEvent(AuthenticateInfo authInfo, AuthenticateInfo fallbackTo)
 {
     this._authInfo = authInfo;
     this._fallbackToAuthInfo = fallbackTo;
 }
Ejemplo n.º 16
0
 public static void NotifyLimitationInfoGot(AuthenticateInfo auth, int trackLimit)
 {
     Action<AuthenticateInfo, int> handler = OnLimitationInfoGot;
     if (handler != null)
         handler(auth, trackLimit);
 }
Ejemplo n.º 17
0
 public MentionTimelineReceiver(AuthenticateInfo authInfo)
 {
     _authInfo = authInfo;
 }
Ejemplo n.º 18
0
 public PostResult(AuthenticateInfo info, Exception ex)
 {
     AuthInfo = info;
     IsSucceeded = false;
     ThrownException = ex;
 }
Ejemplo n.º 19
0
 public PostResult(AuthenticateInfo info, TwitterStatus status)
 {
     AuthInfo = info;
     IsSucceeded = true;
     Status = status;
 }
Ejemplo n.º 20
0
 public static void ReceiveMessages(AuthenticateInfo info, long? maxId = null)
 {
     info.GetDirectMessages(count: 50, max_id: maxId)
         .RegisterToStore();
 }
Ejemplo n.º 21
0
 protected IObservable<TwitterStatus> Update(AuthenticateInfo info,
     string status, long? inReplyToId, long? geoLat, long? geoLong)
 {
     return info.Update(status, inReplyToId, geoLat, geoLong);
 }
Ejemplo n.º 22
0
 public UserTimelinesReceiver(AuthenticateInfo info)
     : base(info)
 {
 }
 private static void SetupAccount(AuthenticateInfo info)
 {
     lock (_dictLock)
     {
         if (_dictionary.ContainsKey(info.Id)) return;
         _dictionary.Add(info.Id, new LinkedList<TwitterStatus>());
     }
 }
Ejemplo n.º 24
0
 public HomeTimelineReceiver(AuthenticateInfo authInfo)
 {
     _authInfo = authInfo;
 }
Ejemplo n.º 25
0
 public static IObservable<TwitterStatus> DoReceive(AuthenticateInfo info, ListInfo list, long? maxId = null)
 {
     return info.GetListStatuses(slug: list.Slug, owner_screen_name: list.OwnerScreenName, max_id: maxId);
 }
Ejemplo n.º 26
0
 public static AuthenticateInfo BacktrackFallback(AuthenticateInfo info)
 {
     if (!Setting.IsBacktrackFallback.Value)
         return info;
     var cinfo = info;
     while (true)
     {
         var backtrack = AccountsStore.Accounts
                                                 .FirstOrDefault(i => i.FallbackNext == cinfo.Id);
         if (backtrack == null)
             return cinfo;
         if (backtrack.UserId == info.Id)
             return info;
         cinfo = backtrack.AuthenticateInfo;
     }
 }
Ejemplo n.º 27
0
 public SelectableAccountViewModel(AccountSelectorViewModel parent, AuthenticateInfo info, Action onSelectionChanged)
 {
     this._parent = parent;
     this._info = info;
     this._onSelectionChanged = onSelectionChanged;
 }
Ejemplo n.º 28
0
 public static void ReceiveHomeTimeline(AuthenticateInfo info, long? maxId = null)
 {
     info.GetHomeTimeline(count: 100, include_rts: true, include_entities: true, max_id: maxId)
         .RegisterToStore();
 }
Ejemplo n.º 29
0
 public UserRelationReceiver(AuthenticateInfo authInfo)
 {
     _authInfo = authInfo;
 }
Ejemplo n.º 30
0
 public AuthenticateInfoViewModel(AuthenticateInfo info)
 {
     _authInfo = info;
 }