protected internal class TabListItem
{
- public TabModel? Tab { get; set; }
+ public FilterTabModel? Tab { get; set; }
public string Label { get; set; } = "";
public override string ToString()
var tabs = this.TabInfo.Tabs.Append(this.TabInfo.MuteTab);
- foreach (var tab in tabs)
+ foreach (var tab in tabs.OfType<FilterTabModel>())
{
- if (!tab.IsDistributableTabType) continue;
-
this.TabList.Items.Add(new TabListItem
{
Label = tab.TabName,
this.OK_Button.Enabled = true;
}
- public TabModel? SelectedTab
+ public FilterTabModel? SelectedTab
=> this.TabList.SelectedItem is TabListItem item ? item.Tab : null;
- public TabModel[] SelectedTabs
+ public FilterTabModel[] SelectedTabs
=> this.TabList.SelectedItems
.Cast<TabListItem>()
.Select(x => x.Tab)
- .OfType<TabModel>()
+ .OfType<FilterTabModel>()
.ToArray();
}
}
foreach (var post in this.CurrentTab.SelectedPosts)
{
//タブ選択(or追加)
- if (!SelectTab(out var tabName)) return;
+ if (!SelectTab(out var tab)) return;
- fltDialog.SetCurrent(tabName);
+ fltDialog.SetCurrent(tab.TabName);
if (post.RetweetedBy == null)
{
public void AddFilterRuleByScreenName(params string[] screenNameArray)
{
//タブ選択(or追加)
- if (!SelectTab(out var tabName)) return;
-
- var tab = (FilterTabModel)this._statuses.Tabs[tabName];
+ if (!SelectTab(out var tab)) return;
bool mv;
bool mk;
public void AddFilterRuleBySource(params string[] sourceArray)
{
// タブ選択ダイアログを表示(or追加)
- if (!this.SelectTab(out var tabName))
+ if (!this.SelectTab(out var filterTab))
return;
- var filterTab = (FilterTabModel)this._statuses.Tabs[tabName];
-
bool mv;
bool mk;
if (filterTab.TabType != MyCommon.TabUsageType.Mute)
this.SaveConfigsTabs();
}
- private bool SelectTab([NotNullWhen(true)] out string? tabName)
+ private bool SelectTab([NotNullWhen(true)] out FilterTabModel? tab)
{
do
{
- tabName = null;
+ tab = null;
//振り分け先タブ選択
using (var dialog = new TabsDialog(_statuses))
{
if (dialog.ShowDialog(this) == DialogResult.Cancel) return false;
- tabName = dialog.SelectedTab?.TabName;
+ tab = dialog.SelectedTab;
}
this.CurrentTabPage.Focus();
//新規タブを選択→タブ作成
- if (tabName == null)
+ if (tab == null)
{
+ string tabName;
using (var inputName = new InputTabName())
{
inputName.TabName = _statuses.MakeTabName("MyTab");
this.TopMost = SettingManager.Common.AlwaysTop;
if (!string.IsNullOrEmpty(tabName))
{
- var tab = new FilterTabModel(tabName);
- if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false))
+ var newTab = new FilterTabModel(tabName);
+ if (!_statuses.AddTab(newTab) || !AddNewTab(newTab, startup: false))
{
var tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
MessageBox.Show(tmp, Properties.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
+ tab = newTab;
return true;
}
}