本文整理汇总了C#中Category.AddSingleSet方法的典型用法代码示例。如果您正苦于以下问题:C# Category.AddSingleSet方法的具体用法?C# Category.AddSingleSet怎么用?C# Category.AddSingleSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category
的用法示例。
在下文中一共展示了Category.AddSingleSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JoinCategories
/// <summary>
/// Method to join together selected categories in the listview.
/// </summary>
/// <param name="categoriesIndices">Indices of selected categories.</param>
public void JoinCategories(ArrayList categoriesIndices)
{
categoriesIndices.Sort();
CategoryType firstType = new CategoryType();
String newName;
newName = "Join < ";
if (categoriesIndices.Count > 0)
{
firstType = this.GetCategory(Convert.ToInt32(categoriesIndices[0])).CatType;
}
else
{
return;
}
Category newMultiSet = new Category();
newMultiSet.CatType = firstType;
bool firstRun = true;
foreach (int index1 in categoriesIndices)
{
//cannot join multisets of different types
if (this.GetCategory(index1).CatType != firstType)
{
return;
}
//if the category is of interval type, add all of the intervals to the new category
if (newMultiSet.CatType == CategoryType.Interval)
{
foreach (Interval tempInterval in this.GetCategory(index1).GetIntervals())
{
newMultiSet.AddInterval(tempInterval);
}
}
//add all of the enum values otherwise
else
{
newMultiSet.AddSingleSet(this.GetCategory(index1).Set);
}
if (firstRun)
{
newName = newName + this.GetCategory(index1).Name;
firstRun = false;
}
else
{
newName = newName + "; " + this.GetCategory(index1).Name;
}
}
newName = newName + " >";
newMultiSet.Name = newName;
int offset = 0;
foreach (object index1 in categoriesIndices)
{
int index = Convert.ToInt32(index1.ToString());
this.RemoveCategory(index - offset);
offset++;
}
this.AddNewCategoryDirect(newMultiSet);
this.OnDataStructureChange();
}