using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CustomOpenAddins.Models { /// /// 表单 /// public class SheetTable { public SheetTable(TypeOfSurrounding typeOfSurrounding) { TypeOfSurrounding = typeOfSurrounding; MainCategories = new HashSet(); } public PrimaryItem this[int index] { get { if (index < 0 || index > MainCategories.Count - 1) { throw new ArgumentOutOfRangeException("索引越界"); } return MainCategories.ElementAt(index); } } public HashSet MainCategories { get; private set; } public string Name => $"{TypeOfSurrounding.GetDescription()}工程量"; public TypeOfSurrounding TypeOfSurrounding { get; set; } ///// ///// 围岩类型 ///// //public TypeOfSurrounding TypeOfSurrounding { get; } //TypeOfSurrounding IItem.TypeOfSurrounding { get => TypeOfSurrounding; set => throw new NotImplementedException(); } public PrimaryItem AddMain(string mainName) { PrimaryItem mainCategory = new PrimaryItem(mainName, this); if (MainCategories == null) { MainCategories = new HashSet(); } MainCategories.Add(mainCategory); return mainCategory; } } }