}
}
- private TabPage _curTab;
private int _curItemIndex;
private DetailsListView _curList;
private PostClass _curPost;
private Stack<ReplyChain> replyChains; //[, ]でのリプライ移動の履歴
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
{
//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);
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)
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)
{
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;
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)
{
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 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 = Array.Empty<ShortcutCommand>();
.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();
}
}),
.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)),
{
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;
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()
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;
}
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 (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;
}
}
}
this.PurgeListViewItemCache();
- _curTab = _tab;
+ this._statuses.SelectTab(_tab.Text);
_curList = (DetailsListView)_tab.Tag;
if (_curList.SelectedIndices.Count > 0)
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;
}
}
- 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))
{