private void renameEntryToolStripMenuItem_Click(object sender, EventArgs e) { if (treEntries.Focused) { IEntry entry = (IEntry)treEntries.SelectedNode.Tag; frmName name = new frmName(entry, _fileAdapter.EntriesHaveUniqueNames, _fileAdapter.NameList, _fileAdapter.NameFilter, _fileAdapter.NameMaxLength); if (name.ShowDialog() == DialogResult.OK && name.NameChanged) { if (_fileAdapter.RenameEntry(entry, name.NewName)) { _hasChanges = true; treEntries.FindNodeByIEntry(entry).Text = name.NewName; UpdateForm(); } } } }
private void addEntryToolStripMenuItem_Click(object sender, EventArgs e) { if (treEntries.Focused) { IEntry entry = _fileAdapter.NewEntry(); frmName name = new frmName(entry, _fileAdapter.EntriesHaveUniqueNames, _fileAdapter.NameList, _fileAdapter.NameFilter, _fileAdapter.NameMaxLength, true); if (name.ShowDialog() == DialogResult.OK && name.NameChanged) { entry.Name = name.NewName; if (_fileAdapter.AddEntry(entry)) { _hasChanges = true; LoadEntries(); treEntries.SelectNodeByIEntry(entry); UpdateForm(); } } } }