示例#1
0
		internal void LoadAccount(TwitterAccount account)
		{
			this.GetConfiguration(account);

			if (this.Accounts.All(a => a.UserId != account.UserId))
			{
				this.Accounts.Add(account);
				Helper.Operation(
					() => account.GetLists().ToTask(), "ユーザー '{0}' のリスト一覧を取得できませんでした。", account.UserId);
				Helper.Operation(
					() => account.GetHomeTimeline(200, isStartup: true).ToTask(), "ユーザー '{0}' のホーム タイムラインを取得できませんでした。", account.UserId);
				Helper.Operation(
					() => account.GetUserTimeline(count: 200, isStartup: true).ToTask(), "ユーザー '{0}' のユーザー タイムラインを取得できませんでした。", account.UserId);
				Helper.Operation(
					() => account.GetMentionsTimeline(200, isStartup: true).ToTask(), "ユーザー '{0}' のメンション タイムラインを取得できませんでした。", account.UserId);

				if (account.UserStreams.UseUserStreams)
				{
					Helper.Operation(() => account.UserStreams.Connect(), ex => "User streams 接続に失敗しました。");
				}
			}
		}
示例#2
0
		private async void GetConfiguration(TwitterAccount account)
		{
			if (this.Configuration == Configuration.Default)
			{
				try
				{
					this.Configuration = await account.CurrentToken.GetConfiguration();
				}
				catch (Exception ex)
				{
					ex.Report("設定情報を取得できませんでした。", () => this.GetConfiguration(account));
				}
			}
		}
		public ListAccountViewModel(TwitterAccount account, Action checkAction)
		{
			this.account = account;
			this.checkAction = checkAction;
			this.User = account.User == null ? null : UserViewModel.Get(account.User);

			this.CompositeDisposable.Add(new PropertyChangedEventListener(account)
			{
				{ "IsInitialized", (sender, e) => this.User = account.User == null ? null : UserViewModel.Get(account.User) },
			});

			this.Lists = TwitterClient.Current.Lists.Get(account.UserId)
				.OrderBy(l => l.Name)
				.Select(l => new ListViewModel(l, checkAction))
				.ToList();
		}