Exemple #1
0
        /// <summary>
        /// Prior to this call, you must have created the connector using the
        /// </summary>
        /// <param name="self"></param>
        /// <param name="deserializationContext"></param>
        public void LoadFromXElement(XElement self, DeserializationContext deserializationContext)
        {
            IModel model            = null;
            string connectorName    = self.Attribute("connectorName").Value;
            string connectorDesc    = self.Attribute("connectorDesc").Value;
            Guid   connectorGuidWas = XmlConvert.ToGuid(self.Attribute("connectorGuid").Value);
            Guid   connectorGuidIs  = Guid.NewGuid();

            deserializationContext.SetNewGuidForOldGuid(connectorGuidWas, connectorGuidIs);
            IMOHelper.Initialize(ref m_model, model, ref m_name, connectorName, ref m_description, connectorDesc, ref m_guid, connectorGuidIs);
            IMOHelper.RegisterWithModel(this);

            XElement    source = self.Element("Source");
            Guid        upstreamOwnerGuidWas = XmlConvert.ToGuid(source.Attribute("guid").Value);
            Guid        upstreamOwnerGuidIs  = Guid.NewGuid();
            string      upstreamPortName     = source.Attribute("name").Value;
            IPortOwner  usmb         = (IPortOwner)deserializationContext.GetModelObjectThatHad(upstreamOwnerGuidWas);
            IOutputPort upstreamPort = (IOutputPort)usmb.Ports[upstreamPortName];

            XElement   destination            = self.Element("Destination");
            Guid       downstreamOwnerGuidWas = XmlConvert.ToGuid(destination.Attribute("guid").Value);
            Guid       downstreamOwnerGuidIs  = Guid.NewGuid();
            string     downstreamPortName     = destination.Attribute("name").Value;
            IPortOwner dsmb           = (IPortOwner)deserializationContext.GetModelObjectThatHad(downstreamOwnerGuidWas);
            IInputPort downstreamPort = (IInputPort)dsmb.Ports[downstreamPortName];

            Connect(upstreamPort, downstreamPort);
        }
Exemple #2
0
        /// <summary>
        /// Initializes the fields that feed the properties of this IModelObject identity.
        /// </summary>
        /// <param name="model">The IModelObject's new model value.</param>
        /// <param name="name">The IModelObject's new name value.</param>
        /// <param name="description">The IModelObject's new description value.</param>
        /// <param name="guid"></param>
        public void InitializeIdentity(IModel model, string name, string description, Guid guid)
        {
            Debug.Assert(model == this);
            IModel m_model = null; // To fake out the call below, since Model doesn't have this member field.

            IMOHelper.Initialize(ref m_model, model, ref m_name, name, ref m_description, description, ref m_guid, guid);
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BasicNonBufferedConnector"/> class.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="name">The name.</param>
 /// <param name="description">The description.</param>
 /// <param name="guid">The GUID.</param>
 /// <param name="input">The input.</param>
 /// <param name="output">The output.</param>
 public BasicNonBufferedConnector(IModel model, string name, string description, Guid guid, IPort input, IPort output)
 {
     IMOHelper.Initialize(ref m_model, model, ref m_name, name, ref m_description, description, ref m_guid, guid);
     Connect(input, output);
     IMOHelper.RegisterWithModel(this);
     m_inUse = false;
 }
Exemple #4
0
 public Splitter(IModel model, string name, Guid guid, int nOuts)
 {
     IMOHelper.Initialize(ref m_model, model, ref m_name, name, ref m_description, null, ref m_guid, guid);
     m_ports = new PortSet();
     m_input = new SimpleInputPort(model, "Input", Guid.NewGuid(), this, GetDataArrivalHandler());
     //AddPort(m_input); <-- Done in SIP's ctor.
     Input     = m_input;
     Outputs   = new IOutputPort[nOuts];
     m_outputs = new SimpleOutputPort[nOuts];
     for (int i = 0; i < nOuts; i++)
     {
         m_outputs[i] = new SimpleOutputPort(model, "Output" + i, Guid.NewGuid(), this, GetDataProvisionHandler(i), GetPeekHandler(i));
         Outputs[i]   = m_outputs[i];
         //AddPort(m_outputs[i]); <-- Done in SOP's ctor.
     }
     IMOHelper.RegisterWithModel(this);
 }
Exemple #5
0
 /// <summary>
 /// Initializes the fields that feed the properties of this IModelObject identity.
 /// </summary>
 /// <param name="model">The IModelObject's new model value.</param>
 /// <param name="name">The IModelObject's new name value.</param>
 /// <param name="description">The IModelObject's new description value.</param>
 /// <param name="guid">The IModelObject's new GUID value.</param>
 public void InitializeIdentity(IModel model, string name, string description, Guid guid)
 {
     IMOHelper.Initialize(ref m_model, model, ref m_name, name, ref m_description, description, ref m_guid, guid);
 }