예제 #1
0
        private void RenameTabToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_tabPageClickIndex < 0 || _tabPageClickIndex >= tabControlNotepad.TabCount)
            {
                Log.Warning("Rename tab page could not find selected index: {_tabPageClickIndex}", _tabPageClickIndex);
                return;
            }


            int tabPageIndex = _tabPageClickIndex;

            var renameTabControl = new RenameTabPageControl {
                TabPageName = _logicManager.GetTabPageLabel(tabPageIndex)
            };
            var renameTabForm = FormFactory.CreateFormFromUserControl(renameTabControl);

            if (renameTabForm.ShowDialog(this) == DialogResult.OK)
            {
                string tabPageName = renameTabControl.TabPageName;
                _logicManager.SetTabPageLabel(tabPageIndex, tabPageName);
                tabControlNotepad.TabPages[tabPageIndex].Text = tabPageName;
                _applicationState.TabTextDataChanged          = true;
            }

            renameTabControl.Dispose();
            renameTabForm.Dispose();
        }
예제 #2
0
        private void renameTabToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_tabPageClickIndex < 0 || _tabPageClickIndex > tabControlNotepad.TabCount)
            {
                Log.Warning("Rename tab page could not find selected index: {_tabPageClickIndex}", _tabPageClickIndex);
                return;
            }
            var tabPage = tabControlNotepad.TabPages[_tabPageClickIndex];

            var renameTabControl = new RenameTabPageControl {
                TabPageName = tabPage.Text
            };
            var renameTabForm = FormFactory.CreateFormFromUserControl(renameTabControl);

            if (renameTabForm.ShowDialog(this) == DialogResult.OK)
            {
                string tabPageName = renameTabControl.TabPageName;
                _tabPageDataCollection.TabPageDictionary[_tabPageClickIndex].TabPageLabel = tabPageName;
                tabPage.Text = tabPageName;
                _applicationState.TabTextDataChanged = true;
            }
        }