Ejemplo n.º 1
0
        public async Task OnExportsChangedAsync(Envoy envoy, ExportsChangedData data)
        {
            if (ShouldUpdateDataTypeFromChange(data))
            {
                NIType oldType = Type;
                NIType type    = await envoy.GetTypeDiagramSignatureAsync();

                if (type.IsUnset() || type == oldType)
                {
                    return;
                }
                using (var transaction = TransactionManager.BeginTransactionIfNecessary("Set type", TransactionPurpose.NonUser))
                {
                    Type = type;
                    TransactionRecruiter.EnlistPropertyItem(this, nameof(Type), oldType, type, (t, __) => { Type = t; }, TransactionHints.Semantic);
                    UpdateTerminalsFromDataType(type);
                    transaction?.Commit();
                }
            }
        }