|
@@ -38,6 +38,7 @@ public partial class EventEditor : UserControl, INotifyPropertyChanged
|
|
|
OnPropertyChanged();
|
|
|
|
|
|
HasType = value.HasValue && EventTypeHasEntityType(value.Value);
|
|
|
+ HasTriggers = value != Comal.Classes.EventType.Scheduled;
|
|
|
DoChanged();
|
|
|
|
|
|
UpdateEventData();
|
|
@@ -57,6 +58,17 @@ public partial class EventEditor : UserControl, INotifyPropertyChanged
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private bool _hasTriggers = true;
|
|
|
+ public bool HasTriggers
|
|
|
+ {
|
|
|
+ get => _hasTriggers;
|
|
|
+ set
|
|
|
+ {
|
|
|
+ _hasTriggers = value;
|
|
|
+ OnPropertyChanged();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private bool _hasProperties;
|
|
|
public bool HasProperties
|
|
|
{
|
|
@@ -110,9 +122,9 @@ public partial class EventEditor : UserControl, INotifyPropertyChanged
|
|
|
EventDataType = inter.GenericTypeArguments[0];
|
|
|
DataModelType = inter.GenericTypeArguments[1];
|
|
|
|
|
|
- if (EventTypeHasEntityType(EventType.Value))
|
|
|
+ if (EventTypeGetEntityType(EventType.Value, EventDataType) is Type entityType)
|
|
|
{
|
|
|
- EntityType = EventDataType.GenericTypeArguments[0];
|
|
|
+ EntityType = entityType;
|
|
|
}
|
|
|
}
|
|
|
var control = Activator.CreateInstance(typeof(EventEditorControl<,>).MakeGenericType(EventDataType, DataModelType), value);
|
|
@@ -154,6 +166,15 @@ public partial class EventEditor : UserControl, INotifyPropertyChanged
|
|
|
{
|
|
|
return EventUtils.GetEventType(eventType).HasInterface(typeof(IEntityEvent<>));
|
|
|
}
|
|
|
+ private Type? EventTypeGetEntityType(EventType eventType, Type eventDataType)
|
|
|
+ {
|
|
|
+ var evType = EventUtils.GetEventType(eventType);
|
|
|
+ var entType = evType?.GetInterfaceDefinition(typeof(IEntityEvent<>))?.GenericTypeArguments[0];
|
|
|
+ if (evType is null || entType is null) return null;
|
|
|
+
|
|
|
+ var idx = Array.IndexOf(evType.GetGenericArguments(), entType);
|
|
|
+ return eventDataType.GenericTypeArguments[idx];
|
|
|
+ }
|
|
|
|
|
|
private void UpdateEventData()
|
|
|
{
|