{
TabClass tb;
if (!_tabs.TryGetValue(TabName, out tb)) throw new ArgumentException("TabName=" + TabName + " is not contained.");
- var id = tb.GetId(Index);
- if (id < 0) throw new ArgumentException("Index can't find. Index=" + Index.ToString() + "/TabName=" + TabName);
- try
- {
- return tb.Posts[tb.GetId(Index)];
- }
- catch (Exception ex)
- {
- throw new Exception("Index=" + Index.ToString() + "/TabName=" + TabName, ex);
- }
+ return tb[Index];
}
}
{
TabClass tb;
if (!_tabs.TryGetValue(TabName, out tb)) throw new ArgumentException("TabName=" + TabName + " is not contained.");
- var length = EndIndex - StartIndex + 1;
- var posts = new PostClass[length];
- for (int i = 0; i < length; i++)
- {
- posts[i] = tb.Posts[tb.GetId(StartIndex + i)];
- }
- return posts;
+ return tb[StartIndex, EndIndex];
}
}
public long[] GetId(string TabName, ListView.SelectedIndexCollection IndexCollection)
{
- if (IndexCollection.Count == 0) return null;
-
- var tb = _tabs[TabName];
- var Ids = new long[IndexCollection.Count];
- for (int i = 0; i < Ids.Length; i++)
- {
- Ids[i] = tb.GetId(IndexCollection[i]);
- }
- return Ids;
+ return _tabs[TabName].GetId(IndexCollection);
}
public long GetId(string TabName, int Index)
public int[] IndexOf(string TabName, long[] Ids)
{
- if (Ids == null) return null;
- var idx = new int[Ids.Length];
- var tb = _tabs[TabName];
- for (int i = 0; i < Ids.Length; i++)
- {
- idx[i] = tb.IndexOf(Ids[i]);
- }
- return idx;
+ return _tabs[TabName].IndexOf(Ids);
}
public int IndexOf(string TabName, long Id)
_innerPosts.Clear();
}
+ public PostClass this[int Index]
+ {
+ get
+ {
+ var id = GetId(Index);
+ if (id < 0) throw new ArgumentException("Index can't find. Index=" + Index.ToString() + "/TabName=" + TabName);
+ try
+ {
+ return Posts[id];
+ }
+ catch (Exception ex)
+ {
+ throw new Exception("Index=" + Index.ToString() + "/TabName=" + TabName, ex);
+ }
+ }
+ }
+
+ public PostClass[] this[int StartIndex, int EndIndex]
+ {
+ get
+ {
+ var length = EndIndex - StartIndex + 1;
+ var posts = new PostClass[length];
+ for (int i = 0; i < length; i++)
+ {
+ posts[i] = Posts[GetId(StartIndex + i)];
+ }
+ return posts;
+ }
+ }
+
+ public long[] GetId(ListView.SelectedIndexCollection IndexCollection)
+ {
+ if (IndexCollection.Count == 0) return null;
+
+ var Ids = new long[IndexCollection.Count];
+ for (int i = 0; i < Ids.Length; i++)
+ {
+ Ids[i] = GetId(IndexCollection[i]);
+ }
+ return Ids;
+ }
+
public long GetId(int Index)
{
return Index < _ids.Count ? _ids[Index] : -1;
}
+ public int[] IndexOf(long[] Ids)
+ {
+ if (Ids == null) return null;
+ var idx = new int[Ids.Length];
+ for (int i = 0; i < Ids.Length; i++)
+ {
+ idx[i] = IndexOf(Ids[i]);
+ }
+ return idx;
+ }
+
public int IndexOf(long ID)
{
return _ids.IndexOf(ID);
//アイコン描画不具合あり?
}
this.SelectListItem(lst,
- _statuses.IndexOf(tab.Text, selId[tab.Text]),
- _statuses.IndexOf(tab.Text, focusedId[tab.Text]));
+ tabInfo.IndexOf(selId[tab.Text]),
+ tabInfo.IndexOf(focusedId[tab.Text]));
}
}
if (tabInfo.UnreadCount > 0)
if (MyCommon._endingFlag) return;
foreach (TabPage tab in ListTab.TabPages)
{
- DetailsListView lst = (DetailsListView)tab.Tag;
+ var lst = (DetailsListView)tab.Tag;
+ var tabInfo = _statuses.Tabs[tab.Text];
if (lst.SelectedIndices.Count > 0 && lst.SelectedIndices.Count < 61)
{
- selId.Add(tab.Text, _statuses.GetId(tab.Text, lst.SelectedIndices));
+ selId.Add(tab.Text, tabInfo.GetId(lst.SelectedIndices));
}
else
{
var fIds = new long[2]; // 0 = focus, 1 = selection mark
var item = lst.FocusedItem;
- fIds[0] = (item != null) ? _statuses.GetId(tab.Text, item.Index) : -2;
+ fIds[0] = (item != null) ? tabInfo.GetId(item.Index) : -2;
var mIdx = lst.SelectionMark;
- fIds[1] = (mIdx > -1) ? _statuses.GetId(tab.Text, mIdx) : -2;
+ fIds[1] = (mIdx > -1) ? tabInfo.GetId(mIdx) : -2;
focusedId.Add(tab.Text, fIds);
}
private void ChangeCacheStyleRead(bool Read, int Index)
{
+ var tabInfo = _statuses.Tabs[_curTab.Text];
//Read:true=既読 false=未読
//未読管理していなかったら既読として扱う
- if (!_statuses.Tabs[_curTab.Text].UnreadManage ||
+ if (!tabInfo.UnreadManage ||
!SettingDialog.UnreadManage) Read = true;
//対象の特定
if (itm == null || post == null)
{
itm = ((DetailsListView)_curTab.Tag).Items[Index];
- post = _statuses[_curTab.Text, Index];
+ post = tabInfo[Index];
}
ChangeItemStyleRead(Read, itm, post, ((DetailsListView)_curTab.Tag));
foreach (TabPage tab in ListTab.TabPages)
{
DetailsListView lst = (DetailsListView)tab.Tag;
+ TabClass tabInfo = _statuses.Tabs[tab.Text];
using (ControlTransaction.Update(lst))
{
this.SelectListItem(lst,
- _statuses.IndexOf(tab.Text, selId[tab.Text]),
- _statuses.IndexOf(tab.Text, focusedId[tab.Text]));
+ tabInfo.IndexOf(selId[tab.Text]),
+ tabInfo.IndexOf(focusedId[tab.Text]));
}
}
}
this.itemCacheLock.EnterWriteLock();
try
{
+ var tabInfo = _statuses.Tabs[_curTab.Text];
+
//キャッシュ要求(要求範囲±30を作成)
StartIndex -= 30;
if (StartIndex < 0) StartIndex = 0;
EndIndex += 30;
- if (EndIndex >= _statuses.Tabs[_curTab.Text].AllCount) EndIndex = _statuses.Tabs[_curTab.Text].AllCount - 1;
- _postCache = _statuses[_curTab.Text, StartIndex, EndIndex]; //配列で取得
+ if (EndIndex >= tabInfo.AllCount) EndIndex = tabInfo.AllCount - 1;
+ _postCache = tabInfo[StartIndex, EndIndex]; //配列で取得
_itemCacheIndex = StartIndex;
_itemCache = new ListViewItem[0] {};