}
private int _curItemIndex;
- private DetailsListView _curList;
private PostClass _curPost;
private bool _isColumnChanged = false;
public TabPage CurrentTabPage
=> this.ListTab.TabPages.Cast<TabPage>().First(x => x.Text == this.CurrentTabName);
+ public DetailsListView CurrentListView
+ => (DetailsListView)this.CurrentTabPage.Tag;
+
//検索処理タイプ
internal enum SEARCHTYPE
{
else
{
var idx = 0;
- foreach (var curListColumn in this._curList.Columns.Cast<ColumnHeader>())
+ foreach (var curListColumn in this.CurrentListView.Columns.Cast<ColumnHeader>())
{
columns[idx].Width = curListColumn.Width;
columns[idx].DisplayIndex = curListColumn.DisplayIndex;
else
{
var idx = 0;
- foreach (var curListColumn in this._curList.Columns.Cast<ColumnHeader>())
+ foreach (var curListColumn in this.CurrentListView.Columns.Cast<ColumnHeader>())
{
columns[idx].Width = curListColumn.Width;
columns[idx].DisplayIndex = curListColumn.DisplayIndex;
//Win32Api.SetProxy(HttpConnection.ProxyType.Specified, "127.0.0.1", 8080, "user", "pass")
Microsoft.Win32.SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
- Microsoft.Win32.SystemEvents.TimeChanged += SystemEvents_TimeChanged;
Regex.CacheSize = 100;
this._statuses.SelectTab(this.ListTab.SelectedTab.Text);
_curItemIndex = -1;
- _curList = (DetailsListView)this.CurrentTabPage.Tag;
MyCommon.TwitterApiInfo.AccessLimitUpdated += TwitterApiStatus_AccessLimitUpdated;
+ Microsoft.Win32.SystemEvents.TimeChanged += SystemEvents_TimeChanged;
if (SettingManager.Common.TabIconDisp)
{
private void RefreshTimeline()
{
var curTabModel = this.CurrentTab;
+ var curListView = this.CurrentListView;
// 現在表示中のタブのスクロール位置を退避
- var curListScroll = this.SaveListViewScroll(this._curList, curTabModel);
+ var curListScroll = this.SaveListViewScroll(curListView, curTabModel);
// 各タブのリスト上の選択位置などを退避
var listSelections = this.SaveListViewSelection();
{
using (ControlTransaction.Update(listView))
{
- if (listView == this._curList)
+ if (listView == curListView)
this.PurgeListViewItemCache();
try
}
// スクロール位置を復元
- this.RestoreListViewScroll(this._curList, curTabModel, curListScroll);
+ this.RestoreListViewScroll(curListView, curTabModel, curListScroll);
//新着通知
NotifyNewPosts(notifyPosts, soundFile, addCount, newMentionOrDm);
private void MyList_SelectedIndexChanged(object sender, EventArgs e)
{
- if (_curList == null || !_curList.Equals(sender) || _curList.SelectedIndices.Count != 1) return;
+ var listView = this.CurrentListView;
+ if (!listView.Equals(sender) || listView.SelectedIndices.Count != 1) return;
- _curItemIndex = _curList.SelectedIndices[0];
- if (_curItemIndex > _curList.VirtualListSize - 1) return;
+ _curItemIndex = listView.SelectedIndices[0];
+ if (_curItemIndex > listView.VirtualListSize - 1) return;
try
{
if (!listCache.TryGetValue(Index, out var itm, out var post))
return;
- ChangeItemStyleRead(Read, itm, post, this._curList);
+ ChangeItemStyleRead(Read, itm, post, (DetailsListView)listCache.TargetList);
}
private void ChangeItemStyleRead(bool Read, ListViewItem Item, PostClass Post, DetailsListView DList)
return;
var index = listCache.StartIndex;
+ var listView = (DetailsListView)listCache.TargetList;
foreach (var cachedPost in listCache.Post)
{
var backColor = this.JudgeColor(_post, cachedPost);
- this._curList.ChangeItemBackColor(index++, backColor);
+ listView.ChangeItemBackColor(index++, backColor);
}
}
if (Item.Index == -1)
Item.BackColor = JudgeColor(_post, tPost);
else
- _curList.ChangeItemBackColor(Item.Index, JudgeColor(_post, tPost));
+ this.CurrentListView.ChangeItemBackColor(Item.Index, JudgeColor(_post, tPost));
}
private Color JudgeColor(PostClass BasePost, PostClass TargetPost)
_history.Add(new StatusTextHistory());
_hisIdx = _history.Count - 1;
if (!SettingManager.Common.FocusLockToStatusText)
- ((Control)ListTab.SelectedTab.Tag).Focus();
+ this.CurrentListView.Focus();
urlUndoBuffer = null;
UrlUndoToolStripMenuItem.Enabled = false; //Undoをできないように設定
this.RefreshTimeline();
- if (this._curList != null && this.CurrentTabName == tab.TabName)
+ if (this.CurrentTabName == tab.TabName)
{
- using (ControlTransaction.Update(this._curList))
+ using (ControlTransaction.Update(this.CurrentListView))
{
var idx = tab.IndexOf(statusId);
if (idx != -1)
this.RefreshTimeline();
- if (this._curList != null && this.CurrentTabName == tab.TabName)
+ if (this.CurrentTabName == tab.TabName)
{
if (tab.TabType == MyCommon.TabUsageType.Favorites)
{
}
else
{
- using (ControlTransaction.Update(this._curList))
+ using (ControlTransaction.Update(this.CurrentListView))
{
foreach (var statusId in successIds)
{
this.RefreshTimeline();
this.PurgeListViewItemCache();
- this._curList?.Refresh();
+ this.CurrentListView.Refresh();
}
catch (WebApiException ex)
{
}
this.PurgeListViewItemCache();
-
- this._curList?.Refresh();
+ this.CurrentListView.Refresh();
}
catch (WebApiException ex)
{
private async Task FavoriteChange(bool FavAdd, bool multiFavoriteChangeDialogEnable = true)
{
var tab = this.CurrentTab;
+ var listView = this.CurrentListView;
//trueでFavAdd,falseでFavRemove
- if (tab.TabType == MyCommon.TabUsageType.DirectMessage || _curList.SelectedIndices.Count == 0
+ if (tab.TabType == MyCommon.TabUsageType.DirectMessage || listView.SelectedIndices.Count == 0
|| !this.ExistCurrentPost) return;
- if (this._curList.SelectedIndices.Count > 1)
+ if (listView.SelectedIndices.Count > 1)
{
if (FavAdd)
{
if (FavAdd)
{
- var selectedPost = this.GetCurTabPost(_curList.SelectedIndices[0]);
+ var selectedPost = this.GetCurTabPost(listView.SelectedIndices[0]);
if (selectedPost.IsFav)
{
this.StatusLabel.Text = Properties.Resources.FavAddToolStripMenuItem_ClickText4;
}
else
{
- var selectedPosts = this._curList.SelectedIndices.Cast<int>()
+ var selectedPosts = listView.SelectedIndices.Cast<int>()
.Select(x => this.GetCurTabPost(x))
.Where(x => x.IsFav);
private async void MoveToHomeToolStripMenuItem_Click(object sender, EventArgs e)
{
- if (_curList.SelectedIndices.Count > 0)
- await this.OpenUriInBrowserAsync(MyCommon.TwitterUrl + GetCurTabPost(_curList.SelectedIndices[0]).ScreenName);
- else if (_curList.SelectedIndices.Count == 0)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count > 0)
+ await this.OpenUriInBrowserAsync(MyCommon.TwitterUrl + GetCurTabPost(listView.SelectedIndices[0]).ScreenName);
+ else if (listView.SelectedIndices.Count == 0)
await this.OpenUriInBrowserAsync(MyCommon.TwitterUrl);
}
private async void MoveToFavToolStripMenuItem_Click(object sender, EventArgs e)
{
- if (_curList.SelectedIndices.Count > 0)
- await this.OpenUriInBrowserAsync(MyCommon.TwitterUrl + "#!/" + GetCurTabPost(_curList.SelectedIndices[0]).ScreenName + "/favorites");
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count > 0)
+ await this.OpenUriInBrowserAsync(MyCommon.TwitterUrl + "#!/" + GetCurTabPost(listView.SelectedIndices[0]).ScreenName + "/favorites");
}
private void TweenMain_ClientSizeChanged(object sender, EventArgs e)
private void SetSortColumnByDisplayIndex(int columnIndex)
{
// 表示上の列の位置から ColumnHeader を求める
- var col = this._curList.Columns.Cast<ColumnHeader>()
+ var col = this.CurrentListView.Columns.Cast<ColumnHeader>()
.FirstOrDefault(x => x.DisplayIndex == columnIndex);
if (col == null)
private void SetSortLastColumn()
{
// 表示上の最後列にある ColumnHeader を求める
- var col = this._curList.Columns.Cast<ColumnHeader>()
+ var col = this.CurrentListView.Columns.Cast<ColumnHeader>()
.OrderByDescending(x => x.DisplayIndex)
.First();
this._statuses.ToggleSortOrder(sortColumn);
this.InitColumnText();
- var list = this._curList;
+ var list = this.CurrentListView;
if (_iconCol)
{
list.Columns[0].Text = this.ColumnText[0];
private async Task doStatusDelete()
{
- if (this._curList == null)
- return;
+ var currentListView = this.CurrentListView;
- if (this._curList.SelectedIndices.Count == 0)
+ if (currentListView.SelectedIndices.Count == 0)
return;
- var posts = this._curList.SelectedIndices.Cast<int>()
+ var posts = currentListView.SelectedIndices.Cast<int>()
.Select(x => this.GetCurTabPost(x))
.ToArray();
if (ret != DialogResult.OK)
return;
- var focusedIndex = this._curList.FocusedItem?.Index ?? this._curList.TopItem?.Index ?? 0;
+ var focusedIndex = currentListView.FocusedItem?.Index ?? currentListView.TopItem?.Index ?? 0;
using (ControlTransaction.Cursor(this, Cursors.WaitCursor))
{
private void ReadedStripMenuItem_Click(object sender, EventArgs e)
{
- using (ControlTransaction.Update(this._curList))
+ var listView = this.CurrentListView;
+ using (ControlTransaction.Update(listView))
{
var tab = this.CurrentTab;
- foreach (int idx in _curList.SelectedIndices)
+ foreach (int idx in listView.SelectedIndices)
{
var post = tab[idx];
this._statuses.SetReadAllTab(post.StatusId, read: true);
private void UnreadStripMenuItem_Click(object sender, EventArgs e)
{
- using (ControlTransaction.Update(this._curList))
+ var listView = this.CurrentListView;
+ using (ControlTransaction.Update(listView))
{
var tab = this.CurrentTab;
- foreach (int idx in _curList.SelectedIndices)
+ foreach (int idx in listView.SelectedIndices)
{
var post = tab[idx];
this._statuses.SetReadAllTab(post.StatusId, read: false);
SetNotifyIconText();
this.PurgeListViewItemCache();
- _curList?.Refresh();
+ this.CurrentListView.Refresh();
ListTab.Refresh();
_hookGlobalHotkey.UnregisterAllOriginalHotkey();
if (this.CurrentTabPage.Equals(_tabPage))
{
_curItemIndex = -1;
- _curList = null;
_curPost = null;
}
this.PurgeListViewItemCache();
private void SetListProperty()
{
- //削除などで見つからない場合は処理せず
- if (_curList == null) return;
if (!_isColumnChanged) return;
- int[] dispOrder = new int[_curList.Columns.Count];
- for (int i = 0; i < _curList.Columns.Count; i++)
+ var currentListView = this.CurrentListView;
+
+ int[] dispOrder = new int[currentListView.Columns.Count];
+ for (int i = 0; i < currentListView.Columns.Count; i++)
{
- for (int j = 0; j < _curList.Columns.Count; j++)
+ for (int j = 0; j < currentListView.Columns.Count; j++)
{
- if (_curList.Columns[j].DisplayIndex == i)
+ if (currentListView.Columns[j].DisplayIndex == i)
{
dispOrder[i] = j;
break;
for (int i = 0; i < lst.Columns.Count; i++)
{
lst.Columns[dispOrder[i]].DisplayIndex = i;
- lst.Columns[i].Width = _curList.Columns[i].Width;
+ lst.Columns[i].Width = currentListView.Columns[i].Width;
}
}
}
private void MyList_CacheVirtualItems(object sender, CacheVirtualItemsEventArgs e)
{
- if (sender != this._curList)
+ if (sender != this.CurrentListView)
return;
var listCache = this._listItemCache;
var listCache = new ListViewItemCache
{
- TargetList = this._curList,
+ TargetList = this.CurrentListView,
StartIndex = startIndex,
EndIndex = endIndex,
Post = posts,
return;
}
- var selectedIndex = this._curList.SelectedIndices.Count != 0 ? this._curList.SelectedIndices[0] : -1;
+ var listView = this.CurrentListView;
+ var selectedIndex = listView.SelectedIndices.Count != 0 ? listView.SelectedIndices[0] : -1;
int startIndex;
switch (searchType)
return;
}
- this.SelectListItem(this._curList, foundIndex);
- this._curList.EnsureVisible(foundIndex);
+ this.SelectListItem(listView, foundIndex);
+ listView.EnsureVisible(foundIndex);
}
private void MenuItemSubSearch_Click(object sender, EventArgs e)
private async void StatusOpenMenuItem_Click(object sender, EventArgs e)
{
var tab = this.CurrentTab;
- if (_curList.SelectedIndices.Count > 0 && tab.TabType != MyCommon.TabUsageType.DirectMessage)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count > 0 && tab.TabType != MyCommon.TabUsageType.DirectMessage)
{
- var post = tab[_curList.SelectedIndices[0]];
+ var post = tab[listView.SelectedIndices[0]];
await this.OpenUriInBrowserAsync(MyCommon.GetStatusUrl(post));
}
}
private async Task DispSelectedPost(bool forceupdate)
{
- if (_curList.SelectedIndices.Count == 0 || _curPost == null)
+ if (this.CurrentListView.SelectedIndices.Count == 0 || _curPost == null)
return;
var oldDisplayPost = this.displayPost;
ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.Up)
.FocusedOn(FocusedControl.StatusText)
.Do(() => {
- if (_curList != null && _curList.VirtualListSize != 0 &&
- _curList.SelectedIndices.Count > 0 && _curList.SelectedIndices[0] > 0)
+ var listView = this.CurrentListView;
+ if (listView.VirtualListSize != 0 &&
+ listView.SelectedIndices.Count > 0 && listView.SelectedIndices[0] > 0)
{
- var idx = _curList.SelectedIndices[0] - 1;
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ var idx = listView.SelectedIndices[0] - 1;
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
}
}),
ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.Down)
.FocusedOn(FocusedControl.StatusText)
.Do(() => {
- if (_curList != null && _curList.VirtualListSize != 0 && _curList.SelectedIndices.Count > 0
- && _curList.SelectedIndices[0] < _curList.VirtualListSize - 1)
+ var listView = this.CurrentListView;
+ if (listView.VirtualListSize != 0 && listView.SelectedIndices.Count > 0
+ && listView.SelectedIndices[0] < listView.VirtualListSize - 1)
{
- var idx = _curList.SelectedIndices[0] + 1;
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ var idx = listView.SelectedIndices[0] + 1;
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
}
}),
var tab = this.CurrentTab;
bool IsProtected = false;
var isDm = tab.TabType == MyCommon.TabUsageType.DirectMessage;
- foreach (int idx in _curList.SelectedIndices)
+ foreach (int idx in this.CurrentListView.SelectedIndices)
{
var post = tab[idx];
if (post.IsDeleted) continue;
return;
var copyUrls = new List<string>();
- foreach (int idx in _curList.SelectedIndices)
+ foreach (int idx in this.CurrentListView.SelectedIndices)
{
var post = tab[idx];
copyUrls.Add(MyCommon.GetStatusUrl(post));
private void GoFav(bool forward)
{
- if (_curList.VirtualListSize == 0) return;
+ var listView = this.CurrentListView;
+ if (listView.VirtualListSize == 0) return;
int fIdx = 0;
int toIdx = 0;
int stp = 1;
if (forward)
{
- if (_curList.SelectedIndices.Count == 0)
+ if (listView.SelectedIndices.Count == 0)
{
fIdx = 0;
}
else
{
- fIdx = _curList.SelectedIndices[0] + 1;
- if (fIdx > _curList.VirtualListSize - 1) return;
+ fIdx = listView.SelectedIndices[0] + 1;
+ if (fIdx > listView.VirtualListSize - 1) return;
}
- toIdx = _curList.VirtualListSize;
+ toIdx = listView.VirtualListSize;
stp = 1;
}
else
{
- if (_curList.SelectedIndices.Count == 0)
+ if (listView.SelectedIndices.Count == 0)
{
- fIdx = _curList.VirtualListSize - 1;
+ fIdx = listView.VirtualListSize - 1;
}
else
{
- fIdx = _curList.SelectedIndices[0] - 1;
+ fIdx = listView.SelectedIndices[0] - 1;
if (fIdx < 0) return;
}
toIdx = -1;
{
if (tab[idx].IsFav)
{
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
break;
}
}
private void GoSamePostToAnotherTab(bool left)
{
- if (this._curList.SelectedIndices.Count == 0)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count == 0)
return;
var tab = this.CurrentTab;
if (tab.TabType == MyCommon.TabUsageType.DirectMessage)
return;
- var selectedIndex = this._curList.SelectedIndices[0];
+ var selectedIndex = listView.SelectedIndices[0];
var selectedStatusId = tab.GetStatusIdAt(selectedIndex);
int fIdx, toIdx, stp;
if (foundIndex != -1)
{
ListTab.SelectedIndex = tabidx;
- SelectListItem(_curList, foundIndex);
- _curList.EnsureVisible(foundIndex);
+ listView = this.CurrentListView;
+ SelectListItem(listView, foundIndex);
+ listView.EnsureVisible(foundIndex);
return;
}
}
private void GoPost(bool forward)
{
- if (_curList.SelectedIndices.Count == 0 || _curPost == null)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count == 0 || _curPost == null)
return;
var tab = this.CurrentTab;
- var selectedIndex = this._curList.SelectedIndices[0];
+ var selectedIndex = listView.SelectedIndices[0];
int fIdx, toIdx, stp;
{
if (post.ScreenName == name)
{
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
break;
}
}
{
if (post.RetweetedBy == name)
{
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
break;
}
}
private void GoRelPost(bool forward)
{
- if (this._curList.SelectedIndices.Count == 0)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count == 0)
return;
var tab = this.CurrentTab;
- var selectedIndex = this._curList.SelectedIndices[0];
+ var selectedIndex = listView.SelectedIndices[0];
int fIdx, toIdx, stp;
post.ReplyToList.Any(x => x.UserId == _anchorPost.UserId) ||
post.ReplyToList.Any(x => x.UserId == _anchorPost.RetweetedByUserId))
{
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
break;
}
}
int idx = this.CurrentTab.IndexOf(_anchorPost.StatusId);
if (idx == -1) return;
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ var listView = this.CurrentListView;
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
}
private void GoTopEnd(bool GoTop)
{
- if (_curList.VirtualListSize == 0)
+ var listView = this.CurrentListView;
+ if (listView.VirtualListSize == 0)
return;
ListViewItem _item;
if (GoTop)
{
- _item = _curList.GetItemAt(0, 25);
+ _item = listView.GetItemAt(0, 25);
if (_item == null)
idx = 0;
else
}
else
{
- _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 1);
+ _item = listView.GetItemAt(0, listView.ClientSize.Height - 1);
if (_item == null)
- idx = _curList.VirtualListSize - 1;
+ idx = listView.VirtualListSize - 1;
else
idx = _item.Index;
}
- SelectListItem(_curList, idx);
+ SelectListItem(listView, idx);
}
private void GoMiddle()
{
- if (_curList.VirtualListSize == 0)
+ var listView = this.CurrentListView;
+ if (listView.VirtualListSize == 0)
return;
ListViewItem _item;
int idx2;
int idx3;
- _item = _curList.GetItemAt(0, 0);
+ _item = listView.GetItemAt(0, 0);
if (_item == null)
{
idx1 = 0;
idx1 = _item.Index;
}
- _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 1);
+ _item = listView.GetItemAt(0, listView.ClientSize.Height - 1);
if (_item == null)
{
- idx2 = _curList.VirtualListSize - 1;
+ idx2 = listView.VirtualListSize - 1;
}
else
{
}
idx3 = (idx1 + idx2) / 2;
- SelectListItem(_curList, idx3);
+ SelectListItem(listView, idx3);
}
private void GoLast()
{
- if (_curList.VirtualListSize == 0) return;
+ var listView = this.CurrentListView;
+ if (listView.VirtualListSize == 0) return;
if (_statuses.SortOrder == SortOrder.Ascending)
{
- SelectListItem(_curList, _curList.VirtualListSize - 1);
- _curList.EnsureVisible(_curList.VirtualListSize - 1);
+ SelectListItem(listView, listView.VirtualListSize - 1);
+ listView.EnsureVisible(listView.VirtualListSize - 1);
}
else
{
- SelectListItem(_curList, 0);
- _curList.EnsureVisible(0);
+ SelectListItem(listView, 0);
+ listView.EnsureVisible(0);
}
}
private void MoveTop()
{
- if (_curList.SelectedIndices.Count == 0) return;
- int idx = _curList.SelectedIndices[0];
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count == 0) return;
+ int idx = listView.SelectedIndices[0];
if (_statuses.SortOrder == SortOrder.Ascending)
{
- _curList.EnsureVisible(_curList.VirtualListSize - 1);
+ listView.EnsureVisible(listView.VirtualListSize - 1);
}
else
{
- _curList.EnsureVisible(0);
+ listView.EnsureVisible(0);
}
- _curList.EnsureVisible(idx);
+ listView.EnsureVisible(idx);
}
private async Task GoInReplyToPostTree()
_curPost.InReplyToUser = post.InReplyToUser;
_curPost.IsReply = post.IsReply;
this.PurgeListViewItemCache();
- _curList.RedrawItems(_curItemIndex, _curItemIndex, false);
+ this.CurrentListView.RedrawItems(_curItemIndex, _curItemIndex, false);
}
catch (WebApiException ex)
{
if (post == null) post = postList.FirstOrDefault((pst) => { return pst.Tab != curTabClass; });
if (post == null) post = postList.First();
this.ListTab.SelectTab(this.ListTab.TabPages.Cast<TabPage>().First((tp) => { return tp.Text == post.Tab.TabName; }));
- DetailsListView listView = (DetailsListView)this.ListTab.SelectedTab.Tag;
+ var listView = this.CurrentListView;
SelectListItem(listView, post.Index);
listView.EnsureVisible(post.Index);
}
{
var post = posts.First();
this.ListTab.SelectTab(this.ListTab.TabPages.Cast<TabPage>().First((tp) => { return tp.Text == post.Tab.TabName; }));
- DetailsListView listView = (DetailsListView)this.ListTab.SelectedTab.Tag;
+ var listView = this.CurrentListView;
SelectListItem(listView, post.Index);
listView.EnsureVisible(post.Index);
}
{
replyChains = null;
}
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ var listView = this.CurrentListView;
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
}
}
else
{
int idx = _statuses.Tabs[ListTab.TabPages[tabidx].Text].IndexOf(statusId);
ListTab.SelectedIndex = tabidx;
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ var listView = this.CurrentListView;
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
return true;
}
}
{
int idx = _statuses.Tabs[ListTab.TabPages[tabidx].Text].IndexOf(statusId);
ListTab.SelectedIndex = tabidx;
- SelectListItem(_curList, idx);
- _curList.EnsureVisible(idx);
+ var listView = this.CurrentListView;
+ SelectListItem(listView, idx);
+ listView.EnsureVisible(idx);
return true;
}
}
if (!SaveFileDialog1.ValidateNames) return;
using (StreamWriter sw = new StreamWriter(SaveFileDialog1.FileName, false, Encoding.UTF8))
{
+ var listView = this.CurrentListView;
if (rslt == DialogResult.Yes)
{
//All
- for (int idx = 0; idx < _curList.VirtualListSize; idx++)
+ for (int idx = 0; idx < listView.VirtualListSize; idx++)
{
var post = tab[idx];
string protect = "";
}
else
{
- foreach (int idx in _curList.SelectedIndices)
+ foreach (int idx in listView.SelectedIndices)
{
var post = tab[idx];
string protect = "";
//isAuto:true=先頭に挿入、false=カーソル位置に挿入
//isReply:true=@,false=DM
if (!StatusText.Enabled) return;
- if (_curList == null) return;
if (!this.ExistCurrentPost) return;
var tab = this.CurrentTab;
+ var listView = this.CurrentListView;
// 複数あてリプライはReplyではなく通常ポスト
//↑仕様変更で全部リプライ扱いでOK(先頭ドット付加しない)
//090403暫定でドットを付加しないようにだけ修正。単独と複数の処理は統合できると思われる。
//090513 all @ replies 廃止の仕様変更によりドット付加に戻し(syo68k)
- if (_curList.SelectedIndices.Count > 0)
+ if (listView.SelectedIndices.Count > 0)
{
// アイテムが1件以上選択されている
- if (_curList.SelectedIndices.Count == 1 && !isAll && this.ExistCurrentPost)
+ if (listView.SelectedIndices.Count == 1 && !isAll && this.ExistCurrentPost)
{
// 単独ユーザー宛リプライまたはDM
if ((tab.TabType == MyCommon.TabUsageType.DirectMessage && isAuto) || (!isAuto && !isReply))
sTxt = ". " + sTxt;
this.inReplyTo = null;
}
- for (int cnt = 0; cnt < _curList.SelectedIndices.Count; cnt++)
+ for (int cnt = 0; cnt < listView.SelectedIndices.Count; cnt++)
{
- PostClass post = tab[_curList.SelectedIndices[cnt]];
+ PostClass post = tab[listView.SelectedIndices[cnt]];
if (!sTxt.Contains("@" + post.ScreenName + " "))
{
sTxt = sTxt.Insert(2, "@" + post.ScreenName + " ");
else
{
//C-S-r or C-r
- if (_curList.SelectedIndices.Count > 1)
+ if (listView.SelectedIndices.Count > 1)
{
//複数ポスト選択
string ids = "";
int sidx = StatusText.SelectionStart;
- for (int cnt = 0; cnt < _curList.SelectedIndices.Count; cnt++)
+ for (int cnt = 0; cnt < listView.SelectedIndices.Count; cnt++)
{
- PostClass post = tab[_curList.SelectedIndices[cnt]];
+ PostClass post = tab[listView.SelectedIndices[cnt]];
if (!ids.Contains("@" + post.ScreenName + " ") && post.UserId != tw.UserId)
{
ids += "@" + post.ScreenName + " ";
if (this.CurrentTabName == tabName)
{
this.PurgeListViewItemCache();
- _curList.Refresh();
+ this.CurrentListView.Refresh();
}
SetMainWindowTitle();
fltDialog.Owner = this;
//選択発言を元にフィルタ追加
- foreach (int idx in _curList.SelectedIndices)
+ foreach (int idx in this.CurrentListView.SelectedIndices)
{
//タブ選択(or追加)
if (!SelectTab(out var tabName)) return;
this.ApplyPostFilters();
SaveConfigsTabs();
- if (_curList.SelectedIndices.Count > 0)
- _curPost = this.CurrentTab[_curList.SelectedIndices[0]];
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count > 0)
+ _curPost = this.CurrentTab[listView.SelectedIndices[0]];
}
protected override bool ProcessDialogKey(Keys keyData)
private void IDRuleMenuItem_Click(object sender, EventArgs e)
{
+ var listView = this.CurrentListView;
+
//未選択なら処理終了
- if (_curList.SelectedIndices.Count == 0) return;
+ if (listView.SelectedIndices.Count == 0) return;
var tab = this.CurrentTab;
- var screenNameArray = this._curList.SelectedIndices.Cast<int>()
+ var screenNameArray = listView.SelectedIndices.Cast<int>()
.Select(x => tab[x])
.Select(x => x.RetweetedId != null ? x.RetweetedBy : x.ScreenName)
.ToArray();
private void SourceRuleMenuItem_Click(object sender, EventArgs e)
{
- if (this._curList.SelectedIndices.Count == 0)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count == 0)
return;
var tab = this.CurrentTab;
- var sourceArray = this._curList.SelectedIndices.Cast<int>()
+ var sourceArray = listView.SelectedIndices.Cast<int>()
.Select(x => tab[x].Source).ToArray();
this.AddFilterRuleBySource(sourceArray);
else
{
// ListView上でのCtrl+A
- NativeMethods.SelectAllItems(this._curList);
+ NativeMethods.SelectAllItems(this.CurrentListView);
}
}
int idx1;
int idx2;
- if (_curList.SelectedIndices.Count == 0) return;
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count == 0) return;
- int idx = _curList.SelectedIndices[0];
+ int idx = listView.SelectedIndices[0];
- _item = _curList.GetItemAt(0, 25);
+ _item = listView.GetItemAt(0, 25);
if (_item == null)
idx1 = 0;
else
idx1 = _item.Index;
- _item = _curList.GetItemAt(0, _curList.ClientSize.Height - 1);
+ _item = listView.GetItemAt(0, listView.ClientSize.Height - 1);
if (_item == null)
- idx2 = _curList.VirtualListSize - 1;
+ idx2 = listView.VirtualListSize - 1;
else
idx2 = _item.Index;
idx -= Math.Abs(idx1 - idx2) / 2;
if (idx < 0) idx = 0;
- _curList.EnsureVisible(_curList.VirtualListSize - 1);
- _curList.EnsureVisible(idx);
+ listView.EnsureVisible(listView.VirtualListSize - 1);
+ listView.EnsureVisible(idx);
}
private async void OpenURLMenuItem_Click(object sender, EventArgs e)
this.PurgeListViewItemCache();
this._statuses.SelectTab(_tab.Text);
- _curList = (DetailsListView)_tab.Tag;
- if (_curList.SelectedIndices.Count > 0)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count > 0)
{
- _curItemIndex = _curList.SelectedIndices[0];
+ _curItemIndex = listView.SelectedIndices[0];
_curPost = GetCurTabPost(_curItemIndex);
}
else
if (_iconCol)
{
- ((DetailsListView)_tab.Tag).Columns[1].Text = ColumnText[2];
+ listView.Columns[1].Text = ColumnText[2];
}
else
{
- for (int i = 0; i < _curList.Columns.Count; i++)
+ for (int i = 0; i < listView.Columns.Count; i++)
{
- ((DetailsListView)_tab.Tag).Columns[i].Text = ColumnText[i];
+ listView.Columns[i].Text = ColumnText[i];
}
}
}
_DoFavRetweetFlags = false;
return;
}
- if (_curList.SelectedIndices.Count > 15)
+
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count > 15)
{
MessageBox.Show(Properties.Resources.RetweetLimitText);
_DoFavRetweetFlags = false;
return;
}
- else if (_curList.SelectedIndices.Count > 1)
+ else if (listView.SelectedIndices.Count > 1)
{
string QuestionText = Properties.Resources.RetweetQuestion2;
if (_DoFavRetweetFlags) QuestionText = Properties.Resources.FavoriteRetweetQuestionText1;
}
var statusIds = new List<long>();
- foreach (int idx in _curList.SelectedIndices)
+ foreach (int idx in listView.SelectedIndices)
{
PostClass post = GetCurTabPost(idx);
if (post.CanRetweetBy(this.twitterApi.CurrentUserId))
private async Task doMoveToRTHome()
{
- if (_curList.SelectedIndices.Count > 0)
+ var listView = this.CurrentListView;
+ if (listView.SelectedIndices.Count > 0)
{
- PostClass post = GetCurTabPost(_curList.SelectedIndices[0]);
+ PostClass post = GetCurTabPost(listView.SelectedIndices[0]);
if (post.RetweetedId != null)
{
- await this.OpenUriInBrowserAsync("https://twitter.com/" + GetCurTabPost(_curList.SelectedIndices[0]).RetweetedBy);
+ await this.OpenUriInBrowserAsync("https://twitter.com/" + GetCurTabPost(listView.SelectedIndices[0]).RetweetedBy);
}
}
}
{
TimelinePanel.Visible = true;
TimelinePanel.Enabled = true;
- ((DetailsListView)ListTab.SelectedTab.Tag).Focus();
+ this.CurrentListView.Focus();
}
private void ImageSelector_FilePickDialogOpening(object sender, EventArgs e)
if (this.CurrentTab.Contains(e.StatusId))
{
this.PurgeListViewItemCache();
- this._curList.Update();
+ this.CurrentListView.Update();
if (_curPost != null && _curPost.StatusId == e.StatusId)
await this.DispSelectedPost(true);
}
if (this.CurrentTab.Contains(ev.Id))
{
this.PurgeListViewItemCache();
- this._curList.Update();
+ this.CurrentListView.Update();
}
if (ev.Event == "unfavorite" && ev.Username.Equals(tw.Username, StringComparison.InvariantCultureIgnoreCase))
{
{
// タイムゾーンの変更を反映
this.PurgeListViewItemCache();
- this._curList.Refresh();
+ this.CurrentListView.Refresh();
await this.DispSelectedPost(forceupdate: true);
}
}
}
- _curList?.Refresh();
+ this.CurrentListView.Refresh();
ModifySettingCommon = true;
}