private static void AddNewEntryToolStripMenuItemClick(object sender, EventArgs e) { var dlg = new AddToLibrary(); if (dlg.ShowDialog() != DialogResult.OK) { dlg.Dispose(); return; } var tmp = new RBFLibEntry { Name = dlg.ValueName, Tags = dlg.Tags, TagGroups = dlg.TagGroups, Values = new List <AttributeValue>() }; if (RBFLibrary.GetEntry(tmp.Name) == null) { RBFLibrary.AddEntry(tmp); } else if (dlg.AddTags) { RBFLibEntry entry = RBFLibrary.GetEntry(tmp.Name); foreach (string t in tmp.Tags) { RBFLibrary.AddEntryToTag(entry, t); } } dlg.Dispose(); }
private void CopyIntoLibraryToolStripMenuItemClick(object sender, EventArgs e) { TreeNode selected = m_trvTables.SelectedNode; if (selected == null || selected.Tag == null) { return; } var dlg = new AddToLibrary(); if (selected.Parent != null) { dlg.Tags = new[] { selected.Parent.Text + '\n' } } ; dlg.ValueName = selected.Text; if (dlg.ShowDialog() != DialogResult.OK) { dlg.Dispose(); return; } var tmp = new RBFLibEntry { Name = dlg.ValueName, Tags = dlg.Tags, TagGroups = dlg.TagGroups }; if (dlg.SubMenu != string.Empty) { tmp.Submenu = dlg.SubMenu; } tmp.Values = new List <AttributeValue> { selected.Tag as AttributeValue }; if (RBFLibrary.GetEntry(tmp.Name) == null) { RBFLibrary.AddEntry(tmp); } else if (dlg.AddTags) { RBFLibEntry entry = RBFLibrary.GetEntry(tmp.Name); foreach (string t in tmp.Tags) { RBFLibrary.AddEntryToTag(entry, t); } } dlg.Dispose(); }