private void DataBindingModifierTypeStoreOnDataBindingModifierAdded(object sender, DataBindingModifierTypeStoreEvent e) { if (ModifierType != null) { return; } DataBindingModifierType modifierType = e.TypeRegistration.DataBindingModifierType; if (modifierType.PluginInfo.Guid == Entity.ModifierTypePluginGuid && modifierType.GetType().Name == Entity.ModifierType) { UpdateModifierType(modifierType); } }
/// <summary> /// Updates the modifier type of the modifier and re-compiles the expression /// </summary> /// <param name="modifierType"></param> public void UpdateModifierType(DataBindingModifierType modifierType) { if (_disposed) { throw new ObjectDisposedException("DataBindingModifier"); } // Calling CreateExpression will clear compiled expressions if (modifierType == null) { ModifierType = null; return; } Type targetType = DirectDataBinding.DataBinding.GetTargetType(); if (!modifierType.SupportsType(targetType)) { throw new ArtemisCoreException($"Cannot apply modifier type {modifierType.GetType().Name} to this modifier because " + $"it does not support this data binding's type {targetType.Name}"); } ModifierType = modifierType; }