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();
        }
Пример #2
0
        private static void AddToLibrary(string[] tags, string[] tagGroups, AttribInfo info)
        {
            RBFLibEntry entry = new RBFLibEntry();

            entry.Values    = new List <AttributeValue>();
            entry.Submenu   = info.Category;
            entry.TagGroups = tagGroups ?? new string[0];
            entry.Tags      = tags ?? new string[0];
            entry.Values.Add(info.Value);
            entry.Name = info.Value.Key;
            RBFLibrary.RemoveEntry(entry.Name);
            RBFLibrary.AddEntry(entry);
        }
Пример #3
0
        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();
        }
        private void EditTagsToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (_lbxEntries.SelectedItem == null)
            {
                return;
            }
            var entry = _lbxEntries.SelectedItem as RBFLibEntry;
            var dlg   = new TagEditor {
                Tags = { Lines = entry.Tags }, TagGroups = entry.TagGroups
            };

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            entry.Tags = dlg.Tags.Lines;
            RBFLibrary.RemoveEntry(entry);
            RBFLibrary.AddEntry(entry);
        }