private readonly AccountCollection accounts;
#pragma warning disable SA1300
- private Twitter tw => ((TwitterAccount)this.accounts.Primary).Legacy; // AccountCollection への移行用
+ private Twitter tw => ((TwitterAccount)this.PrimaryAccount).Legacy; // AccountCollection への移行用
#pragma warning restore SA1300
+ private ISocialAccount PrimaryAccount
+ => this.accounts.Primary;
+
// Growl呼び出し部
private readonly GrowlHelper gh = new(ApplicationSettings.ApplicationName);
imgazyobizinet.Enabled = this.settings.Common.EnableImgAzyobuziNet;
imgazyobizinet.DisabledInDM = this.settings.Common.ImgAzyobuziNetDisabledInDM;
- Thumbnail.Services.TonTwitterCom.GetApiConnection = () => this.tw.Api.Connection;
+ Thumbnail.Services.TonTwitterCom.GetApiConnection = () => this.PrimaryAccount.Connection;
// 画像投稿サービス
this.ImageSelector.Model.InitializeServices(this.tw, this.tw.Configuration);
{
if (this.settings.Common.ReadOwnPost)
{
- if (notifyPosts != null && notifyPosts.Length > 0 && notifyPosts.All(x => x.UserId == this.tw.UserId))
+ var primaryUserId = this.PrimaryAccount.UserId;
+ if (notifyPosts != null && notifyPosts.Length > 0 && notifyPosts.All(x => x.UserId == primaryUserId))
return;
}
GrowlHelper.NotifyType nt;
if (this.settings.Common.DispUsername)
{
- title.Append(this.tw.Username);
+ title.Append(this.PrimaryAccount.UserName);
title.Append(" - ");
}
ToolTipIcon ntIcon;
if (this.settings.Common.DispUsername)
{
- title.Append(this.tw.Username);
+ title.Append(this.PrimaryAccount.UserName);
title.Append(" - ");
}
this.StatusOpenMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem.Enabled = true; // PublicSearchの時問題出るかも
- if (!post.CanRetweetBy(this.tw.UserId))
+ if (!post.CanRetweetBy(this.PrimaryAccount.UserId))
{
this.ReTweetStripMenuItem.Enabled = false;
this.ReTweetUnofficialStripMenuItem.Enabled = false;
if (this.ExistCurrentPost && post != null)
{
- this.DeleteStripMenuItem.Enabled = post.CanDeleteBy(this.tw.UserId);
- if (post.RetweetedByUserId == this.tw.UserId)
+ var primaryUserId = this.PrimaryAccount.UserId;
+ this.DeleteStripMenuItem.Enabled = post.CanDeleteBy(primaryUserId);
+ if (post.RetweetedByUserId == primaryUserId)
this.DeleteStripMenuItem.Text = Properties.Resources.DeleteMenuText2;
else
this.DeleteStripMenuItem.Text = Properties.Resources.DeleteMenuText1;
return;
// 選択されたツイートの中に削除可能なものが一つでもあるか
- if (!posts.Any(x => x.CanDeleteBy(this.tw.UserId)))
+ var primaryUserId = this.PrimaryAccount.UserId;
+ if (!posts.Any(x => x.CanDeleteBy(primaryUserId)))
return;
var ret = MessageBox.Show(
Exception? lastException = null;
foreach (var post in posts)
{
- if (!post.CanDeleteBy(this.tw.UserId))
+ if (!post.CanDeleteBy(primaryUserId))
continue;
try
}
else
{
- if (post.RetweetedByUserId == this.tw.UserId)
+ if (post.RetweetedByUserId == primaryUserId)
{
// 自分が RT したツイート (自分が RT した自分のツイートも含む)
// => RT を取り消し
}
else
{
- if (post.UserId == this.tw.UserId)
+ if (post.UserId == primaryUserId)
{
if (post.RetweetedId != null)
{
this.TopMost = this.settings.Common.AlwaysTop;
this.SaveConfigsAll(false);
- if (this.tw.UserId != previousUserId)
+ if (this.PrimaryAccount.UserId != previousUserId)
await this.DoGetFollowersMenu();
}
disableFooter = true;
// 自分宛のリプライの場合は先頭の「@screen_name 」の部分を除去する (in_reply_to_status_id は維持される)
- if (this.inReplyTo != null && this.inReplyTo.Value.ScreenName == this.tw.Username)
+ var primaryUserName = this.PrimaryAccount.UserName;
+ if (this.inReplyTo != null && this.inReplyTo.Value.ScreenName == primaryUserName)
{
- var mentionSelf = $"@{this.tw.Username} ";
+ var mentionSelf = $"@{primaryUserName} ";
if (statusText.StartsWith(mentionSelf, StringComparison.OrdinalIgnoreCase))
{
if (statusText.Length > mentionSelf.Length || this.GetSelectedImageService() != null)
this.inReplyTo = null;
}
- var selfScreenName = this.tw.Username;
+ var selfScreenName = this.PrimaryAccount.UserName;
var targetScreenNames = new List<string>();
foreach (var post in selectedPosts)
{
}
}
- if (this.settings.Common.DispUsername) ttl.Append(this.tw.Username).Append(" - ");
+ if (this.settings.Common.DispUsername) ttl.Append(this.PrimaryAccount.UserName).Append(" - ");
ttl.Append(ApplicationSettings.ApplicationName);
ttl.Append(" ");
switch (this.settings.Common.DispLatestPost)
ur.Remove(0, ur.Length);
if (this.settings.Common.DispUsername)
{
- ur.Append(this.tw.Username);
+ ur.Append(this.PrimaryAccount.UserName);
ur.Append(" - ");
}
ur.Append(ApplicationSettings.ApplicationName);
if (this.ExistCurrentPost)
{
var selectedPosts = this.CurrentTab.SelectedPosts;
+ var primaryUserId = this.PrimaryAccount.UserId;
- if (selectedPosts.Any(x => !x.CanRetweetBy(this.tw.UserId)))
+ if (selectedPosts.Any(x => !x.CanRetweetBy(primaryUserId)))
{
if (selectedPosts.Any(x => x.IsProtect))
MessageBox.Show("Protected.");
try
{
- var task = this.tw.Api.FriendshipsShow(this.tw.Username, id);
+ var task = this.tw.Api.FriendshipsShow(this.PrimaryAccount.UserName, id);
var friendship = await dialog.WaitForAsync(this, task);
isFollowing = friendship.Relationship.Source.Following;
try
{
- var task = this.tw.Api.FriendshipsShow(this.tw.Username, id);
+ var task = this.tw.Api.FriendshipsShow(this.PrimaryAccount.UserName, id);
var friendship = await dialog.WaitForAsync(this, task);
isFollowing = friendship.Relationship.Source.Following;
}
private async void OwnStatusMenuItem_Click(object sender, EventArgs e)
- => await this.DoShowUserStatus(this.tw.Username, false);
+ => await this.DoShowUserStatus(this.PrimaryAccount.UserName, false);
// TwitterIDでない固定文字列を調べる(文字列検証のみ 実際に取得はしない)
// URLから切り出した文字列を渡す
this.OpenStatusOpMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem2.Enabled = true; // PublicSearchの時問題出るかも
- if (!post.CanRetweetBy(this.tw.UserId))
+ if (!post.CanRetweetBy(this.PrimaryAccount.UserId))
{
this.RtOpMenuItem.Enabled = false;
this.RtUnOpMenuItem.Enabled = false;
if (this.ExistCurrentPost && post != null)
{
- this.DelOpMenuItem.Enabled = post.CanDeleteBy(this.tw.UserId);
+ this.DelOpMenuItem.Enabled = post.CanDeleteBy(this.PrimaryAccount.UserId);
}
}
}
private async void OpenOwnHomeMenuItem_Click(object sender, EventArgs e)
- => await MyCommon.OpenInBrowserAsync(this, MyCommon.TwitterUrl + this.tw.Username);
+ => await MyCommon.OpenInBrowserAsync(this, MyCommon.TwitterUrl + this.PrimaryAccount.UserName);
private bool ExistCurrentPost
{