private void RefreshListTabs()
{
- var tabs = new List<TabModel>();
-
- foreach (var tab in this._sts.Tabs)
- {
- if (tab.TabType == MyCommon.TabUsageType.Mute)
- continue;
-
- tabs.Add(tab);
- }
-
- var muteTab = this._sts.GetTabByType(MyCommon.TabUsageType.Mute);
- if (muteTab != null)
- tabs.Add(muteTab);
-
- this.tabs = tabs;
+ this.tabs = this._sts.Tabs.Append(this._sts.MuteTab).ToList();
using (ControlTransaction.Update(this.ListTabs))
{
{
//個別タブの情報をDictionaryで保持
public TabCollection Tabs { get; } = new TabCollection();
+ public MuteTabModel MuteTab { get; private set; }
+
public ConcurrentDictionary<long, PostClass> Posts { get; } = new ConcurrentDictionary<long, PostClass>();
private Dictionary<long, PostClass> _quotes = new Dictionary<long, PostClass>();
{
lock (this.LockObj)
{
+ if (tab is MuteTabModel muteTab)
+ {
+ if (this.MuteTab != null)
+ return false;
+
+ this.MuteTab = muteTab;
+ return true;
+ }
+
if (this.Tabs.Contains(tab.TabName))
return false;
public bool IsMuted(PostClass post, bool isHomeTimeline)
{
- var muteTab = this.GetTabByType<MuteTabModel>();
+ var muteTab = this.MuteTab;
if (muteTab != null && muteTab.AddFiltered(post) == MyCommon.HITRESULT.Move)
return true;
foreach (var tab in this.Tabs.OfType<FilterTabModel>().ToArray())
{
- if (tab.TabType == MyCommon.TabUsageType.Mute)
- continue;
-
// フィルタに変更のあったタブのみを対象とする
if (!tab.FilterModified)
continue;
if (this._statuses.GetTabByType<FavoritesTabModel>() == null)
this._statuses.AddTab(new FavoritesTabModel());
- if (this._statuses.GetTabByType<MuteTabModel>() == null)
+ if (this._statuses.MuteTab == null)
this._statuses.AddTab(new MuteTabModel());
foreach (var tab in _statuses.Tabs)
{
- // ミュートタブは表示しない
- if (tab.TabType == MyCommon.TabUsageType.Mute)
- continue;
-
if (!AddNewTab(tab, startup: true))
throw new TabException(Properties.Resources.TweenMain_LoadText1);
}
var tabs = this.ListTab.TabPages.Cast<TabPage>()
.Select(x => this._statuses.Tabs[x.Text])
- .Append(this._statuses.GetTabByType(MyCommon.TabUsageType.Mute));
+ .Append(this._statuses.MuteTab);
foreach (var tab in tabs)
{