Files
MsAddIns/ExportExcelTest/Models/SheetTable.cs
2026-02-28 21:01:57 +08:00

61 lines
1.7 KiB
C#

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
{
/// <summary>
/// 表单
/// </summary>
public class SheetTable
{
public SheetTable(TypeOfSurrounding typeOfSurrounding)
{
TypeOfSurrounding = typeOfSurrounding;
MainCategories = new HashSet<PrimaryItem>();
}
public PrimaryItem this[int index]
{
get
{
if (index < 0 || index > MainCategories.Count - 1)
{
throw new ArgumentOutOfRangeException("索引越界");
}
return MainCategories.ElementAt(index);
}
}
public HashSet<PrimaryItem> MainCategories { get; private set; }
public string Name => $"{TypeOfSurrounding.GetDescription()}工程量";
public TypeOfSurrounding TypeOfSurrounding { get; set; }
///// <summary>
///// 围岩类型
///// </summary>
//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<PrimaryItem>();
}
MainCategories.Add(mainCategory);
return mainCategory;
}
}
}