91 lines
1.9 KiB
C#
91 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using zero.Core.Entities;
|
|
|
|
namespace zero.Core.Options
|
|
{
|
|
public class RoleOptions : ZeroBackofficeCollection<Space>, IZeroCollectionOptions
|
|
{
|
|
public RoleOptions()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public void Add<T>() where T : Space, new()
|
|
{
|
|
Items.Add(new T());
|
|
}
|
|
|
|
|
|
public void AddList<T>(string alias, string name, string description, string icon) where T : SpaceContent, new()
|
|
{
|
|
Items.Add(new Space()
|
|
{
|
|
Alias = alias,
|
|
View = SpaceView.List,
|
|
Name = name,
|
|
Description = description,
|
|
Icon = icon,
|
|
Type = typeof(T)
|
|
});
|
|
}
|
|
|
|
|
|
public void AddEditor<T>(string alias, string name, string description, string icon) where T : SpaceContent, new()
|
|
{
|
|
Items.Add(new Space()
|
|
{
|
|
Alias = alias,
|
|
View = SpaceView.Editor,
|
|
Name = name,
|
|
Description = description,
|
|
Icon = icon,
|
|
Type = typeof(T)
|
|
});
|
|
}
|
|
|
|
|
|
public void AddSeparator()
|
|
{
|
|
Space lastSpace = Items.LastOrDefault();
|
|
|
|
if (lastSpace != null)
|
|
{
|
|
lastSpace.LineBelow = true;
|
|
}
|
|
}
|
|
|
|
|
|
public void AddCustom<T>(string componentPath, string alias, string name, string description, string icon) where T : SpaceContent, new()
|
|
{
|
|
Items.Add(new Space()
|
|
{
|
|
Alias = alias,
|
|
View = SpaceView.Custom,
|
|
ComponentPath = componentPath,
|
|
Name = name,
|
|
Description = description,
|
|
Icon = icon,
|
|
Type = typeof(T)
|
|
});
|
|
}
|
|
|
|
|
|
public void AddCustom(string componentPath, string alias, string name, string description, string icon)
|
|
{
|
|
Items.Add(new Space()
|
|
{
|
|
Alias = alias,
|
|
View = SpaceView.Custom,
|
|
ComponentPath = componentPath,
|
|
Name = name,
|
|
Description = description,
|
|
Icon = icon
|
|
});
|
|
}
|
|
}
|
|
}
|