public static TagContainer GetCategoryTagContainer(CategoryData category, TagTabControl tagTabControl) { TagContainer categoryTagContainer = null; foreach (TabPage tabPage in tagTabControl.TabPages) { if (tabPage.Text == category.Name) { if (tabPage.Controls.Count > 0) // otherwise, the TagContainer does not yet exist and needs to be created { categoryTagContainer = tabPage.Controls[0] as TagContainer; } break; } } return(categoryTagContainer); }
private void SwapTabPages(TabPage srcTab, TabPage dstTab) { int srcIndex = tabControlImageTagger.TabPages.IndexOf(srcTab); int dstIndex = tabControlImageTagger.TabPages.IndexOf(dstTab); CategoryData srcCategory = WallpaperData.TaggingInfo.GetCategory(srcIndex); CategoryData dstCategory = WallpaperData.TaggingInfo.GetCategory(dstIndex); tabControlImageTagger.TabPages[dstIndex] = srcTab; tabControlImageTagger.TabPages[srcIndex] = dstTab; WallpaperData.TaggingInfo.SetCategory(dstIndex, srcCategory); WallpaperData.TaggingInfo.SetCategory(srcIndex, dstCategory); if (tabControlImageTagger.SelectedIndex == srcIndex) { tabControlImageTagger.SelectedIndex = dstIndex; } else if (tabControlImageTagger.SelectedIndex == dstIndex) { tabControlImageTagger.SelectedIndex = srcIndex; } tabControlImageTagger.Refresh(); }
public void RemoveCategory(CategoryData category) { RemoveCategory(WallpaperData.TaggingInfo.GetCategoryIndex(category)); }
public bool CreateCategory(CategoryData category) { //!TaggingTools.GetCategoryTagContainer(category, this) = null; // needs to be refreshed for a number of reasons such as: Resetting events & reloading disposed objects return(CreateCategory(category.Name, category.Tags, category.Enabled, category.UseForNaming)); }
public static Button GetTagButton(TagData tag) { CategoryData tagCategory = WallpaperData.TaggingInfo.GetCategory(tag.ParentCategoryName); return(GetCategoryTagContainer(tagCategory, ActiveTagTabControl)?.GetTagButton(tag)); }
public bool ContainsCategory(CategoryData category) { return(ContainsCategory(category.Name)); }
public void SetCategory(int index, CategoryData category) { CategoryInfo[index] = category; }
public int GetCategoryIndex(CategoryData category) { return(CategoryInfo.IndexOf(category)); }