/// <summary> /// 构造事件处理 /// </summary> /// <param name="config"></param> public static void OnCreate(NotificationObject config) { if (NotificationObject.IsLoadingMode) { return; } var type = config.GetType(); var scope = EventScope.CreateScope(config, "_create_"); if (scope == null) { return; } using (scope) { foreach (var trigger in Triggers) { if (trigger.TargetType == type || type.IsSubclassOf(trigger.TargetType)) { trigger.OnCreate(config); } } } OnLoad(config); }
/// <summary> /// 构造事件处理 /// </summary> /// <param name="config"></param> public static void OnCreate(NotificationObject config) { if (config == null) { return; } var type = config.GetType(); var scope = EventScope.CreateScope(config, "Global", "OnCreate"); if (scope == null) { return; } using (scope) { foreach (var trigger in Triggers) { if (trigger.TargetType == null || trigger.TargetType == type || type.IsSubclassOf(trigger.TargetType)) { trigger.OnCreate(config); } } } if (WorkContext.IsNoChangedNotify) { return; } OnLoad(config); }
/// <summary> /// 载入事件处理 /// </summary> /// <param name="config"></param> public void OnCreate(NotificationObject config) { Target = config; var scope = EventScope.CreateScope(config, this.GetTypeName(), "_create_"); if (scope == null) { return; } using (scope) { OnCreate(); } }
/// <summary> /// 属性事件处理 /// </summary> /// <param name="config"></param> /// <param name="property"></param> internal void OnPropertyChanged(NotificationObject config, string property) { Target = config; var scope = EventScope.CreateScope(config, this.GetTypeName(), property); if (scope == null) { return; } using (scope) { OnPropertyChanged(property); } }
/// <summary> /// 发出属性修改前事件 /// </summary> /// <param name="config"></param> /// <param name="property">属性</param> /// <param name="oldValue">旧值</param> /// <param name="newValue">新值</param> public void BeforePropertyChanged(NotificationObject config, string property, object oldValue, object newValue) { Target = config; var scope = EventScope.CreateScope(config, this.GetTypeName(), property); if (scope == null) { return; } using (scope) { BeforePropertyChanged(property, oldValue, newValue); } }
/// <summary> /// 删除事件处理 /// </summary> /// <param name="config"></param> /// <param name="parent"></param> public void OnRemoved(NotificationObject parent, NotificationObject config) { Target = parent; var scope = EventScope.CreateScope(config, this.GetTypeName(), "_del_"); if (scope == null) { return; } using (scope) { OnRemoved(config); } }
/// <summary> /// 完成代码生成 /// </summary> public static void OnCodeGeneratorEnd() { var scope = EventScope.CreateScope(My, "Global", "OnCodeGeneratorEnd"); if (scope == null) { return; } using (scope) { foreach (var trigger in Triggers) { trigger.OnCodeGeneratorEnd(); } } }
/// <summary> /// 删除事件处理 /// </summary> /// <param name="config"></param> /// <param name="parent"></param> public static void OnRemoved(NotificationObject parent, NotificationObject config) { var type = config.GetType(); var scope = EventScope.CreateScope(config, "_remove_"); if (scope == null) { return; } using (scope) { foreach (var trigger in Triggers) { if (trigger.TargetType == type || type.IsSubclassOf(trigger.TargetType)) { trigger.OnRemoved(config, config); } } } }
/// <summary> /// 开始代码生成 /// </summary> public static void OnCodeGeneratorBegin(NotificationObject config) { if (config == null) { return; } var scope = EventScope.CreateScope(My, "Global", "OnCodeGeneratorBegin"); if (scope == null) { return; } using (scope) { foreach (var trigger in Triggers) { trigger.OnCodeGeneratorBegin(config); } } }
/// <summary> /// 发出属性修改前事件 /// </summary> /// <param name="config"></param> /// <param name="property">属性</param> /// <param name="oldValue">旧值</param> /// <param name="newValue">新值</param> public static void BeforePropertyChanged(NotificationObject config, string property, object oldValue, object newValue) { if (NotificationObject.IsLoadingMode) { return; } var type = config.GetType(); var scope = EventScope.CreateScope(config, property); if (scope == null) { return; } using (scope) { foreach (var trigger in Triggers) { if (trigger.TargetType == type || type.IsSubclassOf(trigger.TargetType)) { trigger.BeforePropertyChanged(config, property, oldValue, newValue); } } } }