mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-24 04:06:48 +08:00
- 新增 Architecture 基类与 IArchitecture 接口,实现单例模式与组件注册管理 - 集成 IOC 容器支持系统、模型、工具的依赖注入与生命周期管理 - 实现命令模式基础类 AbstractCommand 与接口 ICommand,支持带返回值命令 - 提供事件系统集成,支持事件的发布与订阅机制 - 添加控制器接口 IController,整合命令发送、事件注册与模型获取能力 - 创建详细的 README 文档说明各组件使用方式与设计模式应用 - 支持命令、查询、事件的统一调度与解耦通信机制
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
namespace GFramework.framework.events;
|
|
|
|
|
|
/// <summary>
|
|
/// 取消注册列表类,用于管理多个需要取消注册的对象
|
|
/// </summary>
|
|
public class UnRegisterList : IUnRegisterList
|
|
{
|
|
private readonly List<IUnRegister> _unRegisterList = [];
|
|
|
|
/// <summary>
|
|
/// 向取消注册列表中添加一个新的可取消注册对象
|
|
/// </summary>
|
|
/// <param name="unRegister">需要添加到列表中的可取消注册对象</param>
|
|
public void Add(IUnRegister unRegister)
|
|
{
|
|
_unRegisterList.Add(unRegister);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 对列表中的所有对象执行取消注册操作,并清空列表
|
|
/// </summary>
|
|
public void UnRegisterAll()
|
|
{
|
|
// 遍历所有注册项并执行取消注册
|
|
foreach (var t in _unRegisterList)
|
|
{
|
|
t.UnRegister();
|
|
}
|
|
|
|
// 清空列表
|
|
_unRegisterList.Clear();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取取消注册列表的只读属性
|
|
/// </summary>
|
|
public List<IUnRegister> UnregisterList { get; }
|
|
}
|