private bool SelectTab(out string tabName)
{
do
{
tabName = null;
//振り分け先タブ選択
using (var dialog = new TabsDialog(_statuses))
{
if (dialog.ShowDialog(this) == DialogResult.Cancel) return false;
var selectedTab = dialog.SelectedTab;
tabName = selectedTab == null ? null : selectedTab.TabName;
}
ListTab.SelectedTab.Focus();
//新規タブを選択→タブ作成
if (tabName == null)
{
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = _statuses.MakeTabName("MyTab");
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return false;
tabName = inputName.TabName;
}
this.TopMost = this._cfgCommon.AlwaysTop;
if (!string.IsNullOrEmpty(tabName))
{
var tab = new FilterTabModel(tabName);
if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false))
{
string tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
MessageBox.Show(tmp, Properties.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
//もう一度タブ名入力
}
else
{
return true;
}
}
}
else
{
//既存タブを選択
return true;
}
}
while (true);
}