重构Component相关代码,调整API接口

This commit is contained in:
monitor1394
2023-02-12 21:22:53 +08:00
parent 22b167981b
commit 4964bca341
57 changed files with 349 additions and 185 deletions

View File

@@ -3,36 +3,40 @@ using System.Collections.Generic;
namespace XCharts.Runtime
{
/// <summary>
/// The attribute for serie component.
/// |可添加到Serie的组件。
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class SerieExtraComponentAttribute : Attribute
public sealed class SerieComponentAttribute : Attribute
{
public readonly List<Type> types = new List<Type>();
public SerieExtraComponentAttribute()
public SerieComponentAttribute()
{ }
public SerieExtraComponentAttribute(Type type1)
public SerieComponentAttribute(Type type1)
{
AddType(type1);
}
public SerieExtraComponentAttribute(Type type1, Type type2)
public SerieComponentAttribute(Type type1, Type type2)
{
AddType(type1);
AddType(type2);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3)
public SerieComponentAttribute(Type type1, Type type2, Type type3)
{
AddType(type1);
AddType(type2);
AddType(type3);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)
public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4)
{
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)
public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)
{
AddType(type1);
AddType(type2);
@@ -40,7 +44,7 @@ namespace XCharts.Runtime
AddType(type4);
AddType(type5);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)
public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)
{
AddType(type1);
AddType(type2);
@@ -49,7 +53,7 @@ namespace XCharts.Runtime
AddType(type5);
AddType(type6);
}
public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)
public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)
{
AddType(type1);
AddType(type2);
@@ -67,7 +71,7 @@ namespace XCharts.Runtime
types.Add(type);
}
public bool Contains<T>() where T : ISerieExtraComponent
public bool Contains<T>() where T : ISerieComponent
{
return Contains(typeof(T));
}

View File

@@ -2,10 +2,11 @@ using System;
namespace XCharts.Runtime
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
/// <summary>
/// What serie can convert to me
/// The attribute for which serie types can be converted to.
/// |可转化为哪些Serie类型。
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class SerieConvertAttribute : Attribute
{
public readonly Type type0;

View File

@@ -3,36 +3,41 @@ using System.Collections.Generic;
namespace XCharts.Runtime
{
/// <summary>
/// The attribute for serie data component.
/// |可添加到SerieData的组件。
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class SerieDataExtraComponentAttribute : Attribute
public sealed class SerieDataComponentAttribute : Attribute
{
public readonly List<Type> types = new List<Type>();
public SerieDataExtraComponentAttribute()
{ }
public SerieDataExtraComponentAttribute(Type type1)
public SerieDataComponentAttribute()
{
}
public SerieDataComponentAttribute(Type type1)
{
AddType(type1);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2)
public SerieDataComponentAttribute(Type type1, Type type2)
{
AddType(type1);
AddType(type2);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3)
public SerieDataComponentAttribute(Type type1, Type type2, Type type3)
{
AddType(type1);
AddType(type2);
AddType(type3);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)
public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4)
{
AddType(type1);
AddType(type2);
AddType(type3);
AddType(type4);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)
public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)
{
AddType(type1);
AddType(type2);
@@ -40,7 +45,7 @@ namespace XCharts.Runtime
AddType(type4);
AddType(type5);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)
public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)
{
AddType(type1);
AddType(type2);
@@ -49,7 +54,7 @@ namespace XCharts.Runtime
AddType(type5);
AddType(type6);
}
public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)
public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)
{
AddType(type1);
AddType(type2);
@@ -67,7 +72,7 @@ namespace XCharts.Runtime
types.Add(type);
}
public bool Contains<T>() where T : ISerieExtraComponent
public bool Contains<T>() where T : ISerieComponent
{
return Contains(typeof(T));
}