public void AddNewTable() { var dialog = new AddTableDialog(); int tablesCount = TableDatas.Count; dialog.Init(this, _view, GetRandomTableName()); dialog.ShowDialog(); var result = dialog.Result; if (result.Success) { var tableForm = new TableForm(); tableForm.Init( result.Value, _form.TableForm_FormClosed, _form.TableForm_ModelChanged); tableForm.MdiParent = _form; TableDatas.Add(TableData.Get(tableForm)); _view.AddTableButton(result.Value.Name); _form.IsFileSaved = false; tableForm.Show(); } }
/* * @view контекстное меню * Переименовать таблицу. */ private void TSMI_TableBtnX__Rename_Click(object sender, EventArgs e) { TableButton button = FLPanel_Tables.Controls.Cast <TableButton>() .Where(x => x.Text == CtxMenuTableButtonName) .ElementAt(0); string oldName = button.Text; var dialog = new AddTableDialog(); dialog.Init(Model, View, oldName); dialog.ShowDialog(); var result = dialog.Result; if (result.Success) { Model.RenameTable(oldName, result.Value.Name); IsFileSaved = false; } }