Exemple #1
0
        public override IConnection Connect(IInputPlug inputPlug)
        {
            if (IsCompatible(inputPlug))
            {
                if (property.CurrentValue == null)
                {
                    InterfacePlug plug = (InterfacePlug)inputPlug;

                    property.CurrentValue = plug.Owner.QueryInterface(plug.InterfaceType);

                    PropertyInterfaceConnection connection = new PropertyInterfaceConnection(this, inputPlug);

                    if (!inputPlug.OnConnection(connection))
                    {
                        connection.Dispose();
                        return(null);
                    }

                    this.connections.Add(connection);
                    return(connection);
                }
            }

            return(null);
        }
        public override IConnection Connect(IInputPlug inputPlug)
        {
            if (IsCompatible(inputPlug))
            {
                if (property.CurrentValue == null)
                {
                    InterfacePlug plug = (InterfacePlug)inputPlug;

                    property.CurrentValue = plug.Owner.QueryInterface(plug.InterfaceType);

                    PropertyInterfaceConnection connection = new PropertyInterfaceConnection(this, inputPlug);

                    if (!inputPlug.OnConnection(connection))
                    {
                        connection.Dispose();
                        return null;
                    }

                    this.connections.Add(connection);
                    return connection;
                }
            }

            return null;
        }