public static List <int> Execute(TagDetails.TagType tagType) { List <int> ids = new List <int> (); using (DatabaseReader reader = new DatabaseReader(new MatchType((int)tagType).ExecuteReader())) { while (reader.Read()) { ids.Add((int)(long)reader ["id"]); } } return(ids); }
public void SetTagType(TagDetails tag, TagDetails.TagType type) { long tagId = this.GetTagId(tag.Tag); if (tagId == -1) { return; } lock (this.usedTagList) this.usedTagList [tagId].UpdateType(type); BooruApp.BooruApplication.TaskRunner.StartTaskAsync("Set tag type", () => Queries.Tags.SetType.Execute(tagId, type)); }
protected void SetTagType(TagDetails.TagType type) { if (this.activeTag == null) { return; } BooruApp.BooruApplication.Database.SetTagType(this.activeTag, type); TreePath path; TreeViewColumn column; this.TagTreeView.GetCursor(out path, out column); TreeIter iter; if (this.UnfilteredIterFromPath(out iter, path)) { lock (this.allTagsStore) this.allTagsStore.SetValue(iter, 4, type.ToString()); } }
public static void Execute(long tagId, TagDetails.TagType type) { new SetType(tagId, (int)type).ExecuteNonQuery(); }
protected TagListTab(Builder builder, IntPtr handle) : base(builder, handle) { builder.Autoconnect(this); foreach (var typeValue in Enum.GetValues(typeof(TagDetails.TagType))) { TagDetails.TagType type = (TagDetails.TagType)typeValue; Gtk.RadioButton button; if (this.typeButtons.Count == 0) { button = new Gtk.RadioButton(""); } else { button = new Gtk.RadioButton(this.typeButtons [0]); } button.Label = type.ToString(); this.typeButtons.Add(button); this.TagTypeBox.PackStart(button, true, true, 2); button.ShowAll(); button.CanFocus = false; button.Toggled += (sender, e) => { if (!this.loadingTag) { this.SetTagType(type); } }; } this.ImpliesTreeView.AppendColumn("Tag", new CellRendererText(), "text", 0); this.impliesStore = new ListStore(typeof(string)); this.ImpliesTreeView.Model = this.impliesStore; this.allTagsStore = new ListStore(typeof(int), typeof(string), typeof(float), typeof(int), typeof(string), typeof(TagDetails)); AddColumnText("ID", 0); AddColumnText("Usage", 3); AddColumnText("Tag", 1); AddColumnText("Score", 2); AddColumnText("Type", 4); this.filter = new TreeModelFilter(this.allTagsStore, null); this.filter.VisibleFunc = ((ITreeModel model, TreeIter iter) => { if (string.IsNullOrWhiteSpace(this.filterString)) { return(true); } lock (model) { string tagString = model.GetValue(iter, 1) as string; if (string.IsNullOrEmpty(tagString)) { return(true); } return(tagString.Contains(filterString)); } }); this.TagTreeView.HeadersClickable = true; this.TagTreeView.Model = this.allTagsStore; //this.filter; this.TagTreeView.CursorChanged += OnTagsCursorChanged; this.Sensitive = false; BooruApp.BooruApplication.EventCenter.DatabaseLoadStarted += this.OnDatabaseLoadStarted; BooruApp.BooruApplication.EventCenter.DatabaseLoadSucceeded += this.OnDatabaseLoadSucceeded; BooruApp.BooruApplication.EventCenter.WillQuit += this.OnWillQuit; }