コード例 #1
0
ファイル: Yata_menufile.cs プロジェクト: kevL/yata
        /// <summary>
        /// Handles it-click to create a new 2da-file.
        /// </summary>
        /// <param name="sender"><c><see cref="it_Create"/></c></param>
        /// <param name="e"></param>
        void fileclick_Create(object sender, EventArgs e)
        {
            Table = new YataGrid(this, String.Empty, false);

            Table.CreateTable();             // <- instead of LoadTable()

            _isCreate = true;
            fileclick_SaveAs(it_SaveAs, EventArgs.Empty);             // shall set Fullpath (incl. tab-string).
            _isCreate = false;

            if (File.Exists(Table.Fullpath))             // instead of CreatePage() ->
            {
                DrawRegulator.SuspendDrawing(Table);

                var tab = new TabPage();
                Tabs.TabPages.Add(tab);

                tab.Tag = Table;

                tab.Text = Path.GetFileNameWithoutExtension(Table.Fullpath);

                tab.Controls.Add(Table);
                Tabs.SelectedTab = tab;

                Table.Init();

                DrawRegulator.ResumeDrawing(Table);
            }
            else
            {
                YataGrid._init = false;
                Table.Dispose();
            }

            _bypassVerifyFile = true;
            tab_SelectedIndexChanged(null, EventArgs.Empty);
            _bypassVerifyFile = false;
        }