void on_TagsEntry_activate(object sender, EventArgs args) { if (this.ActiveImage == null) { return; } var enteredTags = this.TagsEntry.Text.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (enteredTags.Length == 0) { this.Advance(true); return; } foreach (string enteredTag in enteredTags) { if (enteredTag.StartsWith("-")) { var tag = BooruApp.BooruApplication.Database.GetCanonicalTag(enteredTag.Substring(1)); this.ActiveImage.RemoveTag(tag); } else { var tag = BooruApp.BooruApplication.Database.GetCanonicalTag(enteredTag); long tagId = BooruApp.BooruApplication.Database.GetTagId(tag); if (tagId == -1) { var resolve = ResolveTagWindow.Create(tag); resolve.Parent = this; if (resolve.Run() == (int)Gtk.ResponseType.Ok) { foreach (var t in resolve.Tag.Split(" ".ToCharArray())) { BooruApp.BooruApplication.Database.GetOrCreateTagId(t); this.ActiveImage.AddTag(t); } } resolve.Hide(); } else { this.ActiveImage.AddTag(tag); } } } this.TagsEntry.Text = ""; this.imageView.QueueDraw(); }
protected void on_TagEntry_activate(object sender, EventArgs args) { var enteredTags = TagEntry.Text.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (enteredTags.Length == 0) { this.Respond(Gtk.ResponseType.Ok); this.Hide(); return; } foreach (string tag in enteredTags) { if (tag.StartsWith("-")) { this.image.RemoveTag(tag.Substring(1)); } else { int tagId = this.image.db.GetTagId(tag); if (tagId == -1) { var resolve = ResolveTagWindow.Create(tag, this.image.db); resolve.Parent = this; if (resolve.Run() == (int)Gtk.ResponseType.Ok) { this.image.db.GetOrCreateTagId(resolve.Tag); this.image.AddTag(resolve.Tag); } resolve.Hide(); } else { this.image.AddTag(tag); } } } TagEntry.Text = ""; this.imageView.QueueDraw(); }