private static void RemoveAccount(TwitterAccount info)
 {
     lock (_dictLock)
     {
         _dictionary.Remove(info.Id);
     }
 }
Exemple #2
0
 public static void NotifyFallbackState(TwitterAccount account, bool isFallbacked)
 {
     var model = _accounts.FirstOrDefault(a => a.Account.Id == account.Id);
     if (model != null)
     {
         model.NotifyFallbackState(isFallbacked);
     }
 }
Exemple #3
0
 static void UpdateConnectionState(TwitterAccount account)
 {
     var avm = _accounts.FirstOrDefault(vm => vm.Account.Id == account.Id);
     if (avm != null)
     {
         avm.UpdateConnectionState();
     }
 }
 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));
 }
 private static void SetupAccount(TwitterAccount info)
 {
     lock (_dictLock)
     {
         if (_dictionary.ContainsKey(info.Id)) return;
         _dictionary.Add(info.Id, new LinkedList<TwitterStatus>());
         StatusProxy.FetchStatuses(
             "UserId = " + info.Id.ToString(CultureInfo.InvariantCulture), count: Setting.PostLimitPerWindow.Value)
                    .Subscribe(PostDetected);
     }
 }
 public BackstageAccountModel(TwitterAccount account)
 {
     this._account = account;
     this.UpdateConnectionState();
     StoreHelper.GetUser(this._account.Id)
         .Subscribe(
             u =>
             {
                 _user = u;
                 this.RaiseTwitterUserChanged();
             },
             ex => BackstageModel.RegisterEvent(
                 new OperationFailedEvent("アカウント情報を取得できません(@" + _account.UnreliableScreenName + ")", ex)));
 }
 private async Task<IEnumerable<long>> ReceiveListMembers(TwitterAccount account, long listId)
 {
     var memberList = new List<long>();
     long cursor = -1;
     do
     {
         var result = await account.GetListMembersAsync(listId, cursor).ConfigureAwait(false);
         memberList.AddRange(result.Result
                   .Do(u => Task.Run(() => UserProxy.StoreUser(u)))
                   .Select(u => u.Id));
         cursor = result.NextCursor;
     } while (cursor != 0);
     return memberList;
 }
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             this._listReceiverReferenceCount.Add(info, 1);
             this._receiverDictionary.Add(info, new ListReceiver(account, info));
         }
     }
 }
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             var lr = new ListReceiver(account, info);
             this._listReceiverReferenceCount.Add(info, 1);
             this._listReceiverResolver.Add(info, lr);
         }
     }
 }
 public BackstageAccountModel(TwitterAccount account)
 {
     this._account = account;
     this.UpdateConnectionState();
     StoreHelper.GetUser(this._account.Id)
                .Subscribe(
                    u =>
                    {
                        _user = u;
                        this.OnTwitterUserChanged();
                    },
                    ex => BackstageModel.RegisterEvent(
                        new OperationFailedEvent("Could not receive user account: " +
                                                 this._account.UnreliableScreenName +
                                                 " - " + ex.Message)));
 }
 public BackstageAccountModel(TwitterAccount account)
 {
     this._account = account;
     this.UpdateConnectionState();
     StoreHelper.GetUser(this._account.Id)
                .Subscribe(
                    u =>
                    {
                        _user = u;
                        this.RaiseTwitterUserChanged();
                    },
                    ex => BackstageModel.RegisterEvent(new OperationFailedEvent(
                        BackstageResources.GetAccountInfoFailedFormat.SafeFormat(
                            "@" + _account.UnreliableScreenName),
                        ex)));
 }
 private static void SetupAccount(TwitterAccount info)
 {
     lock (_dictLock)
     {
         if (_dictionary.ContainsKey(info.Id)) return;
         _dictionary.Add(info.Id, new LinkedList<TwitterStatus>());
     }
     Task.Run(async () =>
     {
         var result = await StatusProxy.FetchStatuses(
             s => s.User.Id == info.Id,
             "UserId = " + info.Id.ToString(CultureInfo.InvariantCulture),
             count: Setting.PostLimitPerWindow.Value);
         result
             .OrderBy(c => c.CreatedAt)
             .ForEach(PostDetected);
     });
 }
 public BackstageAccountModel(TwitterAccount account)
 {
     this._account = account;
     this.UpdateConnectionState();
     Task.Run(async () =>
     {
         try
         {
             _user = await StoreHelper.GetUserAsync(this._account.Id);
             this.RaiseTwitterUserChanged();
         }
         catch (Exception ex)
         {
             BackstageModel.RegisterEvent(new OperationFailedEvent(
                 BackstageResources.GetAccountInfoFailedFormat.SafeFormat("@" + _account.UnreliableScreenName),
                 ex));
         }
     });
 }
 private Task<TwitterList> ReceiveListDescription(TwitterAccount account, ListInfo info)
 {
     return account.ShowListAsync(info.OwnerScreenName, info.Slug);
 }
 public ListMemberReceiver(TwitterAccount auth, ListInfo listInfo)
 {
     _auth = auth;
     _listInfo = listInfo;
 }
 public UserStreamsReceiver(TwitterAccount account)
 {
     this._stateUpdater = new StateUpdater();
     this._account = account;
 }
 public PostLimitedEvent(TwitterAccount account, DateTime releaseTime)
 {
     _account = account;
     _releaseTime = releaseTime;
 }
