public bool TabRename(string origTabName, out string newTabName)
{
//タブ名変更
newTabName = null;
using (InputTabName inputName = new InputTabName())
{
inputName.TabName = origTabName;
inputName.ShowDialog();
if (inputName.DialogResult == DialogResult.Cancel) return false;
newTabName = inputName.TabName;
}
this.TopMost = this._cfgCommon.AlwaysTop;
if (!string.IsNullOrEmpty(newTabName))
{
//新タブ名存在チェック
for (int i = 0; i < ListTab.TabCount; i++)
{
if (ListTab.TabPages[i].Text == newTabName)
{
string tmp = string.Format(Properties.Resources.Tabs_DoubleClickText1, newTabName);
MessageBox.Show(tmp, Properties.Resources.Tabs_DoubleClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
}
var tabPage = this.ListTab.TabPages.Cast<TabPage>()
.FirstOrDefault(x => x.Text == origTabName);
// タブ名を変更
if (tabPage != null)
tabPage.Text = newTabName;
_statuses.RenameTab(origTabName, newTabName);
SaveConfigsCommon();
SaveConfigsTabs();
_rclickTabName = newTabName;
return true;
}
else
{
return false;
}
}