{
public partial class MyLists : OTBaseForm
{
- private readonly TwitterApi twitterApi = null!;
+ private readonly Twitter twitter = null!;
private readonly string contextScreenName = null!;
/// <summary>自分が所有しているリスト</summary>
public MyLists()
=> this.InitializeComponent();
- public MyLists(string screenName, TwitterApi twitterApi)
+ public MyLists(string screenName, Twitter twitter)
{
this.InitializeComponent();
- this.twitterApi = twitterApi;
+ this.twitter = twitter;
this.contextScreenName = screenName;
this.Text = screenName + Properties.Resources.MyLists1;
private async Task FetchMembershipListIds()
{
var ownedListData = await TwitterLists.GetAllItemsAsync(x =>
- this.twitterApi.ListsOwnerships(this.twitterApi.CurrentScreenName, cursor: x, count: 1000))
+ this.twitter.Api.ListsOwnerships(this.twitter.Username, cursor: x, count: 1000))
.ConfigureAwait(false);
this.ownedLists = ownedListData.Select(x => new ListElement(x, null!)).ToArray();
var listsUserAddedTo = await TwitterLists.GetAllItemsAsync(x =>
- this.twitterApi.ListsMemberships(this.contextScreenName, cursor: x, count: 1000, filterToOwnedLists: true))
+ this.twitter.Api.ListsMemberships(this.contextScreenName, cursor: x, count: 1000, filterToOwnedLists: true))
.ConfigureAwait(false);
this.addedListIds = listsUserAddedTo.Select(x => x.Id).ToArray();
{
try
{
- await this.twitterApi.ListsMembersCreate(list.Id, this.contextScreenName)
+ await this.twitter.Api.ListsMembersCreate(list.Id, this.contextScreenName)
.IgnoreResponse();
var index = this.ListsCheckedListBox.Items.IndexOf(list);
{
try
{
- await this.twitterApi.ListsMembersDestroy(list.Id, this.contextScreenName)
+ await this.twitter.Api.ListsMembersDestroy(list.Id, this.contextScreenName)
.IgnoreResponse();
var index = this.ListsCheckedListBox.Items.IndexOf(list);
public void ListManageUserContext(string screenName)
{
- using var listSelectForm = new MyLists(screenName, this.tw.Api);
+ using var listSelectForm = new MyLists(screenName, this.tw);
listSelectForm.ShowDialog(this);
}
private async Task DoShowUserStatus(TwitterUser user)
{
- using var userDialog = new UserInfoDialog(this, this.tw.Api, this.detailsHtmlBuilder);
+ using var userDialog = new UserInfoDialog(this, this.tw, this.detailsHtmlBuilder);
var showUserTask = userDialog.ShowUserAsync(user);
userDialog.ShowDialog(this);
private CancellationTokenSource? cancellationTokenSource = null;
private readonly TweenMain mainForm;
- private readonly TwitterApi twitterApi;
+ private readonly Twitter twitter;
private readonly DetailsHtmlBuilder detailsHtmlBuilder;
- public UserInfoDialog(TweenMain mainForm, TwitterApi twitterApi, DetailsHtmlBuilder detailsHtmlBuilder)
+ public UserInfoDialog(TweenMain mainForm, Twitter twitter, DetailsHtmlBuilder detailsHtmlBuilder)
{
this.mainForm = mainForm;
- this.twitterApi = twitterApi;
+ this.twitter = twitter;
this.detailsHtmlBuilder = detailsHtmlBuilder;
this.InitializeComponent();
this.LinkLabelTweet.Tag = profileUrl;
this.ToolTip1.SetToolTip(this.LinkLabelTweet, profileUrl);
- if (this.twitterApi.CurrentUserId == user.Id)
+ if (this.twitter.UserId == user.Id)
{
this.ButtonEdit.Enabled = true;
this.ChangeIconToolStripMenuItem.Enabled = true;
this.ButtonFollow.Enabled = false;
this.ButtonUnFollow.Enabled = false;
- if (this.twitterApi.CurrentScreenName == screenName)
+ if (this.twitter.Username == screenName)
return;
TwitterFriendship friendship;
try
{
- friendship = await this.twitterApi.FriendshipsShow(this.twitterApi.CurrentScreenName, screenName);
+ friendship = await this.twitter.Api.FriendshipsShow(this.twitter.Username, screenName);
}
catch (WebApiException)
{
{
try
{
- await this.twitterApi.FriendshipsCreate(this.displayUser.ScreenName)
+ await this.twitter.Api.FriendshipsCreate(this.displayUser.ScreenName)
.IgnoreResponse();
}
catch (WebApiException ex)
{
try
{
- await this.twitterApi.FriendshipsDestroy(this.displayUser.ScreenName)
+ await this.twitter.Api.FriendshipsDestroy(this.displayUser.ScreenName)
.IgnoreResponse();
}
catch (WebApiException ex)
private async void ButtonEdit_Click(object sender, EventArgs e)
{
// 自分以外のプロフィールは変更できない
- if (this.twitterApi.CurrentUserId != this.displayUser.Id)
+ if (this.twitter.UserId != this.displayUser.Id)
return;
using (ControlTransaction.Disabled(this.ButtonEdit))
{
try
{
- using var response = await this.twitterApi.AccountUpdateProfile(
+ using var response = await this.twitter.Api.AccountUpdateProfile(
this.TextBoxName.Text,
this.TextBoxWeb.Text,
this.TextBoxLocation.Text,
{
var mediaItem = new FileMediaItem(filename);
- await this.twitterApi.AccountUpdateProfileImage(mediaItem)
+ await this.twitter.Api.AccountUpdateProfileImage(mediaItem)
.IgnoreResponse();
}
catch (WebApiException ex)
try
{
- var user = await this.twitterApi.UsersShow(this.displayUser.ScreenName);
+ var user = await this.twitter.Api.UsersShow(this.displayUser.ScreenName);
if (user != null)
await this.ShowUserAsync(user);
{
try
{
- await this.twitterApi.BlocksCreate(this.displayUser.ScreenName)
+ await this.twitter.Api.BlocksCreate(this.displayUser.ScreenName)
.IgnoreResponse();
}
catch (WebApiException ex)
{
try
{
- await this.twitterApi.UsersReportSpam(this.displayUser.ScreenName)
+ await this.twitter.Api.UsersReportSpam(this.displayUser.ScreenName)
.IgnoreResponse();
}
catch (WebApiException ex)
{
try
{
- await this.twitterApi.BlocksDestroy(this.displayUser.ScreenName)
+ await this.twitter.Api.BlocksDestroy(this.displayUser.ScreenName)
.IgnoreResponse();
}
catch (WebApiException ex)