Exemple #18
0
 public UserInfoReceiver(TwitterAccount account)
 {
     _account = account;
 }
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             var lmr = new ListMemberReceiver(account, info);
             lmr.ListMemberChanged += () => ListMemberChanged.SafeInvoke(info);
             this._listReceiverReferenceCount.Add(info, 1);
             this._receiverDictionary.Add(info, lmr);
         }
     }
 }
 public UserTimelineReceiver(TwitterAccount account)
 {
     this._account = account;
 }
 internal static void NotifyLimitationInfoGot(TwitterAccount account, int trackLimit)
 {
     Head.NotifyLimitationInfoGot(account, trackLimit);
 }
 public SearchCandidateItemViewModel(SearchCandidateViewModel parent,
     TwitterAccount account, long id, string query)
 {
     _parent = parent;
     this._account = account;
     _id = id;
     _query = query;
 }
Exemple #23
0
 public PostResult(TwitterAccount info, Exception ex)
 {
     this.Account = info;
     IsSucceeded = false;
     ThrownException = ex;
 }
 public TwitterAccountViewModel(TwitterAccount account)
 {
     this._account = account;
 }
 public void NotifyLimitationInfoGot(TwitterAccount account, int trackLimit)
 {
     BackstageModel.RegisterEvent(new TrackLimitEvent(account, trackLimit));
 }
Exemple #26
0
 public static void RegisterListMember(TwitterAccount authInfo, ListInfo info)
 {
     _listMemberReceiveManager.StartReceive(authInfo, info);
 }
Exemple #27
0
 public static TwitterAccount BacktrackFallback(TwitterAccount account)
 {
     if (!Setting.IsBacktrackFallback.Value)
     {
         return account;
     }
     var cinfo = account;
     while (true)
     {
         var backtrack = Setting.Accounts.Collection.FirstOrDefault(a => a.FallbackAccountId == cinfo.Id);
         if (backtrack == null)
             return cinfo;
         if (backtrack.Id == account.Id)
             return account;
         cinfo = backtrack;
     }
 }
 public SelectableAccountViewModel(AccountSelectionFlipViewModel parent, TwitterAccount account, Action onSelectionChanged)
 {
     this._parent = parent;
     this._account = account;
     this._onSelectionChanged = onSelectionChanged;
 }
 public FallbackedEvent(TwitterAccount account, TwitterAccount fallbackTo)
 {
     this._account = account;
     this._fallbackAccount = fallbackTo;
 }
 public MentionTimelineReceiver(TwitterAccount account)
 {
     this._account = account;
 }