private int _hisIdx; //発言履歴カレントインデックス
//発言投稿時のAPI引数(発言編集時に設定。手書きreplyでは設定されない)
- private Tuple<long, string> inReplyTo = null; // リプライ先のステータスID・スクリーン名
+ private (long StatusId, string ScreenName)? inReplyTo = null; // リプライ先のステータスID・スクリーン名
//時速表示用
private List<DateTimeUtc> _postTimestamps = new List<DateTimeUtc>();
}
}
- private TabPage _curTab;
private int _curItemIndex;
private DetailsListView _curList;
private PostClass _curPost;
}
private Stack<ReplyChain> replyChains; //[, ]でのリプライ移動の履歴
- private Stack<ValueTuple<TabPage, PostClass>> selectPostChains = new Stack<ValueTuple<TabPage, PostClass>>(); //ポスト選択履歴
+ private Stack<(TabPage, PostClass)> selectPostChains = new Stack<(TabPage, PostClass)>(); //ポスト選択履歴
+
+ public TabModel CurrentTab
+ => this._statuses.SelectedTab;
+
+ public string CurrentTabName
+ => this._statuses.SelectedTabName;
+
+ public TabPage CurrentTabPage
+ => this.ListTab.TabPages.Cast<TabPage>().First(x => x.Text == this.CurrentTabName);
//検索処理タイプ
internal enum SEARCHTYPE
private class StatusTextHistory
{
public string status = "";
- public long? inReplyToId = null;
- public string inReplyToName = null;
+ public (long StatusId, string ScreenName)? inReplyTo = null;
public string imageService = ""; //画像投稿サービス名
public IMediaItem[] mediaItems = null;
public StatusTextHistory()
{
}
- public StatusTextHistory(string status, long? replyToId, string replyToName)
+ public StatusTextHistory(string status, (long StatusId, string ScreenName)? inReplyTo)
{
this.status = status;
- this.inReplyToId = replyToId;
- this.inReplyToName = replyToName;
+ this.inReplyTo = inReplyTo;
}
}
//Win32Api.SetProxy(HttpConnection.ProxyType.Specified, "127.0.0.1", 8080, "user", "pass")
- MyCommon.TwitterApiInfo.AccessLimitUpdated += TwitterApiStatus_AccessLimitUpdated;
Microsoft.Win32.SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
Microsoft.Win32.SystemEvents.TimeChanged += SystemEvents_TimeChanged;
throw new TabException(Properties.Resources.TweenMain_LoadText1);
}
- _curTab = ListTab.SelectedTab;
+ this._statuses.SelectTab(this.ListTab.SelectedTab.Text);
_curItemIndex = -1;
- _curList = (DetailsListView)_curTab.Tag;
+ _curList = (DetailsListView)this.CurrentTabPage.Tag;
+
+ MyCommon.TwitterApiInfo.AccessLimitUpdated += TwitterApiStatus_AccessLimitUpdated;
if (SettingManager.Common.TabIconDisp)
{
private void RefreshTimeline()
{
- var curTabModel = this._statuses.Tabs[this._curTab.Text];
+ var curTabModel = this.CurrentTab;
// 現在表示中のタブのスクロール位置を退避
var curListScroll = this.SaveListViewScroll(this._curList, curTabModel);
{
return new ListViewSelection
{
- SelectedStatusIds = new long[0],
+ SelectedStatusIds = Array.Empty<long>(),
SelectionMarkStatusId = null,
FocusedStatusId = null,
};
private void ChangeCacheStyleRead(bool Read, int Index)
{
- var tabInfo = _statuses.Tabs[_curTab.Text];
+ var tabInfo = this.CurrentTab;
//Read:true=既読 false=未読
//未読管理していなかったら既読として扱う
if (!tabInfo.UnreadManage ||
if (!listCache.TryGetValue(Index, out var itm, out var post))
return;
- ChangeItemStyleRead(Read, itm, post, ((DetailsListView)_curTab.Tag));
+ ChangeItemStyleRead(Read, itm, post, this._curList);
}
private void ChangeItemStyleRead(bool Read, ListViewItem Item, PostClass Post, DetailsListView DList)
else if (TargetPost.IsReply)
//自分宛返信
cl = _clAtSelf;
- else if (BasePost.ReplyToList.Any(x => x.Item1 == TargetPost.UserId))
+ else if (BasePost.ReplyToList.Any(x => x.UserId == TargetPost.UserId))
//返信先
cl = _clAtFromTarget;
- else if (TargetPost.ReplyToList.Any(x => x.Item1 == BasePost.UserId))
+ else if (TargetPost.ReplyToList.Any(x => x.UserId == BasePost.UserId))
//その人への返信
cl = _clAtTarget;
else if (TargetPost.ScreenName.Equals(BasePost.ScreenName, StringComparison.OrdinalIgnoreCase))
return cl;
}
+ private void StatusTextHistoryBack()
+ {
+ if (!string.IsNullOrWhiteSpace(this.StatusText.Text))
+ this._history[_hisIdx] = new StatusTextHistory(this.StatusText.Text, this.inReplyTo);
+
+ this._hisIdx -= 1;
+ if (this._hisIdx < 0)
+ this._hisIdx = 0;
+
+ var historyItem = this._history[this._hisIdx];
+ this.inReplyTo = historyItem.inReplyTo;
+ this.StatusText.Text = historyItem.status;
+ this.StatusText.SelectionStart = this.StatusText.Text.Length;
+ }
+
+ private void StatusTextHistoryForward()
+ {
+ if (!string.IsNullOrWhiteSpace(this.StatusText.Text))
+ this._history[this._hisIdx] = new StatusTextHistory(this.StatusText.Text, this.inReplyTo);
+
+ this._hisIdx += 1;
+ if (this._hisIdx > this._history.Count - 1)
+ this._hisIdx = this._history.Count - 1;
+
+ var historyItem = this._history[this._hisIdx];
+ this.inReplyTo = historyItem.inReplyTo;
+ this.StatusText.Text = historyItem.status;
+ this.StatusText.SelectionStart = this.StatusText.Text.Length;
+ }
+
private async void PostButton_Click(object sender, EventArgs e)
{
if (StatusText.Text.Trim().Length == 0)
return;
}
- var inReplyToStatusId = this.inReplyTo?.Item1;
- var inReplyToScreenName = this.inReplyTo?.Item2;
- _history[_history.Count - 1] = new StatusTextHistory(StatusText.Text, inReplyToStatusId, inReplyToScreenName);
+ _history[_history.Count - 1] = new StatusTextHistory(StatusText.Text, this.inReplyTo);
if (SettingManager.Common.Nicoms)
{
// auto_populate_reply_metadata や attachment_url を使用しなくても 140 字以内に
// 収まる場合はこれらのオプションを使用せずに投稿する
status.Text = statusTextCompat;
- status.InReplyToStatusId = this.inReplyTo?.Item1;
+ status.InReplyToStatusId = this.inReplyTo?.StatusId;
}
else
{
status.Text = this.FormatStatusTextExtended(this.StatusText.Text, out var autoPopulatedUserIds, out var attachmentUrl);
- status.InReplyToStatusId = this.inReplyTo?.Item1;
+ status.InReplyToStatusId = this.inReplyTo?.StatusId;
status.AttachmentUrl = attachmentUrl;
// リプライ先がセットされていても autoPopulatedUserIds が空の場合は auto_populate_reply_metadata を有効にしない
// (非公式 RT の場合など)
- var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Item1] : null;
+ var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Value.StatusId] : null;
if (replyToPost != null && autoPopulatedUserIds.Length != 0)
{
status.AutoPopulateReplyMetadata = true;
// ReplyToList のうち autoPopulatedUserIds に含まれていないユーザー ID を抽出
- status.ExcludeReplyUserIds = replyToPost.ReplyToList.Select(x => x.Item1).Except(autoPopulatedUserIds)
+ status.ExcludeReplyUserIds = replyToPost.ReplyToList.Select(x => x.UserId).Except(autoPopulatedUserIds)
.ToArray();
}
}
try
{
- await tab.RefreshAsync(this.tw, backward, this._initial, this.workerProgress);
+ await Task.Run(() => tab.RefreshAsync(this.tw, backward, this._initial, this.workerProgress));
this.RefreshTimeline();
}
catch (WebApiException ex)
this.RefreshTimeline();
- if (this._curList != null && this._curTab != null && this._curTab.Text == tab.TabName)
+ if (this._curList != null && this.CurrentTabName == tab.TabName)
{
using (ControlTransaction.Update(this._curList))
{
this.RefreshTimeline();
- if (this._curList != null && this._curTab != null && this._curTab.Text == tab.TabName)
+ if (this._curList != null && this.CurrentTabName == tab.TabName)
{
if (tab.TabType == MyCommon.TabUsageType.Favorites)
{
}
else
{
+ this.StatusTextHistoryBack();
+ this.StatusText.Focus();
+
// 連投モードのときだけEnterイベントが起きないので強制的に背景色を戻す
if (SettingManager.Common.FocusLockToStatusText)
this.StatusText_Enter(this.StatusText, EventArgs.Empty);
// TLに反映
if (!this.tw.UserStreamActive)
{
+ // 自分のRTはTLの更新では取得できない場合があるので、
+ // 投稿時取得の有無に関わらず追加しておく
+ posts.ForEach(post => this._statuses.AddPost(post));
+
if (SettingManager.Common.PostAndGet)
await this.RefreshTabAsync<HomeTabModel>();
else
{
- if (posts.Count > 0)
- {
- posts.ForEach(post => this._statuses.AddPost(post));
- this._statuses.DistributePosts();
- this.RefreshTimeline();
- }
+ this._statuses.DistributePosts();
+ this.RefreshTimeline();
}
}
}
private async Task FavoriteChange(bool FavAdd, bool multiFavoriteChangeDialogEnable = true)
{
- if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out var tab))
- return;
+ var tab = this.CurrentTab;
//trueでFavAdd,falseでFavRemove
if (tab.TabType == MyCommon.TabUsageType.DirectMessage || _curList.SelectedIndices.Count == 0
return post;
}
- return _statuses.Tabs[_curTab.Text][Index];
+ return this.CurrentTab[Index];
}
private async void MoveToHomeToolStripMenuItem_Click(object sender, EventArgs e)
this.PurgeListViewItemCache();
- var tab = this._statuses.Tabs[this._curTab.Text];
+ var tab = this.CurrentTab;
if (tab.AllCount > 0 && this._curPost != null)
{
var idx = tab.IndexOf(this._curPost.StatusId);
private void ContextMenuOperate_Opening(object sender, CancelEventArgs e)
{
- if (ListTab.SelectedTab == null) return;
- if (_statuses == null || _statuses.Tabs == null || !_statuses.Tabs.ContainsKey(ListTab.SelectedTab.Text)) return;
if (!this.ExistCurrentPost)
{
ReplyStripMenuItem.Enabled = false;
ReadedStripMenuItem.Enabled = true;
UnreadStripMenuItem.Enabled = true;
}
- if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.DirectMessage || !this.ExistCurrentPost || _curPost.IsDm)
+ var tab = this.CurrentTab;
+ if (tab.TabType == MyCommon.TabUsageType.DirectMessage || !this.ExistCurrentPost || _curPost.IsDm)
{
FavAddToolStripMenuItem.Enabled = false;
FavRemoveToolStripMenuItem.Enabled = false;
StatusOpenMenuItem.Enabled = false;
- FavorareMenuItem.Enabled = false;
ShowRelatedStatusesMenuItem.Enabled = false;
ReTweetStripMenuItem.Enabled = false;
FavAddToolStripMenuItem.Enabled = true;
FavRemoveToolStripMenuItem.Enabled = true;
StatusOpenMenuItem.Enabled = true;
- FavorareMenuItem.Enabled = true;
ShowRelatedStatusesMenuItem.Enabled = true; //PublicSearchの時問題出るかも
if (!_curPost.CanRetweetBy(this.twitterApi.CurrentUserId))
private async Task doStatusDelete()
{
- if (this._curTab == null || this._curList == null)
+ if (this._curList == null)
return;
if (this._curList.SelectedIndices.Count == 0)
{
listView.VirtualListSize = tab.AllCount;
- if (tabPage == this._curTab)
+ if (tabPage == this.CurrentTabPage)
{
listView.SelectedIndices.Clear();
{
using (ControlTransaction.Update(this._curList))
{
+ var tab = this.CurrentTab;
foreach (int idx in _curList.SelectedIndices)
{
- var post = this._statuses.Tabs[this._curTab.Text][idx];
+ var post = tab[idx];
this._statuses.SetReadAllTab(post.StatusId, read: true);
ChangeCacheStyleRead(true, idx);
}
{
using (ControlTransaction.Update(this._curList))
{
+ var tab = this.CurrentTab;
foreach (int idx in _curList.SelectedIndices)
{
- var post = this._statuses.Tabs[this._curTab.Text][idx];
+ var post = tab[idx];
this._statuses.SetReadAllTab(post.StatusId, read: false);
ChangeCacheStyleRead(false, idx);
}
=> await this.DoRefresh();
private async Task DoRefresh()
- {
- if (_curTab != null)
- {
- if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out var tab))
- return;
-
- await this.RefreshTabAsync(tab);
- }
- else
- {
- await this.RefreshTabAsync<HomeTabModel>();
- }
- }
+ => await this.RefreshTabAsync(this.CurrentTab);
private async Task DoRefreshMore()
- {
- if (_curTab != null)
- {
- if (!this._statuses.Tabs.TryGetValue(this._curTab.Text, out var tab))
- return;
-
- await this.RefreshTabAsync(tab, backward: true);
- }
- else
- {
- await this.RefreshTabAsync<HomeTabModel>(backward: true);
- }
- }
+ => await this.RefreshTabAsync(this.CurrentTab, backward: true);
private DialogResult ShowSettingDialog(bool showTaskbarIcon = false)
{
{
if (e.KeyCode == Keys.Escape)
{
- TabPage relTp = ListTab.SelectedTab;
+ var relTp = this.CurrentTabPage;
RemoveSpecifiedTab(relTp.Text, false);
SaveConfigsTabs();
e.SuppressKeyPress = true;
_listCustom.ListViewItemSorter = null;
//キャッシュのクリア
- if (_curTab.Equals(_tabPage))
+ if (this.CurrentTabPage.Equals(_tabPage))
{
- _curTab = null;
_curItemIndex = -1;
_curList = null;
_curPost = null;
}
}
+ var currentTabPage = this.CurrentTabPage;
+
//列幅、列並びを他のタブに設定
foreach (TabPage tb in ListTab.TabPages)
{
- if (!tb.Equals(_curTab))
+ if (!tb.Equals(currentTabPage))
{
if (tb.Tag != null && tb.Controls.Count > 0)
{
{
List<long> _autoPopulatedUserIds = new List<long>();
- var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Item1] : null;
+ var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Value.StatusId] : null;
if (replyToPost != null)
{
if (statusText.StartsWith($"@{replyToPost.ScreenName} ", StringComparison.Ordinal))
statusText = statusText.Substring(replyToPost.ScreenName.Length + 2);
_autoPopulatedUserIds.Add(replyToPost.UserId);
- foreach (var reply in replyToPost.ReplyToList)
+ foreach (var (userId, screenName) in replyToPost.ReplyToList)
{
- if (statusText.StartsWith($"@{reply.Item2} ", StringComparison.Ordinal))
+ if (statusText.StartsWith($"@{screenName} ", StringComparison.Ordinal))
{
- statusText = statusText.Substring(reply.Item2.Length + 2);
- _autoPopulatedUserIds.Add(reply.Item1);
+ statusText = statusText.Substring(screenName.Length + 2);
+ _autoPopulatedUserIds.Add(userId);
}
}
}
disableFooter = true;
// 自分宛のリプライの場合は先頭の「@screen_name 」の部分を除去する (in_reply_to_status_id は維持される)
- if (this.inReplyTo != null && this.inReplyTo.Item2 == this.tw.Username)
+ if (this.inReplyTo != null && this.inReplyTo.Value.ScreenName == this.tw.Username)
{
var mentionSelf = $"@{this.tw.Username} ";
if (statusText.StartsWith(mentionSelf, StringComparison.OrdinalIgnoreCase))
private void CreateCache(int startIndex, int endIndex)
{
- var tabInfo = this._statuses.Tabs[this._curTab.Text];
+ var tabInfo = this.CurrentTab;
if (tabInfo.AllCount == 0)
return;
var cacheLength = endIndex - startIndex + 1;
+ var tabPage = this.CurrentTabPage;
var posts = tabInfo[startIndex, endIndex]; //配列で取得
var listItems = Enumerable.Range(0, cacheLength)
- .Select(x => this.CreateItem(this._curTab, posts[x], startIndex + x))
+ .Select(x => this.CreateItem(tabPage, posts[x], startIndex + x))
.ToArray();
var listCache = new ListViewItemCache
//未読管理していなかったら既読として扱う
if (!_statuses.Tabs[Tab.Text].UnreadManage || !SettingManager.Common.UnreadManage) read = true;
ChangeItemStyleRead(read, itm, Post, null);
- if (Tab.Equals(_curTab)) ColorizeList(itm, Index);
+ if (Tab.Equals(this.CurrentTabPage)) ColorizeList(itm, Index);
return itm;
}
internal void DoTabSearch(string searchWord, bool caseSensitive, bool useRegex, SEARCHTYPE searchType)
{
- var tab = this._statuses.Tabs[this._curTab.Text];
+ var tab = this.CurrentTab;
if (tab.AllCount == 0)
{
this.AddNewTab(resultTab, startup: false);
this._statuses.AddTab(resultTab);
- var targetTab = this._statuses.Tabs[this._curTab.Text];
+ var targetTab = this.CurrentTab;
Func<string, bool> stringComparer;
try
private void JumpUnreadMenuItem_Click(object sender, EventArgs e)
{
- int bgnIdx = ListTab.TabPages.IndexOf(_curTab);
+ int bgnIdx = ListTab.TabPages.IndexOf(this.CurrentTabPage);
if (ImageSelector.Enabled)
return;
private async void StatusOpenMenuItem_Click(object sender, EventArgs e)
{
- if (_curList.SelectedIndices.Count > 0 && _statuses.Tabs[_curTab.Text].TabType != MyCommon.TabUsageType.DirectMessage)
+ var tab = this.CurrentTab;
+ if (_curList.SelectedIndices.Count > 0 && tab.TabType != MyCommon.TabUsageType.DirectMessage)
{
- var post = _statuses.Tabs[_curTab.Text][_curList.SelectedIndices[0]];
+ var post = tab[_curList.SelectedIndices[0]];
await this.OpenUriInBrowserAsync(MyCommon.GetStatusUrl(post));
}
}
- private async void FavorareMenuItem_Click(object sender, EventArgs e)
- {
- if (_curList.SelectedIndices.Count > 0)
- {
- PostClass post = _statuses.Tabs[_curTab.Text][_curList.SelectedIndices[0]];
- await this.OpenUriInBrowserAsync(Properties.Resources.FavstarUrl + "users/" + post.ScreenName + "/recent");
- }
- }
-
private async void VerUpMenuItem_Click(object sender, EventArgs e)
=> await this.CheckNewVersion(false);
return;
}
+ if (startup && versionInfo.Version <= SettingManager.Common.SkipUpdateVersion)
+ return;
+
using (var dialog = new UpdateDialog())
{
dialog.SummaryText = string.Format(Properties.Resources.CheckNewVersionText3,
{
await this.OpenUriInBrowserAsync(versionInfo.DownloadUri.OriginalString);
}
+ else if (dialog.SkipButtonPressed)
+ {
+ SettingManager.Common.SkipUpdateVersion = versionInfo.Version;
+ this.ModifySettingCommon = true;
+ }
}
}
catch (Exception)
}
public string createDetailHtml(string orgdata)
- {
- if (SettingManager.Local.UseTwemoji)
- orgdata = EmojiFormatter.ReplaceEmojiToImg(orgdata);
-
- return detailHtmlFormatHeader + orgdata + detailHtmlFormatFooter;
- }
+ => detailHtmlFormatHeader + orgdata + detailHtmlFormatFooter;
private Task DispSelectedPost()
=> this.DispSelectedPost(false);
private async void ListTab_KeyDown(object sender, KeyEventArgs e)
{
- if (ListTab.SelectedTab != null)
+ var tab = this.CurrentTab;
+ if (tab.TabType == MyCommon.TabUsageType.PublicSearch)
{
- if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch)
- {
- Control pnl = ListTab.SelectedTab.Controls["panelSearch"];
- if (pnl.Controls["comboSearch"].Focused ||
- pnl.Controls["comboLang"].Focused ||
- pnl.Controls["buttonSearch"].Focused) return;
- }
-
- if (e.Control || e.Shift || e.Alt)
- this._anchorFlag = false;
+ Control pnl = ListTab.SelectedTab.Controls["panelSearch"];
+ if (pnl.Controls["comboSearch"].Focused ||
+ pnl.Controls["comboLang"].Focused ||
+ pnl.Controls["buttonSearch"].Focused) return;
+ }
- if (CommonKeyDown(e.KeyData, FocusedControl.ListTab, out var asyncTask))
- {
- e.Handled = true;
- e.SuppressKeyPress = true;
- }
+ if (e.Control || e.Shift || e.Alt)
+ this._anchorFlag = false;
- if (asyncTask != null)
- await asyncTask;
+ if (CommonKeyDown(e.KeyData, FocusedControl.ListTab, out var asyncTask))
+ {
+ e.Handled = true;
+ e.SuppressKeyPress = true;
}
+
+ if (asyncTask != null)
+ await asyncTask;
}
- private ShortcutCommand[] shortcutCommands = new ShortcutCommand[0];
+ private ShortcutCommand[] shortcutCommands = Array.Empty<ShortcutCommand>();
private void InitializeShortcuts()
{
.FocusedOn(FocusedControl.ListTab)
.Do(() => {
this._anchorFlag = false;
- if (ListTab.SelectedTab != null)
+ var tab = this.CurrentTab;
+ var tabtype = tab.TabType;
+ if (tabtype == MyCommon.TabUsageType.Related || tabtype == MyCommon.TabUsageType.UserTimeline || tabtype == MyCommon.TabUsageType.PublicSearch || tabtype == MyCommon.TabUsageType.SearchResults)
{
- var tabtype = _statuses.Tabs[ListTab.SelectedTab.Text].TabType;
- if (tabtype == MyCommon.TabUsageType.Related || tabtype == MyCommon.TabUsageType.UserTimeline || tabtype == MyCommon.TabUsageType.PublicSearch || tabtype == MyCommon.TabUsageType.SearchResults)
- {
- var relTp = ListTab.SelectedTab;
- RemoveSpecifiedTab(relTp.Text, false);
- SaveConfigsTabs();
- }
+ RemoveSpecifiedTab(tab.TabName, false);
+ SaveConfigsTabs();
}
}),
ShortcutCommand.Create(Keys.Control | Keys.Up)
.FocusedOn(FocusedControl.StatusText)
- .Do(() => {
- if (!string.IsNullOrWhiteSpace(StatusText.Text))
- {
- var inReplyToStatusId = this.inReplyTo?.Item1;
- var inReplyToScreenName = this.inReplyTo?.Item2;
- _history[_hisIdx] = new StatusTextHistory(StatusText.Text, inReplyToStatusId, inReplyToScreenName);
- }
- _hisIdx -= 1;
- if (_hisIdx < 0) _hisIdx = 0;
-
- var historyItem = this._history[this._hisIdx];
- if (historyItem.inReplyToId != null)
- this.inReplyTo = Tuple.Create(historyItem.inReplyToId.Value, historyItem.inReplyToName);
- else
- this.inReplyTo = null;
- StatusText.Text = historyItem.status;
- StatusText.SelectionStart = StatusText.Text.Length;
- }),
+ .Do(() => this.StatusTextHistoryBack()),
ShortcutCommand.Create(Keys.Control | Keys.Down)
.FocusedOn(FocusedControl.StatusText)
- .Do(() => {
- if (!string.IsNullOrWhiteSpace(StatusText.Text))
- {
- var inReplyToStatusId = this.inReplyTo?.Item1;
- var inReplyToScreenName = this.inReplyTo?.Item2;
- _history[_hisIdx] = new StatusTextHistory(StatusText.Text, inReplyToStatusId, inReplyToScreenName);
- }
- _hisIdx += 1;
- if (_hisIdx > _history.Count - 1) _hisIdx = _history.Count - 1;
-
- var historyItem = this._history[this._hisIdx];
- if (historyItem.inReplyToId != null)
- this.inReplyTo = Tuple.Create(historyItem.inReplyToId.Value, historyItem.inReplyToName);
- else
- this.inReplyTo = null;
- StatusText.Text = historyItem.status;
- StatusText.SelectionStart = StatusText.Text.Length;
- }),
+ .Do(() => this.StatusTextHistoryForward()),
ShortcutCommand.Create(Keys.Control | Keys.PageUp, Keys.Control | Keys.P)
.FocusedOn(FocusedControl.StatusText)
.Do(() => this.CopyIdUri()),
ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.F)
- .OnlyWhen(() => this.ListTab.SelectedTab != null &&
- this._statuses.Tabs[this.ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch)
- .Do(() => this.ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus()),
+ .OnlyWhen(() => this.CurrentTab.TabType == MyCommon.TabUsageType.PublicSearch)
+ .Do(() => this.CurrentTabPage.Controls["panelSearch"].Controls["comboSearch"].Focus()),
ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.S)
.Do(() => this.FavoriteChange(FavAdd: false)),
ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.H)
.Do(() => this.doMoveToRTHome()),
- ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.O)
- .Do(() => this.FavorareMenuItem_Click(null, null)),
-
ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.Up)
.FocusedOn(FocusedControl.StatusText)
.Do(() => {
.Do(() => this.SetSortLastColumn()),
ShortcutCommand.Create(Keys.Control | Keys.Alt | Keys.S)
+ .FocusedOn(FocusedControl.ListTab)
.Do(() => this.FavoritesRetweetOfficial()),
ShortcutCommand.Create(Keys.Control | Keys.Alt | Keys.R)
+ .FocusedOn(FocusedControl.ListTab)
.Do(() => this.FavoritesRetweetUnofficial()),
ShortcutCommand.Create(Keys.Control | Keys.Alt | Keys.H)
+ .FocusedOn(FocusedControl.ListTab)
.Do(() => this.OpenUserAppointUrl()),
ShortcutCommand.Create(Keys.Alt | Keys.Shift | Keys.R)
{
string clstr = "";
StringBuilder sb = new StringBuilder();
+ var tab = this.CurrentTab;
bool IsProtected = false;
- bool isDm = false;
- if (this._curTab != null && this._statuses.GetTabByName(this._curTab.Text) != null) isDm = this._statuses.GetTabByName(this._curTab.Text).TabType == MyCommon.TabUsageType.DirectMessage;
+ var isDm = tab.TabType == MyCommon.TabUsageType.DirectMessage;
foreach (int idx in _curList.SelectedIndices)
{
- PostClass post = _statuses.Tabs[_curTab.Text][idx];
+ var post = tab[idx];
if (post.IsDeleted) continue;
if (!isDm)
{
private void CopyIdUri()
{
- if (this._curTab == null)
- return;
-
- var tab = this._statuses.GetTabByName(this._curTab.Text);
+ var tab = this.CurrentTab;
if (tab == null || tab is DirectMessagesTabModel)
return;
stp = -1;
}
+ var tab = this.CurrentTab;
for (int idx = fIdx; idx != toIdx; idx += stp)
{
- if (_statuses.Tabs[_curTab.Text][idx].IsFav)
+ if (tab[idx].IsFav)
{
SelectListItem(_curList, idx);
_curList.EnsureVisible(idx);
if (this._curList.SelectedIndices.Count == 0)
return;
- var tab = this._statuses.Tabs[this._curTab.Text];
+ var tab = this.CurrentTab;
// Directタブは対象外(見つかるはずがない)
if (tab.TabType == MyCommon.TabUsageType.DirectMessage)
if (_curList.SelectedIndices.Count == 0 || _curPost == null)
return;
- var tab = this._statuses.Tabs[this._curTab.Text];
+ var tab = this.CurrentTab;
var selectedIndex = this._curList.SelectedIndices[0];
int fIdx, toIdx, stp;
if (this._curList.SelectedIndices.Count == 0)
return;
- var tab = this._statuses.Tabs[this._curTab.Text];
+ var tab = this.CurrentTab;
var selectedIndex = this._curList.SelectedIndices[0];
int fIdx, toIdx, stp;
post.RetweetedBy == _anchorPost.ScreenName ||
post.ScreenName == _anchorPost.RetweetedBy ||
(!string.IsNullOrEmpty(post.RetweetedBy) && post.RetweetedBy == _anchorPost.RetweetedBy) ||
- _anchorPost.ReplyToList.Any(x => x.Item1 == post.UserId) ||
- _anchorPost.ReplyToList.Any(x => x.Item1 == post.RetweetedByUserId) ||
- post.ReplyToList.Any(x => x.Item1 == _anchorPost.UserId) ||
- post.ReplyToList.Any(x => x.Item1 == _anchorPost.RetweetedByUserId))
+ _anchorPost.ReplyToList.Any(x => x.UserId == post.UserId) ||
+ _anchorPost.ReplyToList.Any(x => x.UserId == post.RetweetedByUserId) ||
+ post.ReplyToList.Any(x => x.UserId == _anchorPost.UserId) ||
+ post.ReplyToList.Any(x => x.UserId == _anchorPost.RetweetedByUserId))
{
SelectListItem(_curList, idx);
_curList.EnsureVisible(idx);
private void GoAnchor()
{
if (_anchorPost == null) return;
- int idx = _statuses.Tabs[_curTab.Text].IndexOf(_anchorPost.StatusId);
+ int idx = this.CurrentTab.IndexOf(_anchorPost.StatusId);
if (idx == -1) return;
SelectListItem(_curList, idx);
{
if (_curPost == null) return;
- TabModel curTabClass = _statuses.Tabs[_curTab.Text];
+ var curTabClass = this.CurrentTab;
if (curTabClass.TabType == MyCommon.TabUsageType.PublicSearch && _curPost.InReplyToStatusId == null && _curPost.TextFromApi.Contains("@"))
{
{
replyChains = new Stack<ReplyChain>();
}
- replyChains.Push(new ReplyChain(_curPost.StatusId, _curPost.InReplyToStatusId.Value, _curTab));
+ replyChains.Push(new ReplyChain(_curPost.StatusId, _curPost.InReplyToStatusId.Value, this.CurrentTabPage));
int inReplyToIndex;
string inReplyToTabName;
TabPage tabPage = this.ListTab.TabPages.Cast<TabPage>().First((tp) => { return tp.Text == inReplyToTabName; });
DetailsListView listView = (DetailsListView)tabPage.Tag;
- if (_curTab != tabPage)
+ if (this.CurrentTabPage != tabPage)
{
this.ListTab.SelectTab(tabPage);
}
{
if (_curPost == null) return;
- TabModel curTabClass = _statuses.Tabs[_curTab.Text];
+ var curTabClass = this.CurrentTab;
//Dictionary<long, PostClass> curTabPosts = curTabClass.Posts;
if (parallel)
private void PushSelectPostChain()
{
+ var currentTabPage = this.CurrentTabPage;
int count = this.selectPostChains.Count;
if (count > 0)
{
var (tabPage, post) = this.selectPostChains.Peek();
- if (tabPage == this._curTab)
+ if (tabPage == currentTabPage)
{
if (post == this._curPost) return; //最新の履歴と同一
if (post == null) this.selectPostChains.Pop(); //置き換えるため削除
}
}
if (count >= 2500) TrimPostChain();
- this.selectPostChains.Push((this._curTab, this._curPost));
+ this.selectPostChains.Push((currentTabPage, this._curPost));
}
private void TrimPostChain()
{
if (this.selectPostChains.Count <= 2000) return;
- var p = new Stack<ValueTuple<TabPage, PostClass>>(2000);
+ var p = new Stack<(TabPage, PostClass)>(2000);
for (int i = 0; i < 2000; i++)
{
p.Push(this.selectPostChains.Pop());
var tabs = this.ListTab.TabPages.Cast<TabPage>()
.Select(x => this._statuses.Tabs[x.Text])
- .Concat(new[] { this._statuses.GetTabByType(MyCommon.TabUsageType.Mute) });
+ .Append(this._statuses.GetTabByType(MyCommon.TabUsageType.Mute));
foreach (var tab in tabs)
{
private void SaveLogMenuItem_Click(object sender, EventArgs e)
{
+ var tab = this.CurrentTab;
+
DialogResult rslt = MessageBox.Show(string.Format(Properties.Resources.SaveLogMenuItem_ClickText1, Environment.NewLine),
Properties.Resources.SaveLogMenuItem_ClickText2,
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
//All
for (int idx = 0; idx < _curList.VirtualListSize; idx++)
{
- PostClass post = _statuses.Tabs[_curTab.Text][idx];
+ var post = tab[idx];
string protect = "";
if (post.IsProtect) protect = "Protect";
sw.WriteLine(post.Nickname + "\t" +
{
foreach (int idx in _curList.SelectedIndices)
{
- PostClass post = _statuses.Tabs[_curTab.Text][idx];
+ var post = tab[idx];
string protect = "";
if (post.IsProtect) protect = "Protect";
sw.WriteLine(post.Nickname + "\t" +
}
private void ListTab_DoubleClick(object sender, MouseEventArgs e)
- => this.TabRename(this.ListTab.SelectedTab.Text, out var _);
+ => this.TabRename(this.CurrentTabName, out var _);
private void ListTab_MouseDown(object sender, MouseEventArgs e)
{
//isReply:true=@,false=DM
if (!StatusText.Enabled) return;
if (_curList == null) return;
- if (_curTab == null) return;
if (!this.ExistCurrentPost) return;
+ var tab = this.CurrentTab;
+
// 複数あてリプライはReplyではなく通常ポスト
//↑仕様変更で全部リプライ扱いでOK(先頭ドット付加しない)
//090403暫定でドットを付加しないようにだけ修正。単独と複数の処理は統合できると思われる。
if (_curList.SelectedIndices.Count == 1 && !isAll && this.ExistCurrentPost)
{
// 単独ユーザー宛リプライまたはDM
- if ((_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.DirectMessage && isAuto) || (!isAuto && !isReply))
+ if ((tab.TabType == MyCommon.TabUsageType.DirectMessage && isAuto) || (!isAuto && !isReply))
{
// ダイレクトメッセージ
this.inReplyTo = null;
//空の場合
var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
var inReplyToScreenName = this._curPost.ScreenName;
- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
// ステータステキストが入力されていない場合先頭に@ユーザー名を追加する
StatusText.Text = "@" + _curPost.ScreenName + " ";
//1件選んでEnter or DoubleClick
if (StatusText.Text.Contains("@" + _curPost.ScreenName + " "))
{
- if (this.inReplyTo?.Item2 == _curPost.ScreenName)
+ if (this.inReplyTo?.ScreenName == _curPost.ScreenName)
{
//返信先書き換え
var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
var inReplyToScreenName = this._curPost.ScreenName;
- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
}
return;
}
// 単独リプライ
var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
var inReplyToScreenName = this._curPost.ScreenName;
- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
StatusText.Text = "@" + _curPost.ScreenName + " " + StatusText.Text;
}
}
}
for (int cnt = 0; cnt < _curList.SelectedIndices.Count; cnt++)
{
- PostClass post = _statuses.Tabs[_curTab.Text][_curList.SelectedIndices[cnt]];
+ PostClass post = tab[_curList.SelectedIndices[cnt]];
if (!sTxt.Contains("@" + post.ScreenName + " "))
{
sTxt = sTxt.Insert(2, "@" + post.ScreenName + " ");
int sidx = StatusText.SelectionStart;
for (int cnt = 0; cnt < _curList.SelectedIndices.Count; cnt++)
{
- PostClass post = _statuses.Tabs[_curTab.Text][_curList.SelectedIndices[cnt]];
+ PostClass post = tab[_curList.SelectedIndices[cnt]];
if (!ids.Contains("@" + post.ScreenName + " ") && post.UserId != tw.UserId)
{
ids += "@" + post.ScreenName + " ";
}
if (isAll)
{
- foreach (string nm in post.ReplyToList.Select(x => x.Item2))
+ foreach (var (_, screenName) in post.ReplyToList)
{
- if (!ids.Contains("@" + nm + " ") &&
- !nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
+ if (!ids.Contains("@" + screenName + " ") &&
+ !screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
{
- Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
+ Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
if (m.Success)
ids += "@" + m.Result("${id}") + " ";
else
- ids += "@" + nm + " ";
+ ids += "@" + screenName + " ";
}
}
}
{
ids += "@" + post.ScreenName + " ";
}
- foreach (string nm in post.ReplyToList.Select(x => x.Item2))
+ foreach (var (_, screenName) in post.ReplyToList)
{
- if (!ids.Contains("@" + nm + " ") &&
- !nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
+ if (!ids.Contains("@" + screenName + " ") &&
+ !screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
{
- Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
+ Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
if (m.Success)
ids += "@" + m.Result("${id}") + " ";
else
- ids += "@" + nm + " ";
+ ids += "@" + screenName + " ";
}
}
if (!string.IsNullOrEmpty(post.RetweetedBy))
//未入力の場合のみ返信先付加
var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
var inReplyToScreenName = this._curPost.ScreenName;
- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
StatusText.Text = ids;
StatusText.SelectionStart = ids.Length;
{
//右クリックの場合はタブ名が設定済。アプリケーションキーの場合は現在のタブを対象とする
if (string.IsNullOrEmpty(_rclickTabName) || sender != ContextMenuTabProperty)
- {
- if (ListTab != null && ListTab.SelectedTab != null)
- _rclickTabName = ListTab.SelectedTab.Text;
- else
- return;
- }
+ _rclickTabName = this.CurrentTabName;
if (_statuses == null) return;
if (_statuses.Tabs == null) return;
ListTab.TabPages[idx].ImageIndex = -1;
}
- if (_curTab.Text == tabName)
+ if (this.CurrentTabName == tabName)
{
this.PurgeListViewItemCache();
_curList.Refresh();
private void DeleteTabMenuItem_Click(object sender, EventArgs e)
{
- if (string.IsNullOrEmpty(_rclickTabName) || sender == this.DeleteTbMenuItem) _rclickTabName = ListTab.SelectedTab.Text;
+ if (string.IsNullOrEmpty(_rclickTabName) || sender == this.DeleteTbMenuItem)
+ _rclickTabName = this.CurrentTabName;
RemoveSpecifiedTab(_rclickTabName, true);
SaveConfigsTabs();
if (tabUsage == MyCommon.TabUsageType.Lists)
{
ListTab.SelectedIndex = ListTab.TabPages.Count - 1;
- var listTab = this._statuses.Tabs[this._curTab.Text];
- await this.RefreshTabAsync(listTab);
+ await this.RefreshTabAsync(this.CurrentTab);
}
}
}
if (!SelectTab(out var tabName)) return;
fltDialog.SetCurrent(tabName);
- if (_statuses.Tabs[_curTab.Text][idx].RetweetedId == null)
+ var post = this.CurrentTab[idx];
+ if (post.RetweetedId == null)
{
- fltDialog.AddNewFilter(_statuses.Tabs[_curTab.Text][idx].ScreenName, _statuses.Tabs[_curTab.Text][idx].TextFromApi);
+ fltDialog.AddNewFilter(post.ScreenName, post.TextFromApi);
}
else
{
- fltDialog.AddNewFilter(_statuses.Tabs[_curTab.Text][idx].RetweetedBy, _statuses.Tabs[_curTab.Text][idx].TextFromApi);
+ fltDialog.AddNewFilter(post.RetweetedBy, post.TextFromApi);
}
fltDialog.ShowDialog(this);
this.TopMost = SettingManager.Common.AlwaysTop;
this.ApplyPostFilters();
SaveConfigsTabs();
- if (this.ListTab.SelectedTab != null &&
- ((DetailsListView)this.ListTab.SelectedTab.Tag).SelectedIndices.Count > 0)
- {
- _curPost = _statuses.Tabs[this.ListTab.SelectedTab.Text][((DetailsListView)this.ListTab.SelectedTab.Tag).SelectedIndices[0]];
- }
+
+ if (_curList.SelectedIndices.Count > 0)
+ _curPost = this.CurrentTab[_curList.SelectedIndices[0]];
}
protected override bool ProcessDialogKey(Keys keyData)
return true;
}
}
- else if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch &&
- (ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focused ||
- ListTab.SelectedTab.Controls["panelSearch"].Controls["comboLang"].Focused))
+ else
{
- this.SearchButton_Click(ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"], null);
- return true;
+ var tab = this.CurrentTab;
+ if (tab.TabType == MyCommon.TabUsageType.PublicSearch)
+ {
+ var tabPage = this.CurrentTabPage;
+ if (tabPage.Controls["panelSearch"].Controls["comboSearch"].Focused ||
+ tabPage.Controls["panelSearch"].Controls["comboLang"].Focused)
+ {
+ this.SearchButton_Click(tabPage.Controls["panelSearch"].Controls["comboSearch"], null);
+ return true;
+ }
+ }
}
}
//未選択なら処理終了
if (_curList.SelectedIndices.Count == 0) return;
- var tab = this._statuses.Tabs[this._curTab.Text];
+ var tab = this.CurrentTab;
var screenNameArray = this._curList.SelectedIndices.Cast<int>()
.Select(x => tab[x])
.Select(x => x.RetweetedId != null ? x.RetweetedBy : x.ScreenName)
if (this._curList.SelectedIndices.Count == 0)
return;
- var tab = this._statuses.Tabs[this._curTab.Text];
+ var tab = this.CurrentTab;
var sourceArray = this._curList.SelectedIndices.Cast<int>()
.Select(x => tab[x].Source).ToArray();
}
_statuses.ClearTabIds(tabName);
- if (ListTab.SelectedTab.Text == tabName)
+ if (this.CurrentTabName == tabName)
{
_anchorPost = null;
_anchorFlag = false;
{
ur += tab.UnreadCount;
al += tab.AllCount;
- if (_curTab != null && tab.TabName.Equals(_curTab.Text))
+ if (tab.TabName == this.CurrentTabName)
{
tur = tab.UnreadCount;
tal = tab.AllCount;
private void SetApiStatusLabel(string endpointName = null)
{
- if (_curTab == null)
- {
- this.toolStripApiGauge.ApiEndpoint = null;
- }
- else
- {
- var tabType = _statuses.Tabs[_curTab.Text].TabType;
+ var tabType = this.CurrentTab.TabType;
- if (endpointName == null)
+ if (endpointName == null)
+ {
+ // 表示中のタブに応じて更新
+ switch (tabType)
{
- // 表示中のタブに応じて更新
- switch (tabType)
- {
- case MyCommon.TabUsageType.Home:
- case MyCommon.TabUsageType.UserDefined:
- endpointName = "/statuses/home_timeline";
- break;
-
- case MyCommon.TabUsageType.Mentions:
- endpointName = "/statuses/mentions_timeline";
- break;
+ case MyCommon.TabUsageType.Home:
+ case MyCommon.TabUsageType.UserDefined:
+ endpointName = "/statuses/home_timeline";
+ break;
- case MyCommon.TabUsageType.Favorites:
- endpointName = "/favorites/list";
- break;
+ case MyCommon.TabUsageType.Mentions:
+ endpointName = "/statuses/mentions_timeline";
+ break;
- case MyCommon.TabUsageType.DirectMessage:
- endpointName = "/direct_messages/events/list";
- break;
+ case MyCommon.TabUsageType.Favorites:
+ endpointName = "/favorites/list";
+ break;
- case MyCommon.TabUsageType.UserTimeline:
- endpointName = "/statuses/user_timeline";
- break;
+ case MyCommon.TabUsageType.DirectMessage:
+ endpointName = "/direct_messages/events/list";
+ break;
- case MyCommon.TabUsageType.Lists:
- endpointName = "/lists/statuses";
- break;
+ case MyCommon.TabUsageType.UserTimeline:
+ endpointName = "/statuses/user_timeline";
+ break;
- case MyCommon.TabUsageType.PublicSearch:
- endpointName = "/search/tweets";
- break;
+ case MyCommon.TabUsageType.Lists:
+ endpointName = "/lists/statuses";
+ break;
- case MyCommon.TabUsageType.Related:
- endpointName = "/statuses/show/:id";
- break;
+ case MyCommon.TabUsageType.PublicSearch:
+ endpointName = "/search/tweets";
+ break;
- default:
- break;
- }
+ case MyCommon.TabUsageType.Related:
+ endpointName = "/statuses/show/:id";
+ break;
- this.toolStripApiGauge.ApiEndpoint = endpointName;
+ default:
+ break;
}
- else
- {
- // 表示中のタブに関連する endpoint であれば更新
- var update = false;
- switch (endpointName)
- {
- case "/statuses/home_timeline":
- update = tabType == MyCommon.TabUsageType.Home ||
- tabType == MyCommon.TabUsageType.UserDefined;
- break;
+ this.toolStripApiGauge.ApiEndpoint = endpointName;
+ }
+ else
+ {
+ // 表示中のタブに関連する endpoint であれば更新
+ var update = false;
- case "/statuses/mentions_timeline":
- update = tabType == MyCommon.TabUsageType.Mentions;
- break;
+ switch (endpointName)
+ {
+ case "/statuses/home_timeline":
+ update = tabType == MyCommon.TabUsageType.Home ||
+ tabType == MyCommon.TabUsageType.UserDefined;
+ break;
- case "/favorites/list":
- update = tabType == MyCommon.TabUsageType.Favorites;
- break;
+ case "/statuses/mentions_timeline":
+ update = tabType == MyCommon.TabUsageType.Mentions;
+ break;
- case "/direct_messages/events/list":
- update = tabType == MyCommon.TabUsageType.DirectMessage;
- break;
+ case "/favorites/list":
+ update = tabType == MyCommon.TabUsageType.Favorites;
+ break;
- case "/statuses/user_timeline":
- update = tabType == MyCommon.TabUsageType.UserTimeline;
- break;
+ case "/direct_messages/events/list":
+ update = tabType == MyCommon.TabUsageType.DirectMessage;
+ break;
- case "/lists/statuses":
- update = tabType == MyCommon.TabUsageType.Lists;
- break;
+ case "/statuses/user_timeline":
+ update = tabType == MyCommon.TabUsageType.UserTimeline;
+ break;
- case "/search/tweets":
- update = tabType == MyCommon.TabUsageType.PublicSearch;
- break;
+ case "/lists/statuses":
+ update = tabType == MyCommon.TabUsageType.Lists;
+ break;
- case "/statuses/show/:id":
- update = tabType == MyCommon.TabUsageType.Related;
- break;
+ case "/search/tweets":
+ update = tabType == MyCommon.TabUsageType.PublicSearch;
+ break;
- default:
- break;
- }
+ case "/statuses/show/:id":
+ update = tabType == MyCommon.TabUsageType.Related;
+ break;
- if (update)
- {
- this.toolStripApiGauge.ApiEndpoint = endpointName;
- }
+ default:
+ break;
+ }
+
+ if (update)
+ {
+ this.toolStripApiGauge.ApiEndpoint = endpointName;
}
}
}
if (m != null)
{
- var inReplyToScreenName = this.inReplyTo.Item2;
+ var inReplyToScreenName = this.inReplyTo.Value.ScreenName;
if (StatusText.StartsWith("@", StringComparison.Ordinal))
{
if (StatusText.StartsWith("@" + inReplyToScreenName, StringComparison.Ordinal)) return;
private async void IsgdToolStripMenuItem_Click(object sender, EventArgs e)
=> await this.UrlConvertAsync(MyCommon.UrlConverter.Isgd);
- private async void TwurlnlToolStripMenuItem_Click(object sender, EventArgs e)
- => await this.UrlConvertAsync(MyCommon.UrlConverter.Twurl);
-
private async void UxnuMenuItem_Click(object sender, EventArgs e)
=> await this.UrlConvertAsync(MyCommon.UrlConverter.Uxnu);
this.PurgeListViewItemCache();
- _curTab = _tab;
+ this._statuses.SelectTab(_tab.Text);
_curList = (DetailsListView)_tab.Tag;
if (_curList.SelectedIndices.Count > 0)
statusHtml = Regex.Replace(statusHtml, "<a class=\"mention\" href=\"(?<href>.+?)\">(?<text>.+?)</a>", "${text}");
// ハッシュタグ
statusHtml = Regex.Replace(statusHtml, "<a class=\"hashtag\" href=\"(?<href>.+?)\">(?<text>.+?)</a>", "${text}");
+ // 絵文字
+ statusHtml = Regex.Replace(statusHtml, "<img class=\"emoji\" src=\".+?\" alt=\"(?<text>.+?)\" />", "${text}");
// <br> 除去
if (multiline)
// 投稿時に in_reply_to_status_id を付加する
var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
var inReplyToScreenName = this._curPost.ScreenName;
- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
StatusText.Text += " RT @" + _curPost.ScreenName + ": " + rtdata;
private void PublicSearchQueryMenuItem_Click(object sender, EventArgs e)
{
- if (ListTab.SelectedTab != null)
- {
- if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType != MyCommon.TabUsageType.PublicSearch) return;
- ListTab.SelectedTab.Controls["panelSearch"].Controls["comboSearch"].Focus();
- }
+ var tab = this.CurrentTab;
+ if (tab.TabType != MyCommon.TabUsageType.PublicSearch) return;
+ this.CurrentTabPage.Controls["panelSearch"].Controls["comboSearch"].Focus();
}
private void StatusLabel_DoubleClick(object sender, EventArgs e)
private void MenuItemOperate_DropDownOpening(object sender, EventArgs e)
{
- if (ListTab.SelectedTab == null) return;
- if (_statuses == null || _statuses.Tabs == null || !_statuses.Tabs.ContainsKey(ListTab.SelectedTab.Text)) return;
if (!this.ExistCurrentPost)
{
this.ReplyOpMenuItem.Enabled = false;
this.UnreadOpMenuItem.Enabled = true;
}
- if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.DirectMessage || !this.ExistCurrentPost || _curPost.IsDm)
+ var tab = this.CurrentTab;
+ if (tab.TabType == MyCommon.TabUsageType.DirectMessage || !this.ExistCurrentPost || _curPost.IsDm)
{
this.FavOpMenuItem.Enabled = false;
this.UnFavOpMenuItem.Enabled = false;
this.OpenStatusOpMenuItem.Enabled = false;
- this.OpenFavotterOpMenuItem.Enabled = false;
this.ShowRelatedStatusesMenuItem2.Enabled = false;
this.RtOpMenuItem.Enabled = false;
this.RtUnOpMenuItem.Enabled = false;
this.FavOpMenuItem.Enabled = true;
this.UnFavOpMenuItem.Enabled = true;
this.OpenStatusOpMenuItem.Enabled = true;
- this.OpenFavotterOpMenuItem.Enabled = true;
this.ShowRelatedStatusesMenuItem2.Enabled = true; //PublicSearchの時問題出るかも
if (!_curPost.CanRetweetBy(this.twitterApi.CurrentUserId))
}
}
- if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType != MyCommon.TabUsageType.Favorites)
+ if (tab.TabType != MyCommon.TabUsageType.Favorites)
{
this.RefreshPrevOpMenuItem.Enabled = true;
}
{
UndoRemoveTabMenuItem.Enabled = true;
}
- if (ListTab.SelectedTab != null)
- {
- if (_statuses.Tabs[ListTab.SelectedTab.Text].TabType == MyCommon.TabUsageType.PublicSearch)
- PublicSearchQueryMenuItem.Enabled = true;
- else
- PublicSearchQueryMenuItem.Enabled = false;
- }
+
+ if (this.CurrentTab.TabType == MyCommon.TabUsageType.PublicSearch)
+ PublicSearchQueryMenuItem.Enabled = true;
else
- {
PublicSearchQueryMenuItem.Enabled = false;
- }
+
if (!this.ExistCurrentPost)
{
this.CopySTOTMenuItem.Enabled = false;
await this.InvokeAsync(async () =>
{
this._statuses.RemovePostFromAllTabs(e.StatusId, setIsDeleted: true);
- if (_curTab != null && _statuses.Tabs[_curTab.Text].Contains(e.StatusId))
+ if (this.CurrentTab.Contains(e.StatusId))
{
this.PurgeListViewItemCache();
- ((DetailsListView)_curTab.Tag).Update();
+ this._curList.Update();
if (_curPost != null && _curPost.StatusId == e.StatusId)
await this.DispSelectedPost(true);
}
NotifyEvent(ev);
if (ev.Event == "favorite" || ev.Event == "unfavorite")
{
- if (_curTab != null && _statuses.Tabs[_curTab.Text].Contains(ev.Id))
+ if (this.CurrentTab.Contains(ev.Id))
{
this.PurgeListViewItemCache();
- ((DetailsListView)_curTab.Tag).Update();
+ this._curList.Update();
}
if (ev.Event == "unfavorite" && ev.Username.Equals(tw.Username, StringComparison.InvariantCultureIgnoreCase))
{
}
}
- private async void OpenOwnFavedMenuItem_Click(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(tw.Username))
- await this.OpenUriInBrowserAsync(Properties.Resources.FavstarUrl + "users/" + tw.Username + "/recent");
- }
-
private async void OpenOwnHomeMenuItem_Click(object sender, EventArgs e)
=> await this.OpenUriInBrowserAsync(MyCommon.TwitterUrl + tw.Username);
}
}
- private async void UserFavorareToolStripMenuItem_Click(object sender, EventArgs e)
- {
- string id = GetUserIdFromCurPostOrInput("Show Favstar");
- if (!string.IsNullOrEmpty(id))
- {
- await this.OpenUriInBrowserAsync(Properties.Resources.FavstarUrl + "users/" + id + "/recent");
- }
- }
-
private void SystemEvents_PowerModeChanged(object sender, Microsoft.Win32.PowerModeChangedEventArgs e)
{
if (e.Mode == Microsoft.Win32.PowerModes.Resume) osResumed = true